ch32-rs / ch32-hal

A Rust HAL implementation for the CH32V0, CH32V1, CH32V2, CH32V3, CH32X0, CH32L1 family, with Embassy framework support and compatible with embedded-hal.
Apache License 2.0
58 stars 13 forks source link

Add Delay implementation for qingke v4 #27

Open romainreignier opened 2 months ago

romainreignier commented 2 months ago

I have made a draft PR on ch32-hal-template https://github.com/ch32-rs/ch32-hal-template/pull/1 to add the option to not use embassy on the generated template but we would need a Delay implementation for qingke v4.

One could use this:

qingke::riscv::asm::delay(10_000_000);

for a template for beginners, I find that a real delay in milliseconds is easier to use.

andelf commented 2 months ago

Agreed. A delay implementation is necessary when embassy is not enabled.

WCH's MCU is slow when running on FLASH. So the delay might be incorrect due to flash latency.