diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2021-05-19 13:10:36 +0200 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2021-05-19 13:10:36 +0200 |
commit | a18014a20878bdb8bf43fe196be8fa38ca0c1fd0 (patch) | |
tree | 6543dd85664e29cc4cefed4a35e43e0a9ef5d65d | |
parent | 8201255a9d6dde4b29a5a539a1d6aeefcbd467df (diff) | |
download | nrf-softdevice-a18014a20878bdb8bf43fe196be8fa38ca0c1fd0.zip |
Update embassy
-rw-r--r-- | Cargo.lock | 73 | ||||
-rw-r--r-- | examples/Cargo.toml | 2 | ||||
-rw-r--r-- | examples/src/bin/ble_l2cap_central.rs | 1 | ||||
-rw-r--r-- | examples/src/bin/ble_peripheral_onoff.rs | 23 | ||||
-rw-r--r-- | nrf-softdevice/src/lib.rs | 2 | ||||
-rw-r--r-- | rust-toolchain | 1 | ||||
-rw-r--r-- | rust-toolchain.toml | 6 |
7 files changed, 65 insertions, 43 deletions
@@ -62,6 +62,12 @@ dependencies = [ ] [[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] name = "az" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -89,6 +95,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" [[package]] +name = "bytemuck" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bed57e2090563b83ba8f83366628ce535a7584c9afa4c9fc0612a03925c6df58" + +[[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -167,6 +179,17 @@ dependencies = [ ] [[package]] +name = "critical-section" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c1ce814a497d4fbc869a34a0da005fbd712d7034e4a48ee91e7f3c795a8b17" +dependencies = [ + "bare-metal 1.0.0", + "cfg-if", + "cortex-m 0.7.2", +] + +[[package]] name = "darling" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -243,11 +266,12 @@ dependencies = [ [[package]] name = "embassy" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy#632572d1cb29ab6badb87c74a95c120b4238f7c6" +source = "git+https://github.com/embassy-rs/embassy#211fdb6e84462a84a79dc758301839659ef4a7c3" dependencies = [ "atomic-polyfill", "cast", "cortex-m 0.7.2", + "critical-section 0.2.1", "defmt", "embassy-macros", "embassy-traits", @@ -258,7 +282,7 @@ dependencies = [ [[package]] name = "embassy-extras" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy#632572d1cb29ab6badb87c74a95c120b4238f7c6" +source = "git+https://github.com/embassy-rs/embassy#211fdb6e84462a84a79dc758301839659ef4a7c3" dependencies = [ "cortex-m 0.7.2", "embassy", @@ -268,7 +292,7 @@ dependencies = [ [[package]] name = "embassy-macros" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy#632572d1cb29ab6badb87c74a95c120b4238f7c6" +source = "git+https://github.com/embassy-rs/embassy#211fdb6e84462a84a79dc758301839659ef4a7c3" dependencies = [ "darling", "proc-macro2", @@ -279,10 +303,11 @@ dependencies = [ [[package]] name = "embassy-nrf" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy#632572d1cb29ab6badb87c74a95c120b4238f7c6" +source = "git+https://github.com/embassy-rs/embassy#211fdb6e84462a84a79dc758301839659ef4a7c3" dependencies = [ "cortex-m 0.7.2", "cortex-m-rt", + "critical-section 0.2.1", "defmt", "embassy", "embassy-extras", @@ -296,7 +321,7 @@ dependencies = [ [[package]] name = "embassy-traits" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy#632572d1cb29ab6badb87c74a95c120b4238f7c6" +source = "git+https://github.com/embassy-rs/embassy#211fdb6e84462a84a79dc758301839659ef4a7c3" dependencies = [ "defmt", "embedded-hal", @@ -323,11 +348,12 @@ dependencies = [ [[package]] name = "fixed" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "699e185585f30812375dab120221f3451b063aeff29dadf6fd3a3ac2e30c8486" +checksum = "c97cabfe1ce0db024d64e9f688469e80a8e2b36cb792b09ba33e1ee8d21d00ae" dependencies = [ "az", + "bytemuck", "half", "typenum", ] @@ -340,9 +366,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "futures" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d5813545e459ad3ca1bff9915e9ad7f1a47dc6a91b627ce321d5863b7dd253" +checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" dependencies = [ "futures-channel", "futures-core", @@ -354,9 +380,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce79c6a52a299137a6013061e0cf0e688fce5d7f1bc60125f520912fdb29ec25" +checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" dependencies = [ "futures-core", "futures-sink", @@ -364,34 +390,35 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "098cd1c6dda6ca01650f1a37a794245eb73181d0d4d4e955e2f3c37db7af1815" +checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" [[package]] name = "futures-io" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "365a1a1fb30ea1c03a830fdb2158f5236833ac81fa0ad12fe35b29cddc35cb04" +checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" [[package]] name = "futures-sink" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5629433c555de3d82861a7a4e3794a4c40040390907cfbfd7143a92a426c23" +checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" [[package]] name = "futures-task" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba7aa51095076f3ba6d9a1f702f74bd05ec65f555d70d2033d55ba8d69f581bc" +checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" [[package]] name = "futures-util" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c144ad54d60f23927f0a6b6d816e4271278b64f005ad65e4e35291d2de9c025" +checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" dependencies = [ + "autocfg", "futures-core", "futures-sink", "futures-task", @@ -508,7 +535,7 @@ version = "0.1.0" dependencies = [ "cortex-m 0.6.7", "cortex-m-rt", - "critical-section", + "critical-section 0.1.0", "defmt", "embassy", "fixed", @@ -533,7 +560,7 @@ name = "nrf-softdevice-defmt-rtt" version = "0.1.0" dependencies = [ "cortex-m 0.6.7", - "critical-section", + "critical-section 0.1.0", "defmt", "nrf-softdevice", ] diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 6b54d8a..0b87825 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -25,7 +25,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" ]} +embassy-nrf = { version = "0.1.0", features = [ "defmt", "nrf52840" ]} cortex-m = { version = "0.6.4" } cortex-m-rt = "0.6.13" defmt = { version = "0.2.0", features = ["alloc"] } diff --git a/examples/src/bin/ble_l2cap_central.rs b/examples/src/bin/ble_l2cap_central.rs index 1bb4e3f..e710e9b 100644 --- a/examples/src/bin/ble_l2cap_central.rs +++ b/examples/src/bin/ble_l2cap_central.rs @@ -9,7 +9,6 @@ extern crate alloc; #[path = "../example_common.rs"] mod example_common; -use example_common::*; use core::mem; use core::ptr::NonNull; diff --git a/examples/src/bin/ble_peripheral_onoff.rs b/examples/src/bin/ble_peripheral_onoff.rs index 8e53c15..1caf4f6 100644 --- a/examples/src/bin/ble_peripheral_onoff.rs +++ b/examples/src/bin/ble_peripheral_onoff.rs @@ -11,13 +11,12 @@ mod example_common; use core::mem; use cortex_m_rt::entry; -use defmt::{panic, *}; +use defmt::*; use embassy::executor::Executor; use embassy::traits::gpio::WaitForLow; use embassy::util::Forever; use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; -use embassy_nrf::gpiote::{self, PortInput}; -use embassy_nrf::interrupt; +use embassy_nrf::gpiote::PortInput; use futures::pin_mut; use nrf_softdevice::ble::{gatt_server, peripheral}; @@ -77,19 +76,14 @@ async fn run_bluetooth(sd: &'static Softdevice, server: &FooService) { } #[embassy::task] -async fn bluetooth_task( - sd: &'static Softdevice, - gpiote: gpiote::Initialized, - button1: AnyPin, - button2: AnyPin, -) { +async fn bluetooth_task(sd: &'static Softdevice, button1: AnyPin, button2: AnyPin) { let server: FooService = unwrap!(gatt_server::register(sd)); info!("Bluetooth is OFF"); info!("Press nrf52840-dk button 1 to enable, button 2 to disable"); - let button1 = PortInput::new(gpiote, Input::new(button1, Pull::Up)); - let button2 = PortInput::new(gpiote, Input::new(button2, Pull::Up)); + let button1 = PortInput::new(Input::new(button1, Pull::Up)); + let button2 = PortInput::new(Input::new(button2, Pull::Up)); pin_mut!(button1); pin_mut!(button2); loop { @@ -131,6 +125,8 @@ async fn bluetooth_task( fn main() -> ! { info!("Hello World!"); + let p = embassy_nrf::init(embassy_nrf::config::Config::default()); + let config = nrf_softdevice::Config { clock: Some(raw::nrf_clock_lf_cfg_t { source: raw::NRF_CLOCK_LF_SRC_XTAL as u8, @@ -169,10 +165,7 @@ fn main() -> ! { let executor = EXECUTOR.put(Executor::new()); executor.run(|spawner| { - let p = embassy_nrf::Peripherals::take().unwrap(); - let g = gpiote::initialize(p.GPIOTE, interrupt::take!(GPIOTE)); - unwrap!(spawner.spawn(softdevice_task(sd))); - unwrap!(spawner.spawn(bluetooth_task(sd, g, p.P0_11.degrade(), p.P0_12.degrade()))); + unwrap!(spawner.spawn(bluetooth_task(sd, p.P0_11.degrade(), p.P0_12.degrade()))); }); } diff --git a/nrf-softdevice/src/lib.rs b/nrf-softdevice/src/lib.rs index 273a255..e515064 100644 --- a/nrf-softdevice/src/lib.rs +++ b/nrf-softdevice/src/lib.rs @@ -146,8 +146,6 @@ pub mod ble; mod softdevice; pub use softdevice::*; -pub use cortex_m_rt::interrupt; - mod temperature; pub use temperature::temperature_celsius; diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index 07ade69..0000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -nightly
\ No newline at end of file diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..de7fe6a --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,6 @@ +# Before upgrading check that everything is available on all tier1 targets here: +# https://rust-lang.github.io/rustup-components-history +[toolchain] +channel = "nightly-2021-05-07" +components = [ "rust-src", "rustfmt" ] +targets = [ "thumbv7em-none-eabihf" ] |