aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-03-12 12:15:49 -0400
committerKevinOConnor <kevin@koconnor.net>2019-03-17 19:38:18 -0400
commit8b0195f896aaabbef8d79b8b0239df67b49184c5 (patch)
tree7904cc6b099f9c0ab4cf0a584cff112ede6e6f95 /src
parent8f541d090ed6c21e2487047df97a46f98a93a941 (diff)
downloadkutter-8b0195f896aaabbef8d79b8b0239df67b49184c5.tar.gz
kutter-8b0195f896aaabbef8d79b8b0239df67b49184c5.tar.xz
kutter-8b0195f896aaabbef8d79b8b0239df67b49184c5.zip
atsam: Use enumerations for pin mappings
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r--src/atsam/gpio.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/atsam/gpio.c b/src/atsam/gpio.c
index 768a3949..2af2bfc0 100644
--- a/src/atsam/gpio.c
+++ b/src/atsam/gpio.c
@@ -11,15 +11,28 @@
#include "internal.h" // gpio_peripheral
#include "sched.h" // sched_shutdown
+DECL_ENUMERATION_RANGE("pin", "PA0", GPIO('A', 0), 32);
+DECL_ENUMERATION_RANGE("pin", "PB0", GPIO('B', 0), 32);
+#ifdef PIOC
+DECL_ENUMERATION_RANGE("pin", "PC0", GPIO('C', 0), 32);
+#endif
+#ifdef PIOD
+DECL_ENUMERATION_RANGE("pin", "PD0", GPIO('D', 0), 32);
+#endif
+#ifdef PIOE
+DECL_ENUMERATION_RANGE("pin", "PE0", GPIO('E', 0), 32);
+#endif
+
static Pio * const digital_regs[] = {
-#if CONFIG_MACH_SAM3X8E
- PIOA, PIOB, PIOC, PIOD
-#elif CONFIG_MACH_SAM3X8C
- PIOA, PIOB
-#elif CONFIG_MACH_SAM4S8C
- PIOA, PIOB, PIOC
-#elif CONFIG_MACH_SAM4E8E
- PIOA, PIOB, PIOC, PIOD, PIOE
+ PIOA, PIOB,
+#ifdef PIOC
+ PIOC,
+#endif
+#ifdef PIOD
+ PIOD,
+#endif
+#ifdef PIOE
+ PIOE,
#endif
};