diff options
author | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-02-21 14:50:06 +0100 |
---|---|---|
committer | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-02-21 14:50:06 +0100 |
commit | 02168c8615b38b24030018b8e678fde18f391228 (patch) | |
tree | 56f6ee97360778ac55fc426171309dd6d68c8afe | |
parent | 8d38d364a09d9e5f01e0adbea5d5ecd5b87bc9e1 (diff) |
stm32f7: slightly un-break delay_us and delay_ms
-rw-r--r-- | src/arch/stm32f746zg-nucleo/arch.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/arch/stm32f746zg-nucleo/arch.cc b/src/arch/stm32f746zg-nucleo/arch.cc index 443a2cf..5f9b53b 100644 --- a/src/arch/stm32f746zg-nucleo/arch.cc +++ b/src/arch/stm32f746zg-nucleo/arch.cc @@ -64,19 +64,21 @@ extern void loop(); volatile char run_loop = 0; #endif -// for 216 MHz(?) +static volatile int delay_counter; +// horribly broken void Arch::delay_us(unsigned int const us) { - volatile int x = us * 145; - while (x--) { + delay_counter = us * 37; + while (delay_counter--) { __asm("nop"); } } +// horribly broken void Arch::delay_ms(unsigned int const ms) { for (unsigned int i = 0; i < ms; i++) { - volatile int x = 143990; - while (x--) { + delay_counter = 36364; + while (delay_counter--) { __asm("nop"); } } |