Expand description
This crate provides an async Rust driver for the MCP342[2/3/4] ADC, based on the
embedded-hal
traits.
§Modes
Mode | Description |
---|---|
OneShot | Instructs the device to do a single conversion and awaits the result. |
Continuous | Instructs the device to do conversions continuously. Every subsequent call will read the last available value only. |
MultiShot | A variation of the OneShotMode . The measure functions execute a series of one-shot conversions and return all values at once. |
§MCP3422 and MCP3423
In contrast to the MCP3424, the MCP3422 and MCP3423 provide only two channels instead of four.
But these device offer the same I2C interface. Therefor this crate can also be used for MCP3422
and MCP3423 devices with the exception that these devices treat Channel::Channel3
as
Channel::Channel1
and Channel::Channel4
as Channel::Channel2
.
§Crate Features
Enable or disable features according to your needs and in order to optimize for compile time and space.
Feature | Default | Description |
---|---|---|
defmt | ✗ | When enabled, certain types will provide an implementation for the defmt::Format trait. |
fmt | ✔ | When enabled, certain types will provide an implementation for core::fmt::Debug and core::fmt::Display traits. |
stream | ✗ | When enabled, the driver offers additional measure functions which return a futures::stream::Stream . |
uom | ✗ | When enabled, all measure functions return the measured value as uom::si::f32::ElectricPotential instead of a plain f32 . |
✔ enabled, ✗ disabled
§UOM
This driver integrates with the uom crate which provides units of
measurement. After activating the corresponding uom
feature all measure functions return the
measured value as uom::si::f32::ElectricPotential
instead of a plain f32
.
Modules§
- doc
- This module delivers supplementary documentation.
Structs§
- Configuration
- Mode independent user configuration.
- Continuous
Mode - A mode where the device continuously converts data.
- MCP3424
- Driver for the MCP342[2/3/4].
- Multi
Shot Mode - A mode which triggers a sequence of one-shot conversions.
- OneShot
Mode - A mode where the device executes a single conversion.
Enums§
- Channel
- Configuration parameter to select the device’s channel.
- Conversion
Time - Configuration parameter to adjust the driver’s assumed conversion time.
- Error
- Error type used by the driver.
- Gain
- Configuration parameter to set the value for the programmable gain amplifier (PGA).
- Resolution
- Configuration parameter to set the resolution used to convert an analogue value.