1
0
Fork 0

Update naming convention for GPIO control macros (#23085)

This commit is contained in:
Ryan 2024-02-17 00:18:26 +11:00 committed by GitHub
parent 6890c1aeb8
commit b8646bc40b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 100 additions and 83 deletions

View file

@ -22,24 +22,24 @@ typedef ioline_t pin_t;
/* Operation of GPIO by pin. */
#define setPinInput(pin) palSetLineMode((pin), PAL_MODE_INPUT)
#define setPinInputHigh(pin) palSetLineMode((pin), PAL_MODE_INPUT_PULLUP)
#define setPinInputLow(pin) palSetLineMode((pin), PAL_MODE_INPUT_PULLDOWN)
#define setPinOutputPushPull(pin) palSetLineMode((pin), PAL_MODE_OUTPUT_PUSHPULL)
#define setPinOutputOpenDrain(pin) palSetLineMode((pin), PAL_MODE_OUTPUT_OPENDRAIN)
#define setPinOutput(pin) setPinOutputPushPull(pin)
#define gpio_set_pin_input(pin) palSetLineMode((pin), PAL_MODE_INPUT)
#define gpio_set_pin_input_high(pin) palSetLineMode((pin), PAL_MODE_INPUT_PULLUP)
#define gpio_set_pin_input_low(pin) palSetLineMode((pin), PAL_MODE_INPUT_PULLDOWN)
#define gpio_set_pin_output_push_pull(pin) palSetLineMode((pin), PAL_MODE_OUTPUT_PUSHPULL)
#define gpio_set_pin_output_open_drain(pin) palSetLineMode((pin), PAL_MODE_OUTPUT_OPENDRAIN)
#define gpio_set_pin_output(pin) gpio_set_pin_output_push_pull(pin)
#define writePinHigh(pin) palSetLine(pin)
#define writePinLow(pin) palClearLine(pin)
#define writePin(pin, level) \
do { \
if (level) { \
writePinHigh(pin); \
} else { \
writePinLow(pin); \
} \
#define gpio_write_pin_high(pin) palSetLine(pin)
#define gpio_write_pin_low(pin) palClearLine(pin)
#define gpio_write_pin(pin, level) \
do { \
if (level) { \
gpio_write_pin_high(pin); \
} else { \
gpio_write_pin_low(pin); \
} \
} while (0)
#define readPin(pin) palReadLine(pin)
#define gpio_read_pin(pin) palReadLine(pin)
#define togglePin(pin) palToggleLine(pin)
#define gpio_toggle_pin(pin) palToggleLine(pin)