diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-02-16 03:54:39 +0100 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-03-11 00:38:07 +0100 |
commit | 9bad9365dcf31dd558aca05f60d244beb9e5e697 (patch) | |
tree | 3d54927ce409975c58dff4409b8a140a4b68abd1 /embassy-lora | |
parent | 828cdb295183b8733ec636a80e0d35e6f8e41827 (diff) | |
download | embassy-9bad9365dcf31dd558aca05f60d244beb9e5e697.zip |
Update rust nightly, embedded-hal 1.0, embedded-hal-async.
Diffstat (limited to 'embassy-lora')
-rw-r--r-- | embassy-lora/Cargo.toml | 4 | ||||
-rw-r--r-- | embassy-lora/src/stm32wl/mod.rs | 2 | ||||
-rw-r--r-- | embassy-lora/src/sx127x/mod.rs | 18 | ||||
-rw-r--r-- | embassy-lora/src/sx127x/sx127x_lora/mod.rs | 4 |
4 files changed, 13 insertions, 15 deletions
diff --git a/embassy-lora/Cargo.toml b/embassy-lora/Cargo.toml index c2764152..dfd26254 100644 --- a/embassy-lora/Cargo.toml +++ b/embassy-lora/Cargo.toml @@ -18,8 +18,8 @@ log = { version = "0.4.14", optional = true } embassy = { version = "0.1.0", path = "../embassy", default-features = false } embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true } -embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.6", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy", optional = true} -embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy"} +embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.7", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy2", optional = true} +embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy2"} embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common", default-features = false } futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] } embedded-hal = { version = "0.2", features = ["unproven"] } diff --git a/embassy-lora/src/stm32wl/mod.rs b/embassy-lora/src/stm32wl/mod.rs index 783140cb..7dc750cf 100644 --- a/embassy-lora/src/stm32wl/mod.rs +++ b/embassy-lora/src/stm32wl/mod.rs @@ -78,7 +78,7 @@ impl<'a> SubGhzRadio<'a> { // This is safe because we only get interrupts when configured for, so // the radio will be awaiting on the signal at this point. If not, the ISR will // anyway only adjust the state in the IRQ signal state. - let state = unsafe { &mut *(p as *mut StateInner<'a>) }; + let state = &mut *(p as *mut StateInner<'a>); state.on_interrupt(); }); irq.set_handler_context(state_ptr as *mut ()); diff --git a/embassy-lora/src/sx127x/mod.rs b/embassy-lora/src/sx127x/mod.rs index 6a15dab8..c70f3358 100644 --- a/embassy-lora/src/sx127x/mod.rs +++ b/embassy-lora/src/sx127x/mod.rs @@ -20,7 +20,7 @@ pub trait RadioSwitch { /// Semtech Sx127x radio peripheral pub struct Sx127xRadio<SPI, CS, RESET, E, I, RFS> where - SPI: ReadWrite<u8, Error = E> + 'static, + SPI: SpiBus<u8, Error = E> + 'static, E: 'static, CS: OutputPin + 'static, RESET: OutputPin + 'static, @@ -42,7 +42,7 @@ pub enum State { impl<SPI, CS, RESET, E, I, RFS> Sx127xRadio<SPI, CS, RESET, E, I, RFS> where - SPI: ReadWrite<u8, Error = E> + 'static, + SPI: SpiBus<u8, Error = E> + 'static, CS: OutputPin + 'static, RESET: OutputPin + 'static, I: Wait + 'static, @@ -64,7 +64,7 @@ where impl<SPI, CS, RESET, E, I, RFS> Timings for Sx127xRadio<SPI, CS, RESET, E, I, RFS> where - SPI: ReadWrite<u8, Error = E> + 'static, + SPI: SpiBus<u8, Error = E> + 'static, CS: OutputPin + 'static, RESET: OutputPin + 'static, I: Wait + 'static, @@ -80,7 +80,7 @@ where impl<SPI, CS, RESET, E, I, RFS> PhyRxTx for Sx127xRadio<SPI, CS, RESET, E, I, RFS> where - SPI: ReadWrite<u8, Error = E> + 'static, + SPI: SpiBus<u8, Error = E> + 'static, CS: OutputPin + 'static, E: 'static, RESET: OutputPin + 'static, @@ -89,15 +89,14 @@ where { type PhyError = Sx127xError; - type TxFuture<'m> + type TxFuture<'m> = impl Future<Output = Result<u32, Self::PhyError>> + 'm where SPI: 'm, CS: 'm, RESET: 'm, E: 'm, I: 'm, - RFS: 'm, - = impl Future<Output = Result<u32, Self::PhyError>> + 'm; + RFS: 'm; fn tx<'m>(&'m mut self, config: TxConfig, buf: &'m [u8]) -> Self::TxFuture<'m> { trace!("TX START"); @@ -137,15 +136,14 @@ where } } - type RxFuture<'m> + type RxFuture<'m> = impl Future<Output = Result<(usize, RxQuality), Self::PhyError>> + 'm where SPI: 'm, CS: 'm, RESET: 'm, E: 'm, I: 'm, - RFS: 'm, - = impl Future<Output = Result<(usize, RxQuality), Self::PhyError>> + 'm; + RFS: 'm; fn rx<'m>(&'m mut self, config: RfConfig, buf: &'m mut [u8]) -> Self::RxFuture<'m> { trace!("RX START"); diff --git a/embassy-lora/src/sx127x/sx127x_lora/mod.rs b/embassy-lora/src/sx127x/sx127x_lora/mod.rs index 6fbd3a4b..62eaf0a9 100644 --- a/embassy-lora/src/sx127x/sx127x_lora/mod.rs +++ b/embassy-lora/src/sx127x/sx127x_lora/mod.rs @@ -8,7 +8,7 @@ use bit_field::BitField; use embassy::time::{Duration, Timer}; use embedded_hal::digital::v2::OutputPin; -use embedded_hal_async::spi::ReadWrite; +use embedded_hal_async::spi::SpiBus; mod register; use self::register::PaConfig; @@ -48,7 +48,7 @@ const VERSION_CHECK: u8 = 0x09; impl<SPI, CS, RESET, E> LoRa<SPI, CS, RESET> where - SPI: ReadWrite<u8, Error = E>, + SPI: SpiBus<u8, Error = E>, CS: OutputPin, RESET: OutputPin, { |