Struct mcp3425::MCP3425 [] [src]

pub struct MCP3425<I2C, D, M> { /* fields omitted */ }

Driver for the MCP3425 ADC

Methods

impl<I2C, D, E, M> MCP3425<I2C, D, M> where
    I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>,
    D: DelayMs<u8>,
    M: ConversionMode
[src]

[src]

Initialize the MCP3425 driver.

This constructor is side-effect free, so it will not write any configuration to the device until a first measurement is triggered.

impl<I2C, D, E> MCP3425<I2C, D, OneShotMode> where
    I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>,
    D: DelayMs<u8>, 
[src]

[src]

Initialize the MCP3425 driver in One-Shot mode.

This constructor is side-effect free, so it will not write any configuration to the device until a first measurement is triggered.

[src]

Change the conversion mode to continuous.

This conversion is side-effect free, so it will not write any configuration to the device until set_config is called.

[src]

Do a one-shot voltage measurement.

Return the result in millivolts.

impl<I2C, D, E> MCP3425<I2C, D, ContinuousMode> where
    I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>,
    D: DelayMs<u8>, 
[src]

[src]

Initialize the MCP3425 driver in Continuous Measurement mode.

This constructor is side-effect free, so it will not write any configuration to the device until a first measurement is triggered.

[src]

Change the conversion mode to one-shot.

This conversion is side-effect free, so it will not write any configuration to the device until a first one-shot measurement is triggered.

[src]

Write the specified configuration to the device and block until the first measurement is ready.

The wait-for-measurement logic is implemented with polling, since there are no non-blocking embedded_hal traits yet.

Note: Since the wait-until-ready logic needs to read the data register, when reading the measurement immediately after setting the configuration, that measurement will be returned as NotFresh.

[src]

Read a measurement from the device.

Note that the set_config method MUST have been called before, otherwise Error::NotInitialized will be returned.

If you poll faster than the sample rate, Error::NotReady will be returned.

Trait Implementations

impl<I2C: Debug, D: Debug, M: Debug> Debug for MCP3425<I2C, D, M>
[src]

[src]

Formats the value using the given formatter. Read more

impl<I2C: Default, D: Default, M: Default> Default for MCP3425<I2C, D, M>
[src]

[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl<I2C, D, M> Send for MCP3425<I2C, D, M> where
    D: Send,
    I2C: Send,
    M: Send

impl<I2C, D, M> Sync for MCP3425<I2C, D, M> where
    D: Sync,
    I2C: Sync,
    M: Sync