diff options
author | Stefan Kerkmann <karlk90@pm.me> | 2022-03-28 00:07:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-27 15:07:25 -0700 |
commit | 119abc4375ba0cbeecb5c0394342c0260c999fba (patch) | |
tree | f88dc133181875971d1eac63bc482cf93bf4dd34 /platforms | |
parent | 03f9b8db15f0ae51806734d48212b4088ffe6632 (diff) |
Refactor writePin to work with statements (#16738)
Diffstat (limited to 'platforms')
-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) |