diff options
Diffstat (limited to 'src/arch/stm32f746zg-nucleo/driver/counter.cc')
-rw-r--r-- | src/arch/stm32f746zg-nucleo/driver/counter.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/arch/stm32f746zg-nucleo/driver/counter.cc b/src/arch/stm32f746zg-nucleo/driver/counter.cc new file mode 100644 index 0000000..5f007f1 --- /dev/null +++ b/src/arch/stm32f746zg-nucleo/driver/counter.cc @@ -0,0 +1,19 @@ +/* + * Copyright 2024 Birte Kristina Friesel + * + * SPDX-License-Identifier: BSD-2-Clause + */ +#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++; + } + } +} |