diff options
| author | Corey Schuhen <[email protected]> | 2024-03-07 08:11:10 +1000 |
|---|---|---|
| committer | Corey Schuhen <[email protected]> | 2024-03-07 17:45:01 +1000 |
| commit | 9ba379fb9eed304de96309d5a47a984ba7ed5ee1 (patch) | |
| tree | 7dd20bbcd469317e33727871624ca400002a47e6 | |
| parent | 65b38cf75504339033c56b39ce23da0b697a35a5 (diff) | |
Remove usage of old PAC
Formatting
| -rw-r--r-- | embassy-stm32/src/can/bx/mod.rs | 9 | ||||
| -rw-r--r-- | embassy-stm32/src/can/bxcan.rs | 7 |
2 files changed, 2 insertions, 14 deletions
diff --git a/embassy-stm32/src/can/bx/mod.rs b/embassy-stm32/src/can/bx/mod.rs index 375bc27f7..2bfa827a8 100644 --- a/embassy-stm32/src/can/bx/mod.rs +++ b/embassy-stm32/src/can/bx/mod.rs | |||
| @@ -29,8 +29,6 @@ mod frame; | |||
| 29 | mod id; | 29 | mod id; |
| 30 | 30 | ||
| 31 | #[allow(clippy::all)] // generated code | 31 | #[allow(clippy::all)] // generated code |
| 32 | mod pac; | ||
| 33 | |||
| 34 | use core::cmp::{Ord, Ordering}; | 32 | use core::cmp::{Ord, Ordering}; |
| 35 | use core::convert::{Infallible, TryInto}; | 33 | use core::convert::{Infallible, TryInto}; |
| 36 | use core::marker::PhantomData; | 34 | use core::marker::PhantomData; |
| @@ -38,10 +36,8 @@ use core::mem; | |||
| 38 | 36 | ||
| 39 | pub use id::{ExtendedId, Id, StandardId}; | 37 | pub use id::{ExtendedId, Id, StandardId}; |
| 40 | 38 | ||
| 41 | use self::pac::generic::*; | ||
| 42 | use crate::can::bx::filter::MasterFilters; | 39 | use crate::can::bx::filter::MasterFilters; |
| 43 | pub use crate::can::bx::frame::{Data, Frame, FramePriority}; | 40 | pub use crate::can::bx::frame::{Data, Frame, FramePriority}; |
| 44 | pub use crate::can::bx::pac::can::RegisterBlock; // To make the PAC extraction build | ||
| 45 | 41 | ||
| 46 | /// A bxCAN peripheral instance. | 42 | /// A bxCAN peripheral instance. |
| 47 | /// | 43 | /// |
| @@ -56,10 +52,7 @@ pub use crate::can::bx::pac::can::RegisterBlock; // To make the PAC extraction b | |||
| 56 | /// register block. | 52 | /// register block. |
| 57 | /// * `REGISTERS` is a pointer to that peripheral's register block and can be safely accessed for as | 53 | /// * `REGISTERS` is a pointer to that peripheral's register block and can be safely accessed for as |
| 58 | /// long as ownership or a borrow of the implementing type is present. | 54 | /// long as ownership or a borrow of the implementing type is present. |
| 59 | pub unsafe trait Instance { | 55 | pub unsafe trait Instance {} |
| 60 | /// Pointer to the instance's register block. | ||
| 61 | const REGISTERS: *mut RegisterBlock; | ||
| 62 | } | ||
| 63 | 56 | ||
| 64 | /// A bxCAN instance that owns filter banks. | 57 | /// A bxCAN instance that owns filter banks. |
| 65 | /// | 58 | /// |
diff --git a/embassy-stm32/src/can/bxcan.rs b/embassy-stm32/src/can/bxcan.rs index 3b7c5c242..acd831937 100644 --- a/embassy-stm32/src/can/bxcan.rs +++ b/embassy-stm32/src/can/bxcan.rs | |||
| @@ -509,8 +509,6 @@ pub(crate) mod sealed { | |||
| 509 | } | 509 | } |
| 510 | 510 | ||
| 511 | pub trait Instance { | 511 | pub trait Instance { |
| 512 | const REGISTERS: *mut crate::can::bx::RegisterBlock; | ||
| 513 | |||
| 514 | fn regs() -> crate::pac::can::Can; | 512 | fn regs() -> crate::pac::can::Can; |
| 515 | fn state() -> &'static State; | 513 | fn state() -> &'static State; |
| 516 | } | 514 | } |
| @@ -531,14 +529,11 @@ pub trait Instance: sealed::Instance + RccPeripheral + 'static { | |||
| 531 | /// BXCAN instance newtype. | 529 | /// BXCAN instance newtype. |
| 532 | pub struct BxcanInstance<'a, T>(PeripheralRef<'a, T>); | 530 | pub struct BxcanInstance<'a, T>(PeripheralRef<'a, T>); |
| 533 | 531 | ||
| 534 | unsafe impl<'d, T: Instance> crate::can::bx::Instance for BxcanInstance<'d, T> { | 532 | unsafe impl<'d, T: Instance> crate::can::bx::Instance for BxcanInstance<'d, T> {} |
| 535 | const REGISTERS: *mut crate::can::bx::RegisterBlock = T::REGISTERS; | ||
| 536 | } | ||
| 537 | 533 | ||
| 538 | foreach_peripheral!( | 534 | foreach_peripheral!( |
| 539 | (can, $inst:ident) => { | 535 | (can, $inst:ident) => { |
| 540 | impl sealed::Instance for peripherals::$inst { | 536 | impl sealed::Instance for peripherals::$inst { |
| 541 | const REGISTERS: *mut crate::can::bx::RegisterBlock = crate::pac::$inst.as_ptr() as *mut _; | ||
| 542 | 537 | ||
| 543 | fn regs() -> crate::pac::can::Can { | 538 | fn regs() -> crate::pac::can::Can { |
| 544 | crate::pac::$inst | 539 | crate::pac::$inst |
