Skip to content

Commit

Permalink
Refactor writePin to work with statements (qmk#16738)
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlK90 authored and zykrah committed Jul 2, 2022
1 parent 4061213 commit e209e55
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion platforms/chibios/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit e209e55

Please sign in to comment.