#i2c #driver #current #no-std

no-std ina219

INA219 电流/功率监控驱动程序

2个不稳定版本

使用旧Rust 2015

0.1.0 2020年6月9日
0.0.2 2018年3月8日

#1609硬件支持

Download history 24/week @ 2024-03-28 12/week @ 2024-04-04 6/week @ 2024-05-02 49/week @ 2024-05-09 32/week @ 2024-05-16 83/week @ 2024-05-23 101/week @ 2024-05-30

2,077 每月下载量

MIT/Apache

5KB
56

ina219

Travis CI Status crates.io

INA219 的Rust电流/功率监控驱动程序

示例

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);
}

依赖关系

~190KB