aboutsummaryrefslogtreecommitdiffstats
path: root/src/samd21/internal.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-11-26 22:18:51 -0500
committerKevin O'Connor <kevin@koconnor.net>2018-11-30 11:50:50 -0500
commit6d90ebe6f8c2aa9071ba524063e89ceb164037eb (patch)
tree35222216c94d61e7b7a8735285343b5deeb907f0 /src/samd21/internal.h
parent0af0bc946e174e2726218aa2ec81a75331aa2644 (diff)
downloadkutter-6d90ebe6f8c2aa9071ba524063e89ceb164037eb.tar.gz
kutter-6d90ebe6f8c2aa9071ba524063e89ceb164037eb.tar.xz
kutter-6d90ebe6f8c2aa9071ba524063e89ceb164037eb.zip
samd21: Use GPIO() macro when calling gpio_peripheral()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/samd21/internal.h')
-rw-r--r--src/samd21/internal.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/samd21/internal.h b/src/samd21/internal.h
index 34c74815..b03fae30 100644
--- a/src/samd21/internal.h
+++ b/src/samd21/internal.h
@@ -4,7 +4,11 @@
#include <stdint.h> // uint32_t
+#define GPIO(PORT, NUM) (((PORT)-'A') * 32 + (NUM))
+#define GPIO2PORT(PIN) ((PIN) / 32)
+#define GPIO2BIT(PIN) (1<<((PIN) % 32))
+
void enable_pclock(uint32_t clock_id, uint32_t pmask);
-void gpio_peripheral(char bank, uint32_t bit, char ptype, uint32_t pull_up);
+void gpio_peripheral(uint32_t gpio, char ptype, uint32_t pull_up);
#endif // internal.h