Expand description
§SupMCU
The SupMCUModule and SupMCUMaster structs allow easy interactions with SupMCU modules over I2C by encapsulating functionality like sending commands, requesting and reading telemetry, discovering modules on an I2C bus, and loading definition files.
§Examples
Discovering modules on an I2C bus
use supmcu_rs::supmcu::SupMCUMaster;
use std::time::Duration;
let mut master = SupMCUMaster::new("/dev/i2c-1", None)?;
master.discover_modules()?;
print!("Modules:");
for module in master.modules.iter() {
print!(" {}", module.get_definition()?.name);
}
println!();
Loading a definition file
use supmcu_rs::supmcu::SupMCUMaster;
use std::{
time::Duration,
path::Path
};
let mut master = SupMCUMaster::new("/dev/i2c-1", None)?;
master.load_def_file(Path::new("definition.json"))?;
Modules§
- parsing
- Data structures and associated functions to parse data received from modules
Structs§
- SupMCU
Master - A struct to represent an I2C bus of SupMCU modules
- SupMCU
Module - A struct to represent/interact with a SupMCU Module connected to via I2C