summaryrefslogtreecommitdiff
path: root/nrf-softdevice
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2021-05-10 00:24:24 +0200
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2021-05-10 00:24:24 +0200
commit8201255a9d6dde4b29a5a539a1d6aeefcbd467df (patch)
tree3366939a2c4b121091eb1abb3605f82e750b5c2f /nrf-softdevice
parent7e0bf163f35dca8a1daba11429035a7780f5f4b7 (diff)
downloadnrf-softdevice-8201255a9d6dde4b29a5a539a1d6aeefcbd467df.zip
Update embassy
Diffstat (limited to 'nrf-softdevice')
-rw-r--r--nrf-softdevice/src/flash.rs11
-rw-r--r--nrf-softdevice/src/lib.rs12
-rw-r--r--nrf-softdevice/src/softdevice.rs31
3 files changed, 10 insertions, 44 deletions
diff --git a/nrf-softdevice/src/flash.rs b/nrf-softdevice/src/flash.rs
index 4fd2db6..7ff40ad 100644
--- a/nrf-softdevice/src/flash.rs
+++ b/nrf-softdevice/src/flash.rs
@@ -1,6 +1,5 @@
use core::future::Future;
use core::marker::PhantomData;
-use core::pin::Pin;
use core::sync::atomic::{AtomicBool, Ordering};
use embassy::traits::flash::Error as FlashError;
@@ -54,11 +53,7 @@ impl embassy::traits::flash::Flash for Flash {
type WriteFuture<'a> = impl Future<Output = Result<(), FlashError>> + 'a;
type ErasePageFuture<'a> = impl Future<Output = Result<(), FlashError>> + 'a;
- fn read<'a>(
- self: Pin<&'a mut Self>,
- address: usize,
- data: &'a mut [u8],
- ) -> Self::ReadFuture<'a> {
+ fn read<'a>(&'a mut self, address: usize, data: &'a mut [u8]) -> Self::ReadFuture<'a> {
async move {
// Reading is simple since SoC flash is memory-mapped :)
// TODO check addr/len is in bounds.
@@ -71,7 +66,7 @@ impl embassy::traits::flash::Flash for Flash {
}
}
- fn write<'a>(self: Pin<&'a mut Self>, address: usize, data: &'a [u8]) -> Self::WriteFuture<'a> {
+ fn write<'a>(&'a mut self, address: usize, data: &'a [u8]) -> Self::WriteFuture<'a> {
async move {
let data_ptr = data.as_ptr();
let data_len = data.len() as u32;
@@ -102,7 +97,7 @@ impl embassy::traits::flash::Flash for Flash {
}
}
- fn erase<'a>(self: Pin<&'a mut Self>, address: usize) -> Self::ErasePageFuture<'a> {
+ fn erase<'a>(&'a mut self, address: usize) -> Self::ErasePageFuture<'a> {
async move {
if address % Self::PAGE_SIZE != 0 {
return Err(FlashError::AddressMisaligned);
diff --git a/nrf-softdevice/src/lib.rs b/nrf-softdevice/src/lib.rs
index ecb67f8..273a255 100644
--- a/nrf-softdevice/src/lib.rs
+++ b/nrf-softdevice/src/lib.rs
@@ -4,7 +4,7 @@
#![feature(type_alias_impl_trait)]
#![feature(min_type_alias_impl_trait)]
#![feature(impl_trait_in_bindings)]
-#![feature(const_fn)]
+#![feature(const_fn_trait_bound)]
#![feature(cell_update)]
#![allow(incomplete_features)]
@@ -109,15 +109,15 @@ compile_error!("The selected softdevice does not support ble-peripheral.");
compile_error!("The selected softdevice does not support ble-l2cap.");
#[cfg(feature = "nrf52810")]
-pub use nrf52810_pac as pac;
+use nrf52810_pac as pac;
#[cfg(feature = "nrf52811")]
-pub use nrf52811_pac as pac;
+use nrf52811_pac as pac;
#[cfg(feature = "nrf52832")]
-pub use nrf52832_pac as pac;
+use nrf52832_pac as pac;
#[cfg(feature = "nrf52833")]
-pub use nrf52833_pac as pac;
+use nrf52833_pac as pac;
#[cfg(feature = "nrf52840")]
-pub use nrf52840_pac as pac;
+use nrf52840_pac as pac;
#[cfg(feature = "s112")]
pub use nrf_softdevice_s112 as raw;
diff --git a/nrf-softdevice/src/softdevice.rs b/nrf-softdevice/src/softdevice.rs
index b4cc9fa..5f003e5 100644
--- a/nrf-softdevice/src/softdevice.rs
+++ b/nrf-softdevice/src/softdevice.rs
@@ -29,35 +29,6 @@ unsafe extern "C" fn fault_handler(id: u32, pc: u32, info: u32) {
}
}
-#[allow(non_snake_case)]
-pub struct Peripherals {
- pub AAR: pac::AAR,
- #[cfg(not(any(feature = "nrf52810", feature = "nrf52811", feature = "nrf52832")))]
- pub ACL: pac::ACL,
- #[cfg(any(feature = "nrf52810", feature = "nrf52811", feature = "nrf52832"))]
- pub BPROT: pac::BPROT,
- pub CCM: pac::CCM,
- pub CLOCK: pac::CLOCK,
- pub ECB: pac::ECB,
- pub EGU1: pac::EGU1,
- #[cfg(not(any(feature = "nrf52810", feature = "nrf52811")))]
- pub EGU2: pac::EGU2,
- #[cfg(not(any(feature = "nrf52810", feature = "nrf52811")))]
- pub EGU5: pac::EGU5,
- #[cfg(any(feature = "nrf52832", feature = "nrf52833", feature = "nrf52840"))]
- pub MWU: pac::MWU,
- pub NVMC: pac::NVMC,
- pub POWER: pac::POWER,
- pub RADIO: pac::RADIO,
- pub RNG: pac::RNG,
- pub RTC0: pac::RTC0,
- pub SWI1: pac::SWI1,
- pub SWI2: pac::SWI2,
- pub SWI5: pac::SWI5,
- pub TEMP: pac::TEMP,
- pub TIMER0: pac::TIMER0,
-}
-
/// Singleton instance of the enabled softdevice.
///
/// The `Softdevice` instance can be obtaind by enabling it with [`Softdevice::enable`]. Once
@@ -125,7 +96,7 @@ impl Softdevice {
/// - Panics if the requested configuration requires more memory than reserved for the softdevice. In that case, you can give more memory to the softdevice by editing the RAM start address in `memory.x`. The required start address is logged prior to panic.
/// - Panics if the requested configuration has too high memory requirements for the softdevice. The softdevice supports a maximum dynamic memory size of 64kb.
/// - Panics if called multiple times. Must be called at most once.
- pub fn enable(_peripherals: Peripherals, config: &Config) -> &'static Softdevice {
+ pub fn enable(config: &Config) -> &'static Softdevice {
if ENABLED
.compare_exchange(false, true, Ordering::AcqRel, Ordering::Acquire)
.is_err()