diff --git a/main.c b/main.c index 491cd90..f198995 100644 --- a/main.c +++ b/main.c @@ -95,12 +95,9 @@ void exti0_isr (void) { // NB: For some reason it is at the begining in the examples // It needs to be here (possibly because of reordering, when this was at the end, I usually got the interrupt twice). - if (!running) { - direction = FORWARD; - } else { - direction = direction == FORWARD ? BACKWARD : FORWARD; - } - running = true; + // Toggle TIM6 in order to disable blinking + // Code inspired by libopencm3 source, since we cannot read the status otherwise… + TIM_CR1(TIM6) ^= TIM_CR1_CEN; } void tim6_isr (void) {