diff options
Diffstat (limited to 'src/arch/stm32f446re-nucleo/driver')
-rw-r--r-- | src/arch/stm32f446re-nucleo/driver/counter.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/arch/stm32f446re-nucleo/driver/counter.cc b/src/arch/stm32f446re-nucleo/driver/counter.cc new file mode 100644 index 0000000..dfd22e3 --- /dev/null +++ b/src/arch/stm32f446re-nucleo/driver/counter.cc @@ -0,0 +1,14 @@ +#include "arch.h" +#include "driver/counter.h" + +Counter counter; + +void tim2_isr(void) +{ + if (timer_get_flag(TIM2, TIM_SR_UIF)) { + timer_clear_flag(TIM2, TIM_SR_UIF); + if (counter.overflow < 4294967295) { + counter.overflow++; + } + } +} |