Implement Deref and DerefMut for Rcc #188
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cordoning off access to RCC registers makes implementing certain software and drivers (e.g. a bootloader for STMF0 cores need SYSCFG) unnecessarily difficult.
A completely encapsulated RCC renders peripheral enable registers inaccessible and some drivers (e.g stm32_usbd) opt for using unsafe raw pointer accesses completely eliminating the safety and the structure provided by the HAL.
This commit copies an escape hatch from stm32f4xx-hal crate by implementing Deref and DerefMut for Rcc structure. The stm32f4xx-hal implementation can be seen at the link below: https://github.com/stm32-rs/stm32f4xx-hal/blob/0ba01f4fb3f19b0eea40d8ea2403e2e9d4e41609/src/rcc/mod.rs#L56-L67