2 unstable releases

Uses old Rust 2015

0.1.0 Jun 9, 2020
0.0.2 Mar 8, 2018

#189 in Hardware support

MIT/Apache

4KB
56 lines

ina219

Travis CI Status crates.io

INA219 current/power monitor driver for Rust

Example

extern crate ina219;
extern crate linux_embedded_hal as hal;

use hal::I2cdev;
use ina219::{INA219, INA219_ADDR};

fn main() {
    let device = I2cdev::new("/dev/i2c-1").unwrap();
    let mut ina = INA219::new(device, INA219_ADDR);

    ina.calibrate(0x0100).unwrap();

    let voltage = ina.voltage().unwrap();
    println!("bus voltage: {:?}", voltage);

    let shunt_voltage = ina.shunt_voltage().unwrap();
    println!("shunt voltage: {:?}", shunt_voltage);

    let current = ina.current().unwrap();
    println!("current: {:?}", current);

    let power = ina.power().unwrap();
    println!("power: {:?}", power);
}

Dependencies

~200KB