pub struct TempSensor<'d> { /* private fields */ }Expand description
Temperature sensor driver.
Implementations§
Source§impl<'d> TempSensor<'d>
impl<'d> TempSensor<'d>
Sourcepub fn set_mode(&mut self, mode: u8)
pub fn set_mode(&mut self, mode: u8)
Set the operating mode.
mode— Mode value (0-3). The exact meaning depends on the chip configuration.
Sourcepub fn start_conversion(&mut self)
pub fn start_conversion(&mut self)
Trigger a single temperature reading (software start).
Writes 1 to the start register to refresh the temperature value.
Sourcepub fn data_ready(&self) -> bool
pub fn data_ready(&self) -> bool
Check if a temperature reading is ready.
Sourcepub fn read_raw(&self) -> Option<u16>
pub fn read_raw(&self) -> Option<u16>
Read the raw temperature code (10-bit, range 114-896).
Returns None if data is not ready.
Sourcepub fn read_blocking(&self) -> u16
pub fn read_blocking(&self) -> u16
Read the temperature code, blocking until ready.
Sourcepub fn clear_status(&mut self)
pub fn clear_status(&mut self)
Clear the temperature sensor status.
Sourcepub fn set_high_limit(&mut self, code: u16)
pub fn set_high_limit(&mut self, code: u16)
Set the high temperature limit.
Interrupt triggers when temperature code exceeds this value.
Sourcepub fn set_low_limit(&mut self, code: u16)
pub fn set_low_limit(&mut self, code: u16)
Set the low temperature limit.
Interrupt triggers when temperature code falls below this value.
Sourcepub fn set_over_temp_threshold(&mut self, code: u16, enable_interrupt: bool)
pub fn set_over_temp_threshold(&mut self, code: u16, enable_interrupt: bool)
Set the over-temperature threshold.
Sourcepub fn enable_interrupts(
&mut self,
done_int: bool,
out_thresh_int: bool,
overtemp_int: bool,
)
pub fn enable_interrupts( &mut self, done_int: bool, out_thresh_int: bool, overtemp_int: bool, )
Enable specific temperature interrupts.
done_int— Conversion done interruptout_thresh_int— Out-of-threshold interruptovertemp_int— Over-temperature interrupt
Sourcepub fn disable_all_interrupts(&mut self)
pub fn disable_all_interrupts(&mut self)
Disable all temperature interrupts.
Sourcepub fn interrupt_status(&self) -> (bool, bool, bool)
pub fn interrupt_status(&self) -> (bool, bool, bool)
Check interrupt status.
Returns (done, out_thresh, overtemp).
Sourcepub fn clear_interrupts(&mut self, done: bool, out_thresh: bool, overtemp: bool)
pub fn clear_interrupts(&mut self, done: bool, out_thresh: bool, overtemp: bool)
Clear specific temperature interrupts.
Sourcepub fn configure_auto_refresh(&mut self, period: u16, enable: bool)
pub fn configure_auto_refresh(&mut self, period: u16, enable: bool)
Configure automatic temperature refresh.
period— Refresh period in 32kHz clock cycles.enable— Enable auto refresh.
Sourcepub fn enable_calibration(&mut self)
pub fn enable_calibration(&mut self)
Enable temperature calibration.
Sourcepub fn disable_calibration(&mut self)
pub fn disable_calibration(&mut self)
Disable temperature calibration.