renamed example to examples
This commit is contained in:
@@ -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),
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user