diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2020-08-12 14:23:36 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2020-08-12 14:23:36 +0200 |
commit | 129b53ec9fc934a5cd66ab9ad25c81e058264321 (patch) | |
tree | 313879089dde7d147a3a0a64bf36ff80c0f33d56 /src/arch/stm32f446re-nucleo/driver | |
parent | 23f7b0e4ed05685e89c5c1d8d92556106b0845ff (diff) |
stm32f446re: Add counter
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++; + } + } +} |