added blocking delay functions

- DelayUs and DelayMs trait implementations for CountDown timer
  peripherals
- Bugfix for wait function
This commit is contained in:
2021-11-17 10:34:55 +01:00
parent 030b555a7f
commit 2a9225fda5
5 changed files with 203 additions and 20 deletions
+2 -7
View File
@@ -12,7 +12,7 @@ use va108xx_hal::{
pac::{self, interrupt},
prelude::*,
time::Hertz,
timer::{set_up_ms_timer, CountDownTimer, Event},
timer::{default_ms_irq_handler, set_up_ms_timer, CountDownTimer, Event, MS_COUNTER},
};
#[allow(dead_code)]
@@ -21,7 +21,6 @@ enum LibType {
Hal,
}
static MS_COUNTER: Mutex<Cell<u32>> = Mutex::new(Cell::new(0));
static SEC_COUNTER: Mutex<Cell<u32>> = Mutex::new(Cell::new(0));
#[entry]
@@ -105,11 +104,7 @@ fn unmask_irqs() {
#[interrupt]
fn OC0() {
cortex_m::interrupt::free(|cs| {
let mut ms = MS_COUNTER.borrow(cs).get();
ms += 1;
MS_COUNTER.borrow(cs).set(ms);
});
default_ms_irq_handler()
}
#[interrupt]