diff options
-rw-r--r-- | platforms/chibios/gpio.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/platforms/chibios/gpio.h b/platforms/chibios/gpio.h index eb44a18f9c..80551abac5 100644 --- a/platforms/chibios/gpio.h +++ b/platforms/chibios/gpio.h @@ -31,7 +31,14 @@ typedef ioline_t pin_t; #define writePinHigh(pin) palSetLine(pin) #define writePinLow(pin) palClearLine(pin) -#define writePin(pin, level) ((level) ? (writePinHigh(pin)) : (writePinLow(pin))) +#define writePin(pin, level) \ + do { \ + if (level) { \ + writePinHigh(pin); \ + } else { \ + writePinLow(pin); \ + } \ + } while (0) #define readPin(pin) palReadLine(pin) |