From 1f2662518bf01e558e444d3f02896fe477a9136e Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sat, 28 Aug 2021 18:10:50 +0200 Subject: [PATCH] Fix gpio::TogglePin on AVR TogglePin was incorrectly using the PINx pin for toggling, causing the current pins (in addition to the requested ones) to be toggled, causing stepping havoc. --- src/hal/gpio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hal/gpio.h b/src/hal/gpio.h index b7bc385..f58f518 100644 --- a/src/hal/gpio.h +++ b/src/hal/gpio.h @@ -70,7 +70,7 @@ __attribute__((always_inline)) inline Level ReadPin(const GPIO_pin portPin) { __attribute__((always_inline)) inline void TogglePin(const GPIO_pin portPin) { #ifdef __AVR__ // Optimized path for AVR, resulting in a pin toggle - portPin.port->PINx |= (1 << portPin.pin); + portPin.port->PINx = (1 << portPin.pin); #else WritePin(portPin, (Level)(ReadPin(portPin) != Level::high)); #endif