-
Notifications
You must be signed in to change notification settings - Fork 843
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
STM32: combine RccPeripherals reset() and enable() to enable_and_reset() #2035
Conversation
The DAC peripheral has also shared RCC bits for DAC1 und DAC2 in some h7 controllers. |
Thanks for the PR! The code should first enable the peripherals then reset them. Reset requires the clocks to be running, otherwise peripheral state can't change. Could you change that, and rename the function?
the data comes from stm32-data. see here, DAC1 is missing the The code that does the matching is here. There's exceptions hardcoded for ADC, seems DAC needs some too. (if you want to merge this PR now and fix that later that's fine, this is already a big improvement even if it doesn't fix everything. Up to you!) |
Done. It's probably better to assume the reset is synchronous. It's a pity that st is not able to define this. I'll have a look into the DAC topic, but we should split it into a dedicated PR. |
@@ -531,10 +531,13 @@ pub struct SubBlock<'d, T: Instance, C: Channel, W: word::Word> { | |||
pub struct SubBlockA {} | |||
pub struct SubBlockB {} | |||
|
|||
pub struct SubBlockAPeripheral<'d, T>(PeripheralRef<'d, T>); |
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 take these unrelated changes out? thanks!
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.
This aren't unrelated changes.
While the SAI is only one Peripheral Block, it contains two complety independent subblocks.
Currently it is possible to create a subblock directly, or frist create a SAI peripheral, which just copies the PeripheralRef, so we can initalise both subblocks.
Question, where do we call enable_and_reset()?
This changes force the user to create a SAI first, which enables clock and reset, and then use the take_sub_block to get a SubBlockXPeripheral to initalise the Subblock
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.
Or in other words: For some Reason ST did not create a SAI1 and SAI2 Peripheral, but only SAI1 which actually contains two independet Peripherals.
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.
ahh got it, makes sense, thank you!
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!
Close #2034
Combining the standalone functions
reset()
andenable()
intoenable_and_reset()
.This are a lot of breaking changes, maybe we should add
reset_and_enable()
, but keepenable()
andreset()
.And port only the obvious usages.
I'm not able to test everything on real hardware.