You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci: add cargo-llvm-cov HTML report deployment to GitHub Pages
- Add workflow to run cargo-llvm-cov and generate HTML report
- Parse coverage percentage into JSON endpoint for Shields.io badge
- Deploy coverage artifacts natively to GitHub Pages
A platform-agnostic `#![no_std]` Rust driver for the Texas Instruments "INA23x (INA238 & INA239)" 85V, 16-Bit High-Precision Power/Current/Voltage Monitor using `embedded-hal`.
use embedded_hal::i2c::I2c;use ina23x::{Ina238,Address,AdcRange, ....};// Create driver instance with default I2C address (0x40)letmut sensor = Ina238::new(i2c,0x40);// Configure shunt calibration (e.g., for 2A max current & 10 mΩ shunt)
sensor.calibrate(2.0,0.1).unwrap();// Read bus voltage in VoltsifletOk(bus_voltage) = sensor.bus_voltage(){// Process bus voltage...}// Read current in AmperesifletOk(current) = sensor.current(){// Process current...}
INA239 (SPI) Example
use embedded_hal::spi::SpiDevice;use ina23x::{Ina239,AdcRange};// Create driver instance (SPI does not require an I2C slave address)letmut sensor = Ina239::new(spi,0.0001,0.01,AdcRange::Range40mV);// Read bus voltage in VoltsifletOk(bus_voltage) = sensor.bus_voltage(){// Process bus voltage...}// Read current in AmperesifletOk(current) = sensor.current(){// Process current...}
Status & Alert Config:diag_flags(), set_alert_config()
Device Identification & Maintenance API
manufacture_id(), device_id(), reset()
Testing
This crate includes a unit test suite covering register reads, writes, and bitwise operations using embedded-hal-mock. Run the tests on your host platform with:
cargo test
Supported devices
INA238, I²C 85-V, 16-Bit, High-Precision Power Monitor
INA239, SPI 85-V, 16-Bit, High-Precision Power Monitor
0 commit comments