diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-03-20 15:54:55 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-03-20 15:54:55 +0000 |
| commit | 3845288ffb0418cc375430dd366a1a49ccee6f5a (patch) | |
| tree | 1e35124eaade02da8f32ff7eac5dca58fc867c28 /embassy-stm32/src | |
| parent | 6eb539a6a12a2c48dab694725db775f03058bf0b (diff) | |
| parent | e5b9b5b3e95a82dbbc15c0688781bfb6fee572ac (diff) | |
Merge pull request #2718 from embassy-rs/update-nightly44
Update nightly Rust.
Diffstat (limited to 'embassy-stm32/src')
24 files changed, 10 insertions, 62 deletions
diff --git a/embassy-stm32/src/can/bx/mod.rs b/embassy-stm32/src/can/bx/mod.rs index 33e702c6e..a369ae6fd 100644 --- a/embassy-stm32/src/can/bx/mod.rs +++ b/embassy-stm32/src/can/bx/mod.rs | |||
| @@ -28,7 +28,7 @@ pub mod filter; | |||
| 28 | 28 | ||
| 29 | #[allow(clippy::all)] // generated code | 29 | #[allow(clippy::all)] // generated code |
| 30 | use core::cmp::{Ord, Ordering}; | 30 | use core::cmp::{Ord, Ordering}; |
| 31 | use core::convert::{Infallible, Into, TryInto}; | 31 | use core::convert::Infallible; |
| 32 | use core::marker::PhantomData; | 32 | use core::marker::PhantomData; |
| 33 | use core::mem; | 33 | use core::mem; |
| 34 | 34 | ||
diff --git a/embassy-stm32/src/can/bxcan.rs b/embassy-stm32/src/can/bxcan.rs index bb7cc3d7f..1a625bdc4 100644 --- a/embassy-stm32/src/can/bxcan.rs +++ b/embassy-stm32/src/can/bxcan.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | use core::convert::AsMut; | ||
| 2 | use core::future::poll_fn; | 1 | use core::future::poll_fn; |
| 3 | use core::marker::PhantomData; | 2 | use core::marker::PhantomData; |
| 4 | use core::ops::{Deref, DerefMut}; | 3 | use core::ops::{Deref, DerefMut}; |
diff --git a/embassy-stm32/src/can/fd/message_ram/mod.rs b/embassy-stm32/src/can/fd/message_ram/mod.rs index 830edf3bb..040a999b4 100644 --- a/embassy-stm32/src/can/fd/message_ram/mod.rs +++ b/embassy-stm32/src/can/fd/message_ram/mod.rs | |||
| @@ -140,26 +140,6 @@ pub(crate) struct _TxBufferElement; | |||
| 140 | impl generic::Readable for TxBufferElementHeader {} | 140 | impl generic::Readable for TxBufferElementHeader {} |
| 141 | impl generic::Writable for TxBufferElementHeader {} | 141 | impl generic::Writable for TxBufferElementHeader {} |
| 142 | 142 | ||
| 143 | /// FdCan Message RAM instance. | ||
| 144 | /// | ||
| 145 | /// # Safety | ||
| 146 | /// | ||
| 147 | /// It is only safe to implement this trait, when: | ||
| 148 | /// | ||
| 149 | /// * The implementing type has ownership of the Message RAM, preventing any | ||
| 150 | /// other accesses to the register block. | ||
| 151 | /// * `MSG_RAM` is a pointer to the Message RAM block and can be safely accessed | ||
| 152 | /// for as long as ownership or a borrow of the implementing type is present. | ||
| 153 | pub unsafe trait Instance { | ||
| 154 | const MSG_RAM: *mut RegisterBlock; | ||
| 155 | fn msg_ram(&self) -> &RegisterBlock { | ||
| 156 | unsafe { &*Self::MSG_RAM } | ||
| 157 | } | ||
| 158 | fn msg_ram_mut(&mut self) -> &mut RegisterBlock { | ||
| 159 | unsafe { &mut *Self::MSG_RAM } | ||
| 160 | } | ||
| 161 | } | ||
| 162 | |||
| 163 | // Ensure the RegisterBlock is the same size as on pg 1957 of RM0440. | 143 | // Ensure the RegisterBlock is the same size as on pg 1957 of RM0440. |
| 164 | static_assertions::assert_eq_size!(Filters, [u32; 28 + 16]); | 144 | static_assertions::assert_eq_size!(Filters, [u32; 28 + 16]); |
| 165 | static_assertions::assert_eq_size!(Receive, [u32; 54]); | 145 | static_assertions::assert_eq_size!(Receive, [u32; 54]); |
diff --git a/embassy-stm32/src/can/fdcan.rs b/embassy-stm32/src/can/fdcan.rs index fe8969a5a..4c40f10e3 100644 --- a/embassy-stm32/src/can/fdcan.rs +++ b/embassy-stm32/src/can/fdcan.rs | |||
| @@ -883,9 +883,9 @@ macro_rules! impl_fdcan { | |||
| 883 | fn ram() -> &'static crate::pac::fdcanram::Fdcanram { | 883 | fn ram() -> &'static crate::pac::fdcanram::Fdcanram { |
| 884 | &crate::pac::$msg_ram_inst | 884 | &crate::pac::$msg_ram_inst |
| 885 | } | 885 | } |
| 886 | unsafe fn mut_state() -> & 'static mut sealed::State { | 886 | unsafe fn mut_state() -> &'static mut sealed::State { |
| 887 | static mut STATE: sealed::State = sealed::State::new(); | 887 | static mut STATE: sealed::State = sealed::State::new(); |
| 888 | & mut STATE | 888 | &mut *core::ptr::addr_of_mut!(STATE) |
| 889 | } | 889 | } |
| 890 | fn state() -> &'static sealed::State { | 890 | fn state() -> &'static sealed::State { |
| 891 | unsafe { peripherals::$inst::mut_state() } | 891 | unsafe { peripherals::$inst::mut_state() } |
diff --git a/embassy-stm32/src/dma/mod.rs b/embassy-stm32/src/dma/mod.rs index d5e88a20a..2f98b9857 100644 --- a/embassy-stm32/src/dma/mod.rs +++ b/embassy-stm32/src/dma/mod.rs | |||
| @@ -44,6 +44,7 @@ pub(crate) mod sealed { | |||
| 44 | fn id(&self) -> u8; | 44 | fn id(&self) -> u8; |
| 45 | } | 45 | } |
| 46 | pub trait ChannelInterrupt { | 46 | pub trait ChannelInterrupt { |
| 47 | #[cfg_attr(not(feature = "rt"), allow(unused))] | ||
| 47 | unsafe fn on_irq(); | 48 | unsafe fn on_irq(); |
| 48 | } | 49 | } |
| 49 | } | 50 | } |
diff --git a/embassy-stm32/src/flash/f0.rs b/embassy-stm32/src/flash/f0.rs index e0c76e6b2..e2f135208 100644 --- a/embassy-stm32/src/flash/f0.rs +++ b/embassy-stm32/src/flash/f0.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | use core::convert::TryInto; | ||
| 2 | use core::ptr::write_volatile; | 1 | use core::ptr::write_volatile; |
| 3 | use core::sync::atomic::{fence, Ordering}; | 2 | use core::sync::atomic::{fence, Ordering}; |
| 4 | 3 | ||
diff --git a/embassy-stm32/src/flash/f1f3.rs b/embassy-stm32/src/flash/f1f3.rs index e7790369a..b16354a74 100644 --- a/embassy-stm32/src/flash/f1f3.rs +++ b/embassy-stm32/src/flash/f1f3.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | use core::convert::TryInto; | ||
| 2 | use core::ptr::write_volatile; | 1 | use core::ptr::write_volatile; |
| 3 | use core::sync::atomic::{fence, Ordering}; | 2 | use core::sync::atomic::{fence, Ordering}; |
| 4 | 3 | ||
diff --git a/embassy-stm32/src/flash/f4.rs b/embassy-stm32/src/flash/f4.rs index 57447bea5..00e61f2d2 100644 --- a/embassy-stm32/src/flash/f4.rs +++ b/embassy-stm32/src/flash/f4.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | use core::convert::TryInto; | ||
| 2 | use core::ptr::write_volatile; | 1 | use core::ptr::write_volatile; |
| 3 | use core::sync::atomic::{fence, AtomicBool, Ordering}; | 2 | use core::sync::atomic::{fence, AtomicBool, Ordering}; |
| 4 | 3 | ||
diff --git a/embassy-stm32/src/flash/f7.rs b/embassy-stm32/src/flash/f7.rs index 0f512bbc4..72de0b445 100644 --- a/embassy-stm32/src/flash/f7.rs +++ b/embassy-stm32/src/flash/f7.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | use core::convert::TryInto; | ||
| 2 | use core::ptr::write_volatile; | 1 | use core::ptr::write_volatile; |
| 3 | use core::sync::atomic::{fence, Ordering}; | 2 | use core::sync::atomic::{fence, Ordering}; |
| 4 | 3 | ||
diff --git a/embassy-stm32/src/flash/g.rs b/embassy-stm32/src/flash/g.rs index b69c4343b..6a5adc941 100644 --- a/embassy-stm32/src/flash/g.rs +++ b/embassy-stm32/src/flash/g.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | use core::convert::TryInto; | ||
| 2 | use core::ptr::write_volatile; | 1 | use core::ptr::write_volatile; |
| 3 | use core::sync::atomic::{fence, Ordering}; | 2 | use core::sync::atomic::{fence, Ordering}; |
| 4 | 3 | ||
diff --git a/embassy-stm32/src/flash/h7.rs b/embassy-stm32/src/flash/h7.rs index 743925e17..e32a82eef 100644 --- a/embassy-stm32/src/flash/h7.rs +++ b/embassy-stm32/src/flash/h7.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | use core::convert::TryInto; | ||
| 2 | use core::ptr::write_volatile; | 1 | use core::ptr::write_volatile; |
| 3 | use core::sync::atomic::{fence, Ordering}; | 2 | use core::sync::atomic::{fence, Ordering}; |
| 4 | 3 | ||
diff --git a/embassy-stm32/src/flash/u5.rs b/embassy-stm32/src/flash/u5.rs index 3787082f9..580c490da 100644 --- a/embassy-stm32/src/flash/u5.rs +++ b/embassy-stm32/src/flash/u5.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | use core::convert::TryInto; | ||
| 2 | use core::ptr::write_volatile; | 1 | use core::ptr::write_volatile; |
| 3 | use core::sync::atomic::{fence, Ordering}; | 2 | use core::sync::atomic::{fence, Ordering}; |
| 4 | 3 | ||
diff --git a/embassy-stm32/src/fmt.rs b/embassy-stm32/src/fmt.rs index 78e583c1c..2ac42c557 100644 --- a/embassy-stm32/src/fmt.rs +++ b/embassy-stm32/src/fmt.rs | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #![macro_use] | 1 | #![macro_use] |
| 2 | #![allow(unused_macros)] | 2 | #![allow(unused)] |
| 3 | 3 | ||
| 4 | use core::fmt::{Debug, Display, LowerHex}; | 4 | use core::fmt::{Debug, Display, LowerHex}; |
| 5 | 5 | ||
| @@ -229,7 +229,6 @@ impl<T, E> Try for Result<T, E> { | |||
| 229 | } | 229 | } |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | #[allow(unused)] | ||
| 233 | pub(crate) struct Bytes<'a>(pub &'a [u8]); | 232 | pub(crate) struct Bytes<'a>(pub &'a [u8]); |
| 234 | 233 | ||
| 235 | impl<'a> Debug for Bytes<'a> { | 234 | impl<'a> Debug for Bytes<'a> { |
diff --git a/embassy-stm32/src/i2c/v1.rs b/embassy-stm32/src/i2c/v1.rs index f1ed7ca40..9f29ed5e0 100644 --- a/embassy-stm32/src/i2c/v1.rs +++ b/embassy-stm32/src/i2c/v1.rs | |||
| @@ -15,7 +15,6 @@ use embedded_hal_1::i2c::Operation; | |||
| 15 | use super::*; | 15 | use super::*; |
| 16 | use crate::dma::Transfer; | 16 | use crate::dma::Transfer; |
| 17 | use crate::pac::i2c; | 17 | use crate::pac::i2c; |
| 18 | use crate::time::Hertz; | ||
| 19 | 18 | ||
| 20 | // /!\ /!\ | 19 | // /!\ /!\ |
| 21 | // /!\ Implementation note! /!\ | 20 | // /!\ Implementation note! /!\ |
diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs index 1ac2740df..8baf2849d 100644 --- a/embassy-stm32/src/i2c/v2.rs +++ b/embassy-stm32/src/i2c/v2.rs | |||
| @@ -9,7 +9,6 @@ use embedded_hal_1::i2c::Operation; | |||
| 9 | use super::*; | 9 | use super::*; |
| 10 | use crate::dma::Transfer; | 10 | use crate::dma::Transfer; |
| 11 | use crate::pac::i2c; | 11 | use crate::pac::i2c; |
| 12 | use crate::time::Hertz; | ||
| 13 | 12 | ||
| 14 | pub(crate) unsafe fn on_interrupt<T: Instance>() { | 13 | pub(crate) unsafe fn on_interrupt<T: Instance>() { |
| 15 | let regs = T::regs(); | 14 | let regs = T::regs(); |
diff --git a/embassy-stm32/src/rtc/datetime.rs b/embassy-stm32/src/rtc/datetime.rs index ef92fa4bb..2bad79923 100644 --- a/embassy-stm32/src/rtc/datetime.rs +++ b/embassy-stm32/src/rtc/datetime.rs | |||
| @@ -1,8 +1,5 @@ | |||
| 1 | #[cfg(feature = "chrono")] | 1 | #[cfg(feature = "chrono")] |
| 2 | use core::convert::From; | 2 | use chrono::{Datelike, NaiveDate, Timelike, Weekday}; |
| 3 | |||
| 4 | #[cfg(feature = "chrono")] | ||
| 5 | use chrono::{self, Datelike, NaiveDate, Timelike, Weekday}; | ||
| 6 | 3 | ||
| 7 | #[cfg(any(feature = "defmt", feature = "time"))] | 4 | #[cfg(any(feature = "defmt", feature = "time"))] |
| 8 | use crate::peripherals::RTC; | 5 | use crate::peripherals::RTC; |
diff --git a/embassy-stm32/src/sdmmc/mod.rs b/embassy-stm32/src/sdmmc/mod.rs index fa1f710d8..c0b3a2183 100644 --- a/embassy-stm32/src/sdmmc/mod.rs +++ b/embassy-stm32/src/sdmmc/mod.rs | |||
| @@ -1427,8 +1427,6 @@ pub(crate) mod sealed { | |||
| 1427 | fn regs() -> RegBlock; | 1427 | fn regs() -> RegBlock; |
| 1428 | fn state() -> &'static AtomicWaker; | 1428 | fn state() -> &'static AtomicWaker; |
| 1429 | } | 1429 | } |
| 1430 | |||
| 1431 | pub trait Pins<T: Instance> {} | ||
| 1432 | } | 1430 | } |
| 1433 | 1431 | ||
| 1434 | /// SDMMC instance trait. | 1432 | /// SDMMC instance trait. |
diff --git a/embassy-stm32/src/time_driver.rs b/embassy-stm32/src/time_driver.rs index 37b2e7526..9be56d3d1 100644 --- a/embassy-stm32/src/time_driver.rs +++ b/embassy-stm32/src/time_driver.rs | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | #![allow(non_snake_case)] | 1 | #![allow(non_snake_case)] |
| 2 | 2 | ||
| 3 | use core::cell::Cell; | 3 | use core::cell::Cell; |
| 4 | use core::convert::TryInto; | ||
| 5 | use core::sync::atomic::{compiler_fence, AtomicU32, AtomicU8, Ordering}; | 4 | use core::sync::atomic::{compiler_fence, AtomicU32, AtomicU8, Ordering}; |
| 6 | use core::{mem, ptr}; | 5 | use core::{mem, ptr}; |
| 7 | 6 | ||
diff --git a/embassy-stm32/src/timer/complementary_pwm.rs b/embassy-stm32/src/timer/complementary_pwm.rs index 72f1ec864..723e8506b 100644 --- a/embassy-stm32/src/timer/complementary_pwm.rs +++ b/embassy-stm32/src/timer/complementary_pwm.rs | |||
| @@ -10,7 +10,6 @@ use super::*; | |||
| 10 | #[allow(unused_imports)] | 10 | #[allow(unused_imports)] |
| 11 | use crate::gpio::sealed::{AFType, Pin}; | 11 | use crate::gpio::sealed::{AFType, Pin}; |
| 12 | use crate::gpio::{AnyPin, OutputType}; | 12 | use crate::gpio::{AnyPin, OutputType}; |
| 13 | use crate::time::Hertz; | ||
| 14 | use crate::Peripheral; | 13 | use crate::Peripheral; |
| 15 | 14 | ||
| 16 | /// Complementary PWM pin wrapper. | 15 | /// Complementary PWM pin wrapper. |
diff --git a/embassy-stm32/src/timer/simple_pwm.rs b/embassy-stm32/src/timer/simple_pwm.rs index 6df2f66ec..4669fc6cc 100644 --- a/embassy-stm32/src/timer/simple_pwm.rs +++ b/embassy-stm32/src/timer/simple_pwm.rs | |||
| @@ -8,7 +8,6 @@ use super::*; | |||
| 8 | #[allow(unused_imports)] | 8 | #[allow(unused_imports)] |
| 9 | use crate::gpio::sealed::{AFType, Pin}; | 9 | use crate::gpio::sealed::{AFType, Pin}; |
| 10 | use crate::gpio::{AnyPin, OutputType}; | 10 | use crate::gpio::{AnyPin, OutputType}; |
| 11 | use crate::time::Hertz; | ||
| 12 | use crate::Peripheral; | 11 | use crate::Peripheral; |
| 13 | 12 | ||
| 14 | /// Channel 1 marker type. | 13 | /// Channel 1 marker type. |
diff --git a/embassy-stm32/src/uid.rs b/embassy-stm32/src/uid.rs index aa13586f8..5e38532bd 100644 --- a/embassy-stm32/src/uid.rs +++ b/embassy-stm32/src/uid.rs | |||
| @@ -27,5 +27,5 @@ pub fn uid_hex_bytes() -> &'static [u8; 24] { | |||
| 27 | LOADED = true; | 27 | LOADED = true; |
| 28 | } | 28 | } |
| 29 | }); | 29 | }); |
| 30 | unsafe { &UID_HEX } | 30 | unsafe { &*core::ptr::addr_of!(UID_HEX) } |
| 31 | } | 31 | } |
diff --git a/embassy-stm32/src/usart/buffered.rs b/embassy-stm32/src/usart/buffered.rs index c11e3382f..683b0f8b2 100644 --- a/embassy-stm32/src/usart/buffered.rs +++ b/embassy-stm32/src/usart/buffered.rs | |||
| @@ -1,13 +1,10 @@ | |||
| 1 | use core::future::poll_fn; | ||
| 2 | use core::slice; | 1 | use core::slice; |
| 3 | use core::sync::atomic::{AtomicBool, Ordering}; | 2 | use core::sync::atomic::AtomicBool; |
| 4 | use core::task::Poll; | ||
| 5 | 3 | ||
| 6 | use embassy_hal_internal::atomic_ring_buffer::RingBuffer; | 4 | use embassy_hal_internal::atomic_ring_buffer::RingBuffer; |
| 7 | use embassy_sync::waitqueue::AtomicWaker; | 5 | use embassy_sync::waitqueue::AtomicWaker; |
| 8 | 6 | ||
| 9 | use super::*; | 7 | use super::*; |
| 10 | use crate::interrupt::typelevel::Interrupt; | ||
| 11 | 8 | ||
| 12 | /// Interrupt handler. | 9 | /// Interrupt handler. |
| 13 | pub struct InterruptHandler<T: BasicInstance> { | 10 | pub struct InterruptHandler<T: BasicInstance> { |
diff --git a/embassy-stm32/src/usb/otg.rs b/embassy-stm32/src/usb/otg.rs index 80a08f3c5..d4095b466 100644 --- a/embassy-stm32/src/usb/otg.rs +++ b/embassy-stm32/src/usb/otg.rs | |||
| @@ -6,8 +6,8 @@ use core::task::Poll; | |||
| 6 | use embassy_hal_internal::{into_ref, Peripheral}; | 6 | use embassy_hal_internal::{into_ref, Peripheral}; |
| 7 | use embassy_sync::waitqueue::AtomicWaker; | 7 | use embassy_sync::waitqueue::AtomicWaker; |
| 8 | use embassy_usb_driver::{ | 8 | use embassy_usb_driver::{ |
| 9 | self, Bus as _, Direction, EndpointAddress, EndpointAllocError, EndpointError, EndpointIn, EndpointInfo, | 9 | Bus as _, Direction, EndpointAddress, EndpointAllocError, EndpointError, EndpointIn, EndpointInfo, EndpointOut, |
| 10 | EndpointOut, EndpointType, Event, Unsupported, | 10 | EndpointType, Event, Unsupported, |
| 11 | }; | 11 | }; |
| 12 | use futures::future::poll_fn; | 12 | use futures::future::poll_fn; |
| 13 | 13 | ||
diff --git a/embassy-stm32/src/usb/usb.rs b/embassy-stm32/src/usb/usb.rs index 1fb2c9ebb..c4f9140da 100644 --- a/embassy-stm32/src/usb/usb.rs +++ b/embassy-stm32/src/usb/usb.rs | |||
| @@ -637,7 +637,6 @@ impl<'d, T: Instance> driver::Bus for Bus<'d, T> { | |||
| 637 | 637 | ||
| 638 | trait Dir { | 638 | trait Dir { |
| 639 | fn dir() -> Direction; | 639 | fn dir() -> Direction; |
| 640 | fn waker(i: usize) -> &'static AtomicWaker; | ||
| 641 | } | 640 | } |
| 642 | 641 | ||
| 643 | /// Marker type for the "IN" direction. | 642 | /// Marker type for the "IN" direction. |
| @@ -646,11 +645,6 @@ impl Dir for In { | |||
| 646 | fn dir() -> Direction { | 645 | fn dir() -> Direction { |
| 647 | Direction::In | 646 | Direction::In |
| 648 | } | 647 | } |
| 649 | |||
| 650 | #[inline] | ||
| 651 | fn waker(i: usize) -> &'static AtomicWaker { | ||
| 652 | &EP_IN_WAKERS[i] | ||
| 653 | } | ||
| 654 | } | 648 | } |
| 655 | 649 | ||
| 656 | /// Marker type for the "OUT" direction. | 650 | /// Marker type for the "OUT" direction. |
| @@ -659,11 +653,6 @@ impl Dir for Out { | |||
| 659 | fn dir() -> Direction { | 653 | fn dir() -> Direction { |
| 660 | Direction::Out | 654 | Direction::Out |
| 661 | } | 655 | } |
| 662 | |||
| 663 | #[inline] | ||
| 664 | fn waker(i: usize) -> &'static AtomicWaker { | ||
| 665 | &EP_OUT_WAKERS[i] | ||
| 666 | } | ||
| 667 | } | 656 | } |
| 668 | 657 | ||
| 669 | /// USB endpoint. | 658 | /// USB endpoint. |
