stm32f1xx-hal
stm32f1xx-hal copied to clipboard
Rcc improvement
Sorry. @burrbull, please explain why "impairment"?
Because I don't see any "improvement".
- If you delete
RCCdependency, you need markenable&resetwithunsafe - What sense of
&selfrequirement? (not sure about this) steal(). Again.
@burrbull
- What is the reason
unsafe? I think that after switching to using bit-banding, the need for&rccdisappeared. &selfis needed so that only the owner of the corresponding peripheral can doenableandresetfor it. This will help to avoid mistakes like this:
pub fn initialize(
...
tim2: pac::TIM2,
...
) -> Self {
...
let rcc = unsafe { &(*pac::RCC::PTR) };
pac::TIM1::enable(rcc);
pac::TIM1::reset(rcc);
...
}
- A temporary way out of the situation. In the future, it is necessary to make a similar change in the
stm32-usbdcreate:Usb Peripheral::enable()->UsbPeripheral::enable(&self). Issteal()acceptable here https://github.com/stm32-rs/stm32f3xx-hal/blob/565b43ceab7b8255c122e82f4f1f1f2b3e85f11b/src/serial.rs#L1270 ? I believe that usingsteal()in certain situations is quite acceptable.
Please review and merge.
@burrbull Do you agree with the changes?
@therealprof, @TheZoq2 Please review