summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2021-03-02 21:10:45 +0100
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2021-03-02 21:17:51 +0100
commit49788c53640e363d44ad1e78b1abec0961a606ab (patch)
tree22241f58c224993e209c539f8b0a14ebfee35a85 /examples
parent9204516365eed2e72013bfbd970f65b3a51508f1 (diff)
downloadnrf-softdevice-49788c53640e363d44ad1e78b1abec0961a606ab.zip
Update embassy
Diffstat (limited to 'examples')
-rw-r--r--examples/Cargo.toml1
-rw-r--r--examples/src/bin/ble_peripheral_onoff.rs2
-rw-r--r--examples/src/bin/flash.rs8
3 files changed, 7 insertions, 4 deletions
diff --git a/examples/Cargo.toml b/examples/Cargo.toml
index b5b5bfa..09449c6 100644
--- a/examples/Cargo.toml
+++ b/examples/Cargo.toml
@@ -24,6 +24,7 @@ ble-gatt-client = ["nrf-softdevice/ble-gatt-client"]
[dependencies]
embassy = { version = "0.1.0", features = ["defmt"]}
+embassy-traits = { version = "0.1.0", features = ["defmt"]}
embassy-nrf = { version = "0.1.0", features = [ "defmt", "52840" ]}
cortex-m = { version = "0.6.4" }
cortex-m-rt = "0.6.13"
diff --git a/examples/src/bin/ble_peripheral_onoff.rs b/examples/src/bin/ble_peripheral_onoff.rs
index d516991..9b65597 100644
--- a/examples/src/bin/ble_peripheral_onoff.rs
+++ b/examples/src/bin/ble_peripheral_onoff.rs
@@ -11,7 +11,7 @@ use core::mem;
use cortex_m_rt::entry;
use defmt::{panic, *};
use embassy::executor::{task, Executor};
-use embassy::gpio::WaitForLow;
+use embassy::traits::gpio::WaitForLow;
use embassy::util::Forever;
use embassy_nrf::gpiote::{Gpiote, GpiotePin};
use embassy_nrf::interrupt;
diff --git a/examples/src/bin/flash.rs b/examples/src/bin/flash.rs
index 84a71ab..e8407cd 100644
--- a/examples/src/bin/flash.rs
+++ b/examples/src/bin/flash.rs
@@ -10,9 +10,10 @@ use example_common::*;
use cortex_m_rt::entry;
use defmt::*;
use embassy::executor::{task, Executor};
-use embassy::flash::Flash as _;
+use embassy::traits::flash::Flash as _;
use embassy::util::Forever;
+use futures::pin_mut;
use nrf_softdevice::{Flash, Softdevice};
static EXECUTOR: Forever<Executor> = Forever::new();
@@ -25,13 +26,14 @@ async fn softdevice_task(sd: &'static Softdevice) {
#[task]
async fn flash_task(sd: &'static Softdevice) {
let mut f = Flash::take(sd);
+ pin_mut!(f);
info!("starting erase");
- unwrap!(f.erase(0x80000).await);
+ unwrap!(f.as_mut().erase(0x80000).await);
info!("erased!");
info!("starting write");
- unwrap!(f.write(0x80000, &[1, 2, 3, 4]).await);
+ unwrap!(f.as_mut().write(0x80000, &[1, 2, 3, 4]).await);
info!("write done!");
}