Skip to content

Commit

Permalink
update offset calibration
Browse files Browse the repository at this point in the history
  • Loading branch information
hacknus committed Nov 27, 2023
1 parent 19d47a6 commit da1ea76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ impl<BUS, E> ADS122x04<BUS>
/// This is recommended upon startup and after changing the gain.
pub fn calibrate_offset(&mut self) -> Result<(), Error<E>> {
const NUM_AVG: usize = 10;
let timeout = 100;
let timeout = 1000;
// short the inputs to mid-supply (AVDD + AVSS) / 2
let previous_mux = self.mux;
self.set_input_mux(Mux::Shorted)?;
self.set_data_rate(DataRate::Sps40Turbo)?;
self.set_conversion_mode(ConversionMode::SingleShot)?;
// reset offset
self.offset = 0;
Expand Down

0 comments on commit da1ea76

Please sign in to comment.