bl602-rust-guide
bl602-rust-guide copied to clipboard
Update examples to initialize sys_clk/uart_clk using clock::Strict
This is bringing in the minimum amount of changes require for main and examples to work with the new clock code in the HAL. The UART example needed a few more modifications than the others, since it was using GLB registers to configure UART clk_en and clk_div
I don't think it's great practice to use use some::path::*; outside of the prelude module.
I'd rather have this:
use bl602_hal::clock::{self, SysclkFreq, UART_PLL_FREQ};
use bl602_hal::{pac, prelude::*};
and later:
let clocks = clock::Strict::new() …
~Also, when running the bl602-serial example I'm no longer getting an output on the TX0 pin.~ Something's up with my setup, now I'm not even able to get it to output data with an older revision.
...
Ok, I've confirmed that it's only this change that breaks the output. I couldn't get output on older revisions before because I had to reset the device for the old code to work again.
I've cleaned up the imports as per your suggestion, looks much better. Any further blockers on getting this merged?