Skip to content

Commit 99e9e71

Browse files
committed
remove interrupt state caching that is not required by RM, don't include L4P/L4Q anywhere yet
1 parent 0ce5d07 commit 99e9e71

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ pub use stm32l4;
6464
#[cfg(feature = "private_line_stm32l4x1")]
6565
pub use stm32l4::stm32l4x1 as pac;
6666

67-
#[cfg(any(feature = "stm32l412", feature = "stm32l422"))]
67+
#[cfg(all(
68+
feature = "private_product_L41_L42",
69+
feature = "private_line_stm32l4x2"
70+
))]
6871
pub use stm32l4::stm32l412 as pac; // L412 doesn't use the generic L4x2 PAC defines
6972
#[cfg(all(
7073
feature = "private_line_stm32l4x2",
71-
not(feature = "stm32l412"),
72-
not(feature = "stm32l422")
74+
not(feature = "private_product_L41_L42"),
7375
))]
7476
pub use stm32l4::stm32l4x2 as pac; // Generic L4x2 PAC
7577

src/rtc.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,20 +219,18 @@ impl Rtc {
219219
// HAL_RTC_SetAlarm_IT[L1921-L2098]
220220
self.write(false, |rtc| match alarm {
221221
Alarm::AlarmA => {
222-
let interrupt_enabled = rtc.cr.read().alraie().bit(); // cache interrupt state
223-
rtc.cr
224-
.modify(|_, w| w.alrae().clear_bit().alraie().clear_bit()); // Disable the Alarm A interrupt
222+
rtc.cr.modify(|_, w| w.alrae().clear_bit()); // Disable the Alarm A interrupt
225223
#[cfg(any(
226224
feature = "private_product_L41_L42",
227-
feature = "private_product_L4P_L4Q"
225+
//feature = "private_product_L4P_L4Q"
228226
))]
229227
{
230228
rtc.scr.write(|w| w.calraf().set_bit());
231229
// no waiting
232230
}
233231
#[cfg(not(any(
234232
feature = "private_product_L41_L42",
235-
feature = "private_product_L4P_L4Q"
233+
//feature = "private_product_L4P_L4Q"
236234
)))]
237235
{
238236
rtc.isr.modify(|_, w| w.alraf().clear_bit());
@@ -268,25 +266,22 @@ impl Rtc {
268266
// write the SS value and mask to `rtc.alrmassr`
269267

270268
// enable alarm and reenable interrupt if it was enabled
271-
rtc.cr
272-
.modify(|_, w| w.alrae().set_bit().alraie().bit(interrupt_enabled));
269+
rtc.cr.modify(|_, w| w.alrae().set_bit());
273270
}
274271
Alarm::AlarmB => {
275-
let interrupt_enabled = rtc.cr.read().alrbie().bit(); // cache interrupt state
276-
rtc.cr
277-
.modify(|_, w| w.alrbe().clear_bit().alraie().clear_bit());
272+
rtc.cr.modify(|_, w| w.alrbe().clear_bit());
278273

279274
#[cfg(any(
280275
feature = "private_product_L41_L42",
281-
feature = "private_product_L4P_L4Q"
276+
// feature = "private_product_L4P_L4Q"
282277
))]
283278
{
284279
rtc.scr.write(|w| w.calrbf().set_bit());
285280
// no waiting
286281
}
287282
#[cfg(not(any(
288283
feature = "private_product_L41_L42",
289-
feature = "private_product_L4P_L4Q"
284+
// feature = "private_product_L4P_L4Q"
290285
)))]
291286
{
292287
rtc.isr.modify(|_, w| w.alrbf().clear_bit());
@@ -322,8 +317,7 @@ impl Rtc {
322317
// write the SS value and mask to `rtc.alrmassr`
323318

324319
// enable alarm and reenable interrupt if it was enabled
325-
rtc.cr
326-
.modify(|_, w| w.alrbe().set_bit().alrbie().bit(interrupt_enabled));
320+
rtc.cr.modify(|_, w| w.alrbe().set_bit());
327321
}
328322
});
329323
}

0 commit comments

Comments
 (0)