Skip to main content

Crate variegated_nau7802

Crate variegated_nau7802 

Source
Expand description

§NAU7802 Embassy Driver

Embassy-based driver for the Nuvoton NAU7802 24-bit precision ADC. This driver provides async support for I2C communication with the NAU7802, designed specifically for load cell and weight measurement applications.

The NAU7802 is a precision, 24-bit, analog-to-digital converter (ADC) with programmable gain amplifier (PGA), voltage reference, and calibration capabilities. It is particularly well-suited for bridge sensor applications like load cells.

§Usage Example

use variegated_nau7802::{Nau7802, Nau7802DataAvailableStrategy, Gain, SamplesPerSecond, Ldo};
 
// Create the driver with I2C bus and delay provider
let data_strategy = Nau7802DataAvailableStrategy::Polling;
let mut nau = Nau7802::new(i2c, data_strategy, delay, Some(0x2A)); // Default I2C address

// Initialize the device with high-level init function
nau.init(Ldo::L3v3, Gain::G128, SamplesPerSecond::SPS80).await?;

// Read weight measurement
nau.wait_for_data_available().await?;
let reading = nau.read().await?;
// Convert to weight using your calibration factor
let weight_grams = (reading as f32) * 0.001; // Example calibration
}

Based on amiraeva/nau7802-rs. See the datasheet in docs/datasheet.pdf for complete technical specifications.

Structs§

Nau7802
NAU7802 ADC driver with Embassy async support

Enums§

AfeCalibrationStatus
Status of analog front-end calibration
Ctrl2RegisterBits
Control register 2 bit positions
Error
Errors that can occur when communicating with the NAU7802
Gain
Programmable gain amplifier gain settings
Ldo
Low-dropout regulator voltage settings
Nau7802DataAvailableStrategy
Strategy for detecting when new ADC data is available
PgaPwrRegisterBits
PGA power register bit positions
PgaRegisterBits
PGA register bit positions
PuCtrlBits
Power-up control register bit positions
Register
NAU7802 register addresses
SamplesPerSecond
ADC sample rate settings

Traits§

RegisterBits
Trait for register bit manipulation

Type Aliases§

Result
Result type alias for NAU7802 operations