-
Notifications
You must be signed in to change notification settings - Fork 108
Stm32l412/Stm32l422 PAC specialisation #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
As a side note: The RTC differences are laid out in AN4759 (L41/2 and L4P/Q products are based on the RTC3 model, otherwise RTC2 model). There's more than a few series specific bits laid out in the feature tables, but there is potential for a single RTC interface crate for all STM32 HAL crates to be extracted here |
Moved all of the conditionals behind a trait with a conditional impl. The trait isn't exactly neccesary here (could just be Easy enough to change if required, opinions on this structure definitely wanted |
I think this can be closed now? |
Pretty sure the RTC changes here weren't in the merged PR (L41/2 and L4P/Q have a different RTC peripheral, reference table 3 of AN4759). Will clean this up for the weekend |
use correct PAC for stm32l412
update feature gates
# Conflicts: # src/rtc.rs
…ude L4P/L4Q anywhere yet
# Conflicts: # src/rtc.rs
Rebased. Dropped the traits and just have rtc2/rtc3 modules RTC3 backup registers are a bit of an issue. I don't see them in the PAC (reference manual has the under a TAMP peripheral). The related functions are no-ops in the rtc3 module for now |
#29
based on #261 for device feature gating. Almost all of the changes for this PR are in
rtc.rs
Modifications derived from RM0394 Rev4 section 34.x and stm32l4xx_hal_driver v1.13.0
Feedback welcome on the approach taken here
STM32L4 PAC provides a specialised L412 register map which failed to compile with the current code due to differences in the RTC interrupt status handling. This modifies the RTC functions to conditionally modify the RTC register interactions when the L412 or L422 features are set
Questions:
RTC::check_interrupt
is probably the worst example here with only the EXTI interactions being shared, but even in the basic cases (i.e. single line differences), things could get much messier if more than two options were involved (no#elif
/else
really doesn't help clarity here). I dont see many previous examples of conditional code (and nothing complex), so I was wondering if there was a standard style that is recommended for this sort of thingNote: I do not have an L412/L422 which I can use to verify these changes. The RTC wakeup timer and alarms are the most affected by this so this example would be a decent start at verification
Note2: this is not a complete addition of L41/L42 features, just those that are required for currently implemented functionality to compile with the updated PAC. This does nothing about the peripheral gating as mentioned here