Initial commit

Signed-off-by: Thomas Klaehn <thomas.klaehn@perinet.io>
This commit is contained in:
Thomas Klaehn
2025-01-14 14:42:18 +01:00
commit bf5ee0ec78
7 changed files with 245 additions and 0 deletions

10
examples/current.rs Normal file
View File

@@ -0,0 +1,10 @@
use ina3221;
fn main() {
let mut ina = ina3221::Ina3221::new(0x40);
let res = match ina.current(ina3221::Channel::One) {
Ok(value) => value,
Err(error) => panic!("Can't read i2c: {error:?}"),
};
println!("Channel one current: {:?} mA", res);
}

10
examples/voltage.rs Normal file
View File

@@ -0,0 +1,10 @@
use ina3221;
fn main() {
let mut ina = ina3221::Ina3221::new(0x40);
let res = match ina.bus_voltage(ina3221::Channel::One) {
Ok(value) => value,
Err(error) => panic!("Can't read i2c: {error:?}"),
};
println!("Channel one bus voltage: {:?} V.", res);
}