pub fn reporting(address: u8, pga: Pga, volts: f32) -> WordPartExpand description
An ADS1115 that reads what it is asked to.
§Arguments
address- the address it answers to.pga- the gain the driver converts at.volts- the voltage it reports, held to the gain’s full-scale range.
§Returns
The part. Its reading lands on the nearest of the 32768 steps either side of zero the gain divides its range into.
§Examples
use pamoja_hal::script::DelayLog;
use pamoja_sensors::ads1115::{address, sim, Ads1115, Pga};
let mut adc = Ads1115::new(sim::reporting(address::GND, Pga::Fsr4_096, 3.0), address::GND, DelayLog::new())
.with_gain(Pga::Fsr4_096);
let sample = adc.sample().expect("the part answers");
assert!((sample.volts() - 3.0).abs() < 0.001);