diff options
author | Joel Challis <git@zvecr.com> | 2021-10-22 00:49:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-22 00:49:38 +0100 |
commit | 1b1f3ec68ee1e7abe436a46bcfedf30f21330aef (patch) | |
tree | bbb7e0dd548773b6c1ead6275a4bafc1910c444a /tmk_core/common/arm_atsam | |
parent | 1b93d576f84822d0f4947179ee49f614ba345f12 (diff) |
Split out arm_atsam shift register logic (#14848)
Diffstat (limited to 'tmk_core/common/arm_atsam')
-rw-r--r-- | tmk_core/common/arm_atsam/gpio.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tmk_core/common/arm_atsam/gpio.h b/tmk_core/common/arm_atsam/gpio.h index c2d5a30889..915ed0ef4f 100644 --- a/tmk_core/common/arm_atsam/gpio.h +++ b/tmk_core/common/arm_atsam/gpio.h @@ -64,7 +64,13 @@ typedef uint8_t pin_t; PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \ } while (0) -#define writePin(pin, level) ((level) ? (writePinHigh(pin)) : (writePinLow(pin))) +#define writePin(pin, level) \ + do { \ + if (level) \ + PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \ + else \ + PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \ + } while (0) #define readPin(pin) ((PORT->Group[SAMD_PORT(pin)].IN.reg & SAMD_PIN_MASK(pin)) != 0) |