aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-10-22 00:49:38 +0100
committerGitHub <noreply@github.com>2021-10-22 00:49:38 +0100
commit1b1f3ec68ee1e7abe436a46bcfedf30f21330aef (patch)
treebbb7e0dd548773b6c1ead6275a4bafc1910c444a /tmk_core/common
parent1b93d576f84822d0f4947179ee49f614ba345f12 (diff)
downloadqmk_firmware-1b1f3ec68ee1e7abe436a46bcfedf30f21330aef.tar.gz
qmk_firmware-1b1f3ec68ee1e7abe436a46bcfedf30f21330aef.zip
Split out arm_atsam shift register logic (#14848)
Diffstat (limited to 'tmk_core/common')
-rw-r--r--tmk_core/common/arm_atsam/gpio.h8
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 c2d5a3088..915ed0ef4 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;
64 PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \ 64 PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
65 } while (0) 65 } while (0)
66 66
67#define writePin(pin, level) ((level) ? (writePinHigh(pin)) : (writePinLow(pin))) 67#define writePin(pin, level) \
68 do { \
69 if (level) \
70 PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \
71 else \
72 PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \
73 } while (0)
68 74
69#define readPin(pin) ((PORT->Group[SAMD_PORT(pin)].IN.reg & SAMD_PIN_MASK(pin)) != 0) 75#define readPin(pin) ((PORT->Group[SAMD_PORT(pin)].IN.reg & SAMD_PIN_MASK(pin)) != 0)
70 76