-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add function to allow re-init rcc config for stm32 #4124
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
Build fail due to the critical section variable is not used in (I assume here) som configurations. Not sure of a good way to handle this I could rename the variable _cs or I could split the code but since it is a closure it is hard to add feature toggles on it... |
Thanks!
|
embassy-stm32/src/lib.rs
Outdated
/// | ||
/// This should only be called after `init`. | ||
#[cfg(not(feature = "_dual-core"))] | ||
pub fn reinit(config: rcc::Config) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you move this to the RCC module so it's called as embassy_stm32::rcc:reinit()
as I said in my last comment and not embassy_stm32::reinit()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I did not see the rcc, please beware that we now have two rcc::init*
functions which is somewhat awkward.
Also not 100% sure if the crate::time_driver::init(_cs)
should also be moved but given your feedback I assume this is what we want.
One option for the two rcc:init
function would be to wrap the old rcc::init
inside the new rcc::init_rcc
but unsure if this is what we want. I.e. rename or private the existing init and rename the init_rcc
function to init
.
Feel free to send me a message on matrix (Michael Medin, @mickem:matrix.org) if you want to discuss options here.
…wo init functions in rcc: `rcc::init`and `rcc::init_rcc`)
bender run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
I had a need to configure an external clock generator and then switch to it which means I needed to call init and then configure RCC.
After som input from the matrix chat this is what I came up with.
Not sure if this makes sense, and I did not find any test so I have not added tests.
Might make sense to add an example but as a meaningful example would require a specific external clock generator I am unsure how to proceed but it would be possible to add: