Struct MCP3204Async

Source
pub struct MCP3204Async<I> { /* private fields */ }
Expand description

The MCP3204 is a 12-bit ADC with on-board sample and hold circuitry. It is programmable to provide two pseudo-differential input pairs or four single-ended inputs.

For a full description and usage examples, refer to the module documentation.

Implementations§

Source§

impl<I> MCP3204Async<I>
where I: SpiDevice,

Source

pub fn new_spi(interface: I, reference_voltage: ElectricPotential) -> Self

Initializes a new device from the specified SPI device. This consumes the SPI device I.

The device supports SPI modes 0 and 3.

Source§

impl<I: SpiDevice> MCP3204Async<I>

Source

pub async fn convert_raw( &mut self, channel: InputChannel, ) -> Result<u16, I::Error>

Performs a conversion of the given channel and returns the raw value

Source

pub async fn convert( &mut self, channel: InputChannel, ) -> Result<ElectricPotential, I::Error>

Performs a conversion of the given channel and returns the value in volts

Auto Trait Implementations§

§

impl<I> Freeze for MCP3204Async<I>
where I: Freeze,

§

impl<I> !RefUnwindSafe for MCP3204Async<I>

§

impl<I> Send for MCP3204Async<I>
where I: Send,

§

impl<I> Sync for MCP3204Async<I>
where I: Sync,

§

impl<I> Unpin for MCP3204Async<I>
where I: Unpin,

§

impl<I> !UnwindSafe for MCP3204Async<I>

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> Same for T

Source§

type Output = T

Should always be Self
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.