atsam: Use enumerations for pin mappings

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-03-12 12:15:49 -04:00 committed by KevinOConnor
parent 8f541d090e
commit 8b0195f896
2 changed files with 21 additions and 10 deletions

View File

@ -38,8 +38,6 @@ def beaglebone_pins():
return gpios
MCU_PINS = {
"sam3x8e": port_pins(4, 32), "sam3x8c": port_pins(2, 32),
"sam4s8c": port_pins(3, 32), "sam4e8e" : port_pins(5, 32),
"samd21g18a": port_pins(2, 32), "samd21e18a": port_pins(2, 32),
"samd51g19a": port_pins(2, 32), "samd51j19a": port_pins(3, 32),
"samd51n19a": port_pins(3, 32), "samd51p20a": port_pins(4, 32),

View File

@ -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
};