A platform-agnostic #![no_std] Rust driver for the Texas Instruments INA238 85V, 16-Bit High-Precision Power/Current/Voltage Monitor using embedded-hal.
#![no_std]Support: Suitable for bare-metal microcontrollers (STM32, RP2040, ESP32, nRF, etc.).embedded-halIntegration: Works with any I2C peripheral implementingembedded-hal1.0 traits.- Measurements: Read Bus Voltage, Shunt Voltage, Current, Power, and Temperature.
- Configurable: Set custom conversion times, averaging options, and calibration settings.
Add ina238 to your Cargo.toml:
[dependencies]
ina238 = "0.1.0"use embedded_hal::i2c::I2c;
use ina238::Ina238;
// Initialize your hardware I2C peripheral (platform-specific)
// let i2c = ...;
// Create driver instance (default I2C address is 0x40)
let mut sensor = Ina238::new(i2c, 0x40);
// Read bus voltage (in mV)
if let Ok(voltage) = sensor.read_bus_voltage() {
// voltage in mV
}