-
Notifications
You must be signed in to change notification settings - Fork 214
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
RCC.constrain eats the RCC #119
Comments
Yes, the register is moved into the the |
See this blog post by @japaric for more info about how and why: https://blog.japaric.io/brave-new-io/#freezing-the-clock-configuration |
I agree with the principle, but not all the peripherals are there. When I made this issue, I had a need of turning the CAN clock on. When all the options are accounted for, then it's a great idea! Also, something else to consider: |
I share the same situation as you; in my case I’m working on enabling the I2S clocks for a HAL proposal. My current experimentation with this crate is similar to a combination of how the peripheral clocks and 48MHz (USB I think) clock is configured. I have added a function called |
I have the same difficulties as the @diondokter. I need to enable RTC, but "RTC.constrains" eats the register. |
@muttering-oldman note that you can always bypass the HAL by using e.g. |
Thank you @birkenfeld. |
In the STM32H7xx-hal, we get around this by having the RCC constrain function return a PREC structure, which essentially provides a proxy into the RCC to enable and reset various peripherals. Reference code: https://github.com/stm32-rs/stm32h7xx-hal/blob/master/src/rcc/rec.rs |
I agree that having some proxy is probably the way to go. |
When calling the constrain function on the RCC, it eats the register. This is highly inconvenient as I want to later enable and disable different peripheral clocks and can't access the register. Now I need to resort to getting the register unsafely which I want to minimize.
Please consider to either give it back when freeze is called or implement the turning on and off of peripheral clocks in the Rcc type.
The text was updated successfully, but these errors were encountered: