Tmp117

Struct Tmp117 

Source
pub struct Tmp117<T, E> { /* private fields */ }
Expand description

The TMP117 driver. Note that the alert pin is not used in this driver, see the async implementation if you want the driver to use the alert pin in the drive

Implementations§

Source§

impl<T, E> Tmp117<T, E>
where T: I2c<SevenBitAddress, Error = E>, E: Error,

Source

pub fn new(i2c: T, addr: u8) -> Self

Create a new tmp117 from a i2c bus

Source

pub fn new_from_ll(tmp_ll: Tmp117LL<T, E>) -> Self

Create a new tmp117 from a low level tmp117 driver

Source

pub fn id(&mut self) -> Result<Id, Error<E>>

Returns the ID of the device

Source

pub fn reset<D>(&mut self, delay: &mut D) -> Result<(), Error<E>>
where D: DelayNs,

Resets the device and put it in shutdown

Source

pub fn write_eeprom(&mut self, values: [u16; 3]) -> Result<(), Error<E>>

Write data to user eeprom. Note that this is blocking because we wait for write on the eeprom to complete

Source

pub fn read_eeprom(&mut self) -> Result<[u16; 3], Error<E>>

Read the data from the eeprom

Source

pub fn oneshot(&mut self, average: Average) -> Result<f32, Error<E>>

Wait for data and read the temperature in celsius and shutdown since it’s a oneshot

Source

pub fn continuous<F>( &mut self, config: ContinuousConfig, f: F, ) -> Result<(), Error<E>>
where F: FnOnce(ContinuousHandler<'_, T, E>) -> Result<(), Error<E>>,

Pass a config and closure for the continuous mode. The device gets set to continuous, then the function is called with the handler and finally the device is shutdown

Auto Trait Implementations§

§

impl<T, E> Freeze for Tmp117<T, E>
where T: Freeze,

§

impl<T, E> RefUnwindSafe for Tmp117<T, E>

§

impl<T, E> Send for Tmp117<T, E>
where T: Send, E: Send,

§

impl<T, E> Sync for Tmp117<T, E>
where T: Sync, E: Sync,

§

impl<T, E> Unpin for Tmp117<T, E>
where T: Unpin, E: Unpin,

§

impl<T, E> UnwindSafe for Tmp117<T, E>
where T: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.