Compare commits

..

2 Commits

Author SHA1 Message Date
95143a44b9 removed unused constant 2026-02-10 12:58:57 +01:00
762932f2d6 renamed example to examples 2026-02-10 12:58:04 +01:00
8 changed files with 5 additions and 7 deletions

View File

@@ -39,20 +39,20 @@ async fn main(spawner: Spawner) {
let sda = p.PIN_4; let sda = p.PIN_4;
let scl = p.PIN_5; let scl = p.PIN_5;
let i2c = I2c::new_async(p.I2C0, scl, sda, Irqs, i2c::Config::default()); let i2c = I2c::new_blocking(p.I2C0, scl, sda, i2c::Config::default());
let mut device = MMC56X3::new(i2c, Delay); let mut device = MMC56X3::new(i2c, Delay);
if let Err(e) = device.init().await { if let Err(e) = device.init() {
error!("Failed to init {:?}", e); error!("Failed to init {:?}", e);
reboot().await; reboot().await;
}; };
if let Err(e) = device.set_data_rate(mmc56x3::DataRate::Max1000Hz).await { if let Err(e) = device.set_data_rate(mmc56x3::DataRate::Max1000Hz) {
error!("Failed to set data rate {:?}", e); error!("Failed to set data rate {:?}", e);
reboot().await; reboot().await;
} }
if let Err(e) = device.set_continuous_mode(true).await { if let Err(e) = device.set_continuous_mode(true) {
error!("Failed to set_continuous_mode {:?}", e); error!("Failed to set_continuous_mode {:?}", e);
reboot().await; reboot().await;
} }
@@ -67,7 +67,7 @@ async fn main(spawner: Spawner) {
// .await // .await
// .expect("Failed to trigger trigger_messurement"); // .expect("Failed to trigger trigger_messurement");
match device.read_messurement().await { match device.read_messurement() {
Ok(d) => info!("Got: {:?}", d), Ok(d) => info!("Got: {:?}", d),
Err(e) => error!("Error: {:?}", e), Err(e) => error!("Error: {:?}", e),
} }

View File

@@ -27,8 +27,6 @@ const REG_PRODUCT_ID: u8 = 0x39;
const DEFAULT_ADDRESS: u8 = 0x30; const DEFAULT_ADDRESS: u8 = 0x30;
const DEVICE_ID: u8 = 0x10;
bitflags! { bitflags! {
/// Flags for status_1 register /// Flags for status_1 register
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]