aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Schuhen <[email protected]>2024-03-07 08:11:10 +1000
committerCorey Schuhen <[email protected]>2024-03-07 17:45:01 +1000
commit9ba379fb9eed304de96309d5a47a984ba7ed5ee1 (patch)
tree7dd20bbcd469317e33727871624ca400002a47e6
parent65b38cf75504339033c56b39ce23da0b697a35a5 (diff)
Remove usage of old PAC
Formatting
-rw-r--r--embassy-stm32/src/can/bx/mod.rs9
-rw-r--r--embassy-stm32/src/can/bxcan.rs7
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;
29mod id; 29mod id;
30 30
31#[allow(clippy::all)] // generated code 31#[allow(clippy::all)] // generated code
32mod pac;
33
34use core::cmp::{Ord, Ordering}; 32use core::cmp::{Ord, Ordering};
35use core::convert::{Infallible, TryInto}; 33use core::convert::{Infallible, TryInto};
36use core::marker::PhantomData; 34use core::marker::PhantomData;
@@ -38,10 +36,8 @@ use core::mem;
38 36
39pub use id::{ExtendedId, Id, StandardId}; 37pub use id::{ExtendedId, Id, StandardId};
40 38
41use self::pac::generic::*;
42use crate::can::bx::filter::MasterFilters; 39use crate::can::bx::filter::MasterFilters;
43pub use crate::can::bx::frame::{Data, Frame, FramePriority}; 40pub use crate::can::bx::frame::{Data, Frame, FramePriority};
44pub 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.
59pub unsafe trait Instance { 55pub 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.
532pub struct BxcanInstance<'a, T>(PeripheralRef<'a, T>); 530pub struct BxcanInstance<'a, T>(PeripheralRef<'a, T>);
533 531
534unsafe impl<'d, T: Instance> crate::can::bx::Instance for BxcanInstance<'d, T> { 532unsafe 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
538foreach_peripheral!( 534foreach_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