aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Kröger <[email protected]>2021-08-06 11:59:16 +0200
committerDario Nieuwenhuis <[email protected]>2021-08-18 21:58:50 +0200
commit191a589820159a69fbc72f996c4be91093dc2b44 (patch)
tree430bdd570a0df4cb162e8f7972bcf5c54f088cc8
parentdc6b7f3cbaa291d2a9b83bda88fbef08cf464bc5 (diff)
bxcan: namechange "bxcan_v1" -> "can_bxcan"
-rw-r--r--embassy-stm32/src/can/bxcan.rs (renamed from embassy-stm32/src/bxcan.rs)21
-rw-r--r--embassy-stm32/src/can/mod.rs5
-rw-r--r--embassy-stm32/src/lib.rs4
-rw-r--r--examples/stm32f4/src/bin/can.rs2
4 files changed, 16 insertions, 16 deletions
diff --git a/embassy-stm32/src/bxcan.rs b/embassy-stm32/src/can/bxcan.rs
index 8dd7459be..33f3cebff 100644
--- a/embassy-stm32/src/bxcan.rs
+++ b/embassy-stm32/src/can/bxcan.rs
@@ -68,7 +68,7 @@ pub(crate) mod sealed {
68 use super::*; 68 use super::*;
69 69
70 pub trait Instance { 70 pub trait Instance {
71 fn regs() -> &'static crate::pac::bxcan::Can; 71 fn regs() -> &'static crate::pac::can::Can;
72 } 72 }
73 73
74 pub trait RxPin<T: Instance>: Pin { 74 pub trait RxPin<T: Instance>: Pin {
@@ -85,9 +85,9 @@ pub trait RxPin<T: Instance>: sealed::RxPin<T> {}
85pub trait TxPin<T: Instance>: sealed::TxPin<T> {} 85pub trait TxPin<T: Instance>: sealed::TxPin<T> {}
86 86
87crate::pac::peripherals!( 87crate::pac::peripherals!(
88 (bxcan, $inst:ident) => { 88 (can, $inst:ident) => {
89 impl sealed::Instance for peripherals::$inst { 89 impl sealed::Instance for peripherals::$inst {
90 fn regs() -> &'static crate::pac::bxcan::Can { 90 fn regs() -> &'static crate::pac::can::Can {
91 &crate::pac::$inst 91 &crate::pac::$inst
92 } 92 }
93 } 93 }
@@ -98,26 +98,21 @@ crate::pac::peripherals!(
98 const REGISTERS: *mut bxcan::RegisterBlock = crate::pac::$inst.0 as *mut _; 98 const REGISTERS: *mut bxcan::RegisterBlock = crate::pac::$inst.0 as *mut _;
99 } 99 }
100 }; 100 };
101 // (bxcan, CAN) => {
102 // unsafe impl bxcan::FilterOwner for Can<peripherals::CAN> {
103 // const NUM_FILTER_BANKS: u8 = 14;
104 // }
105 // };
106); 101);
107 102
108crate::pac::peripherals!( 103crate::pac::peripherals!(
109 // TODO: rename CAN to CAN1 on yaml level?? 104 // TODO: rename CAN to CAN1 on yaml level??
110 (bxcan, CAN) => { 105 (can, CAN) => {
111 unsafe impl bxcan::FilterOwner for peripherals::CAN { 106 unsafe impl bxcan::FilterOwner for peripherals::CAN {
112 const NUM_FILTER_BANKS: u8 = 14; 107 const NUM_FILTER_BANKS: u8 = 14;
113 } 108 }
114 }; 109 };
115 (bxcan, CAN1) => { 110 (can, CAN1) => {
116 unsafe impl bxcan::FilterOwner for peripherals::CAN1 { 111 unsafe impl bxcan::FilterOwner for peripherals::CAN1 {
117 const NUM_FILTER_BANKS: u8 = 14; 112 const NUM_FILTER_BANKS: u8 = 14;
118 } 113 }
119 }; 114 };
120 (bxcan, CAN2) => { 115 (can, CAN2) => {
121 // TODO: when CAN2 existis, we have 28 filter banks 116 // TODO: when CAN2 existis, we have 28 filter banks
122 unsafe impl bxcan::MasterInstance for peripherals::CAN1 {} 117 unsafe impl bxcan::MasterInstance for peripherals::CAN1 {}
123 }; 118 };
@@ -136,10 +131,10 @@ macro_rules! impl_pin {
136} 131}
137 132
138crate::pac::peripheral_pins!( 133crate::pac::peripheral_pins!(
139 ($inst:ident, bxcan, CAN, $pin:ident, TX, $af:expr) => { 134 ($inst:ident, can, CAN, $pin:ident, TX, $af:expr) => {
140 impl_pin!($inst, $pin, TxPin, $af); 135 impl_pin!($inst, $pin, TxPin, $af);
141 }; 136 };
142 ($inst:ident, bxcan, CAN, $pin:ident, RX, $af:expr) => { 137 ($inst:ident, can, CAN, $pin:ident, RX, $af:expr) => {
143 impl_pin!($inst, $pin, RxPin, $af); 138 impl_pin!($inst, $pin, RxPin, $af);
144 }; 139 };
145); 140);
diff --git a/embassy-stm32/src/can/mod.rs b/embassy-stm32/src/can/mod.rs
new file mode 100644
index 000000000..c7e2e620a
--- /dev/null
+++ b/embassy-stm32/src/can/mod.rs
@@ -0,0 +1,5 @@
1#![macro_use]
2
3#[cfg_attr(can_bxcan, path = "bxcan.rs")]
4mod _version;
5pub use _version::*;
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs
index ca5c4d77a..af4ab95fd 100644
--- a/embassy-stm32/src/lib.rs
+++ b/embassy-stm32/src/lib.rs
@@ -27,8 +27,8 @@ mod time_driver;
27 27
28#[cfg(adc)] 28#[cfg(adc)]
29pub mod adc; 29pub mod adc;
30#[cfg(bxcan)] 30#[cfg(can)]
31pub mod bxcan; 31pub mod can;
32#[cfg(dac)] 32#[cfg(dac)]
33pub mod dac; 33pub mod dac;
34#[cfg(dbgmcu)] 34#[cfg(dbgmcu)]
diff --git a/examples/stm32f4/src/bin/can.rs b/examples/stm32f4/src/bin/can.rs
index d35a81d1d..04f3417c6 100644
--- a/examples/stm32f4/src/bin/can.rs
+++ b/examples/stm32f4/src/bin/can.rs
@@ -8,7 +8,7 @@
8mod example_common; 8mod example_common;
9 9
10use cortex_m_rt::entry; 10use cortex_m_rt::entry;
11use embassy_stm32::bxcan::{Can, Frame, StandardId}; 11use embassy_stm32::can::{Can, Frame, StandardId};
12use embassy_stm32::dbgmcu::Dbgmcu; 12use embassy_stm32::dbgmcu::Dbgmcu;
13use example_common::*; 13use example_common::*;
14 14