aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-08-27 15:18:34 -0500
committerxoviat <[email protected]>2023-08-27 15:18:34 -0500
commitcbc92dce052060bb15b82921c0a05c3a81d6dcc9 (patch)
tree4a36089d72c457138707cc8db95b94f1594d3e94
parent531f51d0eb66af9b681b49c10e28ef25e88bbcc2 (diff)
stm32/bd: fix errors
-rw-r--r--embassy-stm32/src/rcc/bd.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/embassy-stm32/src/rcc/bd.rs b/embassy-stm32/src/rcc/bd.rs
index d56bc0330..0fc116ed8 100644
--- a/embassy-stm32/src/rcc/bd.rs
+++ b/embassy-stm32/src/rcc/bd.rs
@@ -12,10 +12,12 @@ pub enum RtcClockSource {
12 HSE = 0b11, 12 HSE = 0b11,
13} 13}
14 14
15#[cfg(not(any(rtc_v2l0, rtc_v2l1)))] 15#[cfg(not(any(rtc_v2l0, rtc_v2l1, stm32c0)))]
16#[allow(dead_code)]
16type Bdcr = crate::pac::rcc::regs::Bdcr; 17type Bdcr = crate::pac::rcc::regs::Bdcr;
17 18
18#[cfg(any(rtc_v2l0, rtc_v2l1))] 19#[cfg(any(rtc_v2l0, rtc_v2l1))]
20#[allow(dead_code)]
19type Bdcr = crate::pac::rcc::regs::Csr; 21type Bdcr = crate::pac::rcc::regs::Csr;
20 22
21#[allow(dead_code)] 23#[allow(dead_code)]
@@ -26,7 +28,7 @@ impl BackupDomain {
26 rtc_v2f0, rtc_v2f2, rtc_v2f3, rtc_v2f4, rtc_v2f7, rtc_v2h7, rtc_v2l0, rtc_v2l1, rtc_v2l4, rtc_v2wb, rtc_v3, 28 rtc_v2f0, rtc_v2f2, rtc_v2f3, rtc_v2f4, rtc_v2f7, rtc_v2h7, rtc_v2l0, rtc_v2l1, rtc_v2l4, rtc_v2wb, rtc_v3,
27 rtc_v3u5 29 rtc_v3u5
28 ))] 30 ))]
29 #[allow(dead_code)] 31 #[allow(dead_code, unused_variables)]
30 fn modify<R>(f: impl FnOnce(&mut Bdcr) -> R) -> R { 32 fn modify<R>(f: impl FnOnce(&mut Bdcr) -> R) -> R {
31 #[cfg(any(rtc_v2f2, rtc_v2f3, rtc_v2l1))] 33 #[cfg(any(rtc_v2f2, rtc_v2f3, rtc_v2l1))]
32 let cr = crate::pac::PWR.cr(); 34 let cr = crate::pac::PWR.cr();
@@ -40,7 +42,13 @@ impl BackupDomain {
40 while !cr.read().dbp() {} 42 while !cr.read().dbp() {}
41 } 43 }
42 44
43 crate::pac::RCC.bdcr().modify(|w| f(w)) 45 #[cfg(any(rtc_v2l0, rtc_v2l1))]
46 let cr = crate::pac::RCC.csr();
47
48 #[cfg(not(any(rtc_v2l0, rtc_v2l1)))]
49 let cr = crate::pac::RCC.bdcr();
50
51 cr.modify(|w| f(w))
44 } 52 }
45 53
46 #[cfg(any( 54 #[cfg(any(
@@ -62,7 +70,7 @@ impl BackupDomain {
62 rtc_v2f0, rtc_v2f2, rtc_v2f3, rtc_v2f4, rtc_v2f7, rtc_v2h7, rtc_v2l0, rtc_v2l1, rtc_v2l4, rtc_v2wb, rtc_v3, 70 rtc_v2f0, rtc_v2f2, rtc_v2f3, rtc_v2f4, rtc_v2f7, rtc_v2h7, rtc_v2l0, rtc_v2l1, rtc_v2l4, rtc_v2wb, rtc_v3,
63 rtc_v3u5 71 rtc_v3u5
64 ))] 72 ))]
65 #[allow(dead_code)] 73 #[allow(dead_code, unused_variables)]
66 pub fn set_rtc_clock_source(clock_source: RtcClockSource) { 74 pub fn set_rtc_clock_source(clock_source: RtcClockSource) {
67 let clock_source = clock_source as u8; 75 let clock_source = clock_source as u8;
68 #[cfg(any( 76 #[cfg(any(