Skip to content
Snippets Groups Projects

Add firmware version consistency check in Rust API

Merged Samuel Tardieu requested to merge rust-firmware-consistency into main
use color_eyre::eyre::Context;
use std::time::{Duration, Instant};
use tele0592::{Controller as _, Device as _};
use tele0592::Controller as _;
fn main() -> color_eyre::Result<()> {
color_eyre::install()?;
let mut controller = rppal::i2c::I2c::with_bus(8).with_context(|| "opening I²C bus")?;
println!("Firmware version: {:?}", controller.firmware_version()?);
println!(
"Firmware version: {:?}",
controller.check_firmware_version()?
);
controller.set_motor_shutdown_timeout(Duration::from_secs(3))?;
let timeout = controller.get_motor_shutdown_timeout()?;
println!("Motor shutdown timeout set to {timeout:?}");
Loading