aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-03-20 15:54:55 +0000
committerGitHub <[email protected]>2024-03-20 15:54:55 +0000
commit3845288ffb0418cc375430dd366a1a49ccee6f5a (patch)
tree1e35124eaade02da8f32ff7eac5dca58fc867c28 /embassy-stm32/src
parent6eb539a6a12a2c48dab694725db775f03058bf0b (diff)
parente5b9b5b3e95a82dbbc15c0688781bfb6fee572ac (diff)
Merge pull request #2718 from embassy-rs/update-nightly44
Update nightly Rust.
Diffstat (limited to 'embassy-stm32/src')
-rw-r--r--embassy-stm32/src/can/bx/mod.rs2
-rw-r--r--embassy-stm32/src/can/bxcan.rs1
-rw-r--r--embassy-stm32/src/can/fd/message_ram/mod.rs20
-rw-r--r--embassy-stm32/src/can/fdcan.rs4
-rw-r--r--embassy-stm32/src/dma/mod.rs1
-rw-r--r--embassy-stm32/src/flash/f0.rs1
-rw-r--r--embassy-stm32/src/flash/f1f3.rs1
-rw-r--r--embassy-stm32/src/flash/f4.rs1
-rw-r--r--embassy-stm32/src/flash/f7.rs1
-rw-r--r--embassy-stm32/src/flash/g.rs1
-rw-r--r--embassy-stm32/src/flash/h7.rs1
-rw-r--r--embassy-stm32/src/flash/u5.rs1
-rw-r--r--embassy-stm32/src/fmt.rs3
-rw-r--r--embassy-stm32/src/i2c/v1.rs1
-rw-r--r--embassy-stm32/src/i2c/v2.rs1
-rw-r--r--embassy-stm32/src/rtc/datetime.rs5
-rw-r--r--embassy-stm32/src/sdmmc/mod.rs2
-rw-r--r--embassy-stm32/src/time_driver.rs1
-rw-r--r--embassy-stm32/src/timer/complementary_pwm.rs1
-rw-r--r--embassy-stm32/src/timer/simple_pwm.rs1
-rw-r--r--embassy-stm32/src/uid.rs2
-rw-r--r--embassy-stm32/src/usart/buffered.rs5
-rw-r--r--embassy-stm32/src/usb/otg.rs4
-rw-r--r--embassy-stm32/src/usb/usb.rs11
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
30use core::cmp::{Ord, Ordering}; 30use core::cmp::{Ord, Ordering};
31use core::convert::{Infallible, Into, TryInto}; 31use core::convert::Infallible;
32use core::marker::PhantomData; 32use core::marker::PhantomData;
33use core::mem; 33use 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 @@
1use core::convert::AsMut;
2use core::future::poll_fn; 1use core::future::poll_fn;
3use core::marker::PhantomData; 2use core::marker::PhantomData;
4use core::ops::{Deref, DerefMut}; 3use 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;
140impl generic::Readable for TxBufferElementHeader {} 140impl generic::Readable for TxBufferElementHeader {}
141impl generic::Writable for TxBufferElementHeader {} 141impl 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.
153pub 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.
164static_assertions::assert_eq_size!(Filters, [u32; 28 + 16]); 144static_assertions::assert_eq_size!(Filters, [u32; 28 + 16]);
165static_assertions::assert_eq_size!(Receive, [u32; 54]); 145static_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 @@
1use core::convert::TryInto;
2use core::ptr::write_volatile; 1use core::ptr::write_volatile;
3use core::sync::atomic::{fence, Ordering}; 2use 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 @@
1use core::convert::TryInto;
2use core::ptr::write_volatile; 1use core::ptr::write_volatile;
3use core::sync::atomic::{fence, Ordering}; 2use 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 @@
1use core::convert::TryInto;
2use core::ptr::write_volatile; 1use core::ptr::write_volatile;
3use core::sync::atomic::{fence, AtomicBool, Ordering}; 2use 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 @@
1use core::convert::TryInto;
2use core::ptr::write_volatile; 1use core::ptr::write_volatile;
3use core::sync::atomic::{fence, Ordering}; 2use 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 @@
1use core::convert::TryInto;
2use core::ptr::write_volatile; 1use core::ptr::write_volatile;
3use core::sync::atomic::{fence, Ordering}; 2use 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 @@
1use core::convert::TryInto;
2use core::ptr::write_volatile; 1use core::ptr::write_volatile;
3use core::sync::atomic::{fence, Ordering}; 2use 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 @@
1use core::convert::TryInto;
2use core::ptr::write_volatile; 1use core::ptr::write_volatile;
3use core::sync::atomic::{fence, Ordering}; 2use 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
4use core::fmt::{Debug, Display, LowerHex}; 4use 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)]
233pub(crate) struct Bytes<'a>(pub &'a [u8]); 232pub(crate) struct Bytes<'a>(pub &'a [u8]);
234 233
235impl<'a> Debug for Bytes<'a> { 234impl<'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;
15use super::*; 15use super::*;
16use crate::dma::Transfer; 16use crate::dma::Transfer;
17use crate::pac::i2c; 17use crate::pac::i2c;
18use 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;
9use super::*; 9use super::*;
10use crate::dma::Transfer; 10use crate::dma::Transfer;
11use crate::pac::i2c; 11use crate::pac::i2c;
12use crate::time::Hertz;
13 12
14pub(crate) unsafe fn on_interrupt<T: Instance>() { 13pub(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")]
2use core::convert::From; 2use chrono::{Datelike, NaiveDate, Timelike, Weekday};
3
4#[cfg(feature = "chrono")]
5use chrono::{self, Datelike, NaiveDate, Timelike, Weekday};
6 3
7#[cfg(any(feature = "defmt", feature = "time"))] 4#[cfg(any(feature = "defmt", feature = "time"))]
8use crate::peripherals::RTC; 5use 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
3use core::cell::Cell; 3use core::cell::Cell;
4use core::convert::TryInto;
5use core::sync::atomic::{compiler_fence, AtomicU32, AtomicU8, Ordering}; 4use core::sync::atomic::{compiler_fence, AtomicU32, AtomicU8, Ordering};
6use core::{mem, ptr}; 5use 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)]
11use crate::gpio::sealed::{AFType, Pin}; 11use crate::gpio::sealed::{AFType, Pin};
12use crate::gpio::{AnyPin, OutputType}; 12use crate::gpio::{AnyPin, OutputType};
13use crate::time::Hertz;
14use crate::Peripheral; 13use 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)]
9use crate::gpio::sealed::{AFType, Pin}; 9use crate::gpio::sealed::{AFType, Pin};
10use crate::gpio::{AnyPin, OutputType}; 10use crate::gpio::{AnyPin, OutputType};
11use crate::time::Hertz;
12use crate::Peripheral; 11use 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 @@
1use core::future::poll_fn;
2use core::slice; 1use core::slice;
3use core::sync::atomic::{AtomicBool, Ordering}; 2use core::sync::atomic::AtomicBool;
4use core::task::Poll;
5 3
6use embassy_hal_internal::atomic_ring_buffer::RingBuffer; 4use embassy_hal_internal::atomic_ring_buffer::RingBuffer;
7use embassy_sync::waitqueue::AtomicWaker; 5use embassy_sync::waitqueue::AtomicWaker;
8 6
9use super::*; 7use super::*;
10use crate::interrupt::typelevel::Interrupt;
11 8
12/// Interrupt handler. 9/// Interrupt handler.
13pub struct InterruptHandler<T: BasicInstance> { 10pub 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;
6use embassy_hal_internal::{into_ref, Peripheral}; 6use embassy_hal_internal::{into_ref, Peripheral};
7use embassy_sync::waitqueue::AtomicWaker; 7use embassy_sync::waitqueue::AtomicWaker;
8use embassy_usb_driver::{ 8use 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};
12use futures::future::poll_fn; 12use 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
638trait Dir { 638trait 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.