From 99538c2414520dab8c0c2847b1a1f1f777189770 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Mon, 11 May 2020 11:15:02 -0400 Subject: [PATCH 01/13] Implement pin claiming, pin reset, and pin protections --- ports/mimxrt10xx/Makefile | 1 + .../mimxrt10xx/boards/feather_m7_1011/board.c | 18 + .../boards/feather_mimxrt1011/board.c | 18 + .../boards/feather_mimxrt1062/board.c | 23 ++ ports/mimxrt10xx/boards/imxrt1010_evk/board.c | 16 + ports/mimxrt10xx/boards/imxrt1020_evk/board.c | 17 + ports/mimxrt10xx/boards/imxrt1060_evk/board.c | 23 ++ ports/mimxrt10xx/boards/teensy40/board.c | 17 + .../mimxrt10xx/common-hal/analogio/AnalogIn.c | 3 +- .../common-hal/digitalio/DigitalInOut.c | 6 +- .../common-hal/microcontroller/Pin.c | 218 +++------- .../common-hal/microcontroller/Pin.h | 8 +- .../peripherals/mimxrt10xx/MIMXRT1011/pins.c | 134 +++++-- .../peripherals/mimxrt10xx/MIMXRT1011/pins.h | 2 + .../peripherals/mimxrt10xx/MIMXRT1021/pins.c | 282 ++++++++----- .../peripherals/mimxrt10xx/MIMXRT1021/pins.h | 2 + .../peripherals/mimxrt10xx/MIMXRT1062/pins.c | 375 ++++++++++++------ .../peripherals/mimxrt10xx/MIMXRT1062/pins.h | 2 + .../mimxrt10xx/peripherals/mimxrt10xx/pins.h | 12 +- 19 files changed, 742 insertions(+), 435 deletions(-) diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 59b833cc52..9e2c6d236d 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -88,6 +88,7 @@ ifeq ($(DEBUG), 1) # You may want to enable these flags to make setting breakpoints easier. CFLAGS += -fno-inline -fno-ipa-sra else + CFLAGS += -ggdb #CFLAGS += -flto -flto-partition=none endif diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/board.c b/ports/mimxrt10xx/boards/feather_m7_1011/board.c index 52dd498b3f..8763cd5708 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/board.c +++ b/ports/mimxrt10xx/boards/feather_m7_1011/board.c @@ -27,8 +27,26 @@ #include "boards/board.h" #include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" void board_init(void) { + // SWD Pins + common_hal_never_reset_pin(&pin_GPIO_AD_13);//SWDIO + common_hal_never_reset_pin(&pin_GPIO_AD_12);//SWCLK + common_hal_never_reset_pin(&pin_GPIO_AD_09);//SWO + + // FLEX flash + common_hal_never_reset_pin(&pin_GPIO_SD_12); + common_hal_never_reset_pin(&pin_GPIO_SD_11); + common_hal_never_reset_pin(&pin_GPIO_SD_10); + common_hal_never_reset_pin(&pin_GPIO_SD_09); + common_hal_never_reset_pin(&pin_GPIO_SD_08); + common_hal_never_reset_pin(&pin_GPIO_SD_07); + common_hal_never_reset_pin(&pin_GPIO_SD_06); + + // USB Pins + common_hal_never_reset_pin(&pin_GPIO_12); + common_hal_never_reset_pin(&pin_GPIO_13); } bool board_requests_safe_mode(void) { diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c index 52dd498b3f..8763cd5708 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c @@ -27,8 +27,26 @@ #include "boards/board.h" #include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" void board_init(void) { + // SWD Pins + common_hal_never_reset_pin(&pin_GPIO_AD_13);//SWDIO + common_hal_never_reset_pin(&pin_GPIO_AD_12);//SWCLK + common_hal_never_reset_pin(&pin_GPIO_AD_09);//SWO + + // FLEX flash + common_hal_never_reset_pin(&pin_GPIO_SD_12); + common_hal_never_reset_pin(&pin_GPIO_SD_11); + common_hal_never_reset_pin(&pin_GPIO_SD_10); + common_hal_never_reset_pin(&pin_GPIO_SD_09); + common_hal_never_reset_pin(&pin_GPIO_SD_08); + common_hal_never_reset_pin(&pin_GPIO_SD_07); + common_hal_never_reset_pin(&pin_GPIO_SD_06); + + // USB Pins + common_hal_never_reset_pin(&pin_GPIO_12); + common_hal_never_reset_pin(&pin_GPIO_13); } bool board_requests_safe_mode(void) { diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c b/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c index 52dd498b3f..c3895473ef 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c @@ -27,8 +27,31 @@ #include "boards/board.h" #include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" void board_init(void) { + // SWD Pins + common_hal_never_reset_pin(&pin_GPIO_AD_B0_06);//SWDIO + common_hal_never_reset_pin(&pin_GPIO_AD_B0_07);//SWCLK + common_hal_never_reset_pin(&pin_GPIO_AD_B0_10);//SWO + + // FLEX flash + common_hal_never_reset_pin(&pin_GPIO_SD_B1_00); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_01); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_02); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_03); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_04); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_05); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_06); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_07); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_08); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_09); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_10); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); + + // USB Pins + common_hal_never_reset_pin(&pin_GPIO_AD_B0_01); + common_hal_never_reset_pin(&pin_GPIO_AD_B0_03); } bool board_requests_safe_mode(void) { diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c index 52dd498b3f..b94e6055e4 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c @@ -27,8 +27,24 @@ #include "boards/board.h" #include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" void board_init(void) { + // SWD Pins + common_hal_never_reset_pin(&pin_GPIO_AD_13); //SWDIO + common_hal_never_reset_pin(&pin_GPIO_AD_12); //SWCLK + common_hal_never_reset_pin(&pin_GPIO_AD_09); //SWO + // FLEX flash + common_hal_never_reset_pin(&pin_GPIO_SD_12); + common_hal_never_reset_pin(&pin_GPIO_SD_11); + common_hal_never_reset_pin(&pin_GPIO_SD_10); + common_hal_never_reset_pin(&pin_GPIO_SD_09); + common_hal_never_reset_pin(&pin_GPIO_SD_08); + common_hal_never_reset_pin(&pin_GPIO_SD_07); + common_hal_never_reset_pin(&pin_GPIO_SD_06); + // USB Pins + common_hal_never_reset_pin(&pin_GPIO_12); + common_hal_never_reset_pin(&pin_GPIO_13); } bool board_requests_safe_mode(void) { diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c index 52dd498b3f..aaa7b382c0 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c @@ -27,8 +27,25 @@ #include "boards/board.h" #include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" void board_init(void) { + // SWD Pins + common_hal_never_reset_pin(&pin_GPIO_AD_B0_00);//SWDIO + common_hal_never_reset_pin(&pin_GPIO_AD_B0_01);//SWCLK + common_hal_never_reset_pin(&pin_GPIO_AD_B0_04);//SWO + + // FLEX flash + common_hal_never_reset_pin(&pin_GPIO_SD_B1_06); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_07); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_08); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_09); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_10); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); + + // USB Pins + common_hal_never_reset_pin(&pin_GPIO_AD_B1_11); + common_hal_never_reset_pin(&pin_GPIO_AD_B1_12); } bool board_requests_safe_mode(void) { diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c index 52dd498b3f..c3895473ef 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c @@ -27,8 +27,31 @@ #include "boards/board.h" #include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" void board_init(void) { + // SWD Pins + common_hal_never_reset_pin(&pin_GPIO_AD_B0_06);//SWDIO + common_hal_never_reset_pin(&pin_GPIO_AD_B0_07);//SWCLK + common_hal_never_reset_pin(&pin_GPIO_AD_B0_10);//SWO + + // FLEX flash + common_hal_never_reset_pin(&pin_GPIO_SD_B1_00); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_01); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_02); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_03); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_04); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_05); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_06); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_07); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_08); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_09); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_10); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); + + // USB Pins + common_hal_never_reset_pin(&pin_GPIO_AD_B0_01); + common_hal_never_reset_pin(&pin_GPIO_AD_B0_03); } bool board_requests_safe_mode(void) { diff --git a/ports/mimxrt10xx/boards/teensy40/board.c b/ports/mimxrt10xx/boards/teensy40/board.c index 52dd498b3f..a16e901037 100644 --- a/ports/mimxrt10xx/boards/teensy40/board.c +++ b/ports/mimxrt10xx/boards/teensy40/board.c @@ -27,8 +27,25 @@ #include "boards/board.h" #include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" void board_init(void) { + // SWD Pins + common_hal_never_reset_pin(&pin_GPIO_AD_B0_06);//SWDIO + common_hal_never_reset_pin(&pin_GPIO_AD_B0_07);//SWCLK + common_hal_never_reset_pin(&pin_GPIO_AD_B0_10);//SWO + + // FLEX flash + common_hal_never_reset_pin(&pin_GPIO_SD_B1_06); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_07); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_08); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_09); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_10); + common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); + + // USB Pins + common_hal_never_reset_pin(&pin_GPIO_AD_B0_01); + common_hal_never_reset_pin(&pin_GPIO_AD_B0_03); } bool board_requests_safe_mode(void) { diff --git a/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c b/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c index 2cc2681b44..9587eba633 100644 --- a/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c +++ b/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c @@ -26,6 +26,7 @@ */ #include "common-hal/analogio/AnalogIn.h" +#include "shared-bindings/microcontroller/Pin.h" #include @@ -65,7 +66,7 @@ void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) { if (common_hal_analogio_analogin_deinited(self)) { return; } - reset_pin_number(self->pin->number); + common_hal_reset_pin(self->pin); self->pin = NULL; } diff --git a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c index 603515764f..4c2f8c87ee 100644 --- a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c +++ b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c @@ -34,7 +34,7 @@ #include "fsl_gpio.h" -#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/digitalio/DigitalInOut.h" #include "supervisor/shared/translate.h" @@ -74,7 +74,7 @@ digitalinout_result_t common_hal_digitalio_digitalinout_construct( void common_hal_digitalio_digitalinout_never_reset( digitalio_digitalinout_obj_t *self) { - never_reset_pin_number(self->pin->number); + never_reset_pin_number(self->pin->port, self->pin->number); } bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t* self) { @@ -85,7 +85,7 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t* self if (common_hal_digitalio_digitalinout_deinited(self)) { return; } - reset_pin_number(self->pin->number); + common_hal_reset_pin(self->pin); self->pin = NULL; } diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c index 21e61d29d4..0b438144ca 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c @@ -31,170 +31,69 @@ #ifdef MICROPY_HW_NEOPIXEL bool neopixel_in_use; #endif -#ifdef MICROPY_HW_APA102_MOSI -bool apa102_sck_in_use; -bool apa102_mosi_in_use; -#endif -#ifdef SPEAKER_ENABLE_PIN -bool speaker_enable_in_use; -#endif -//TODO +#define GPIO_PORT_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT / 32 + 1) -#define PORT_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT / 32 + 1) - -//STATIC uint32_t never_reset_pins[PORT_COUNT]; +// GPIO ports are 32 pins wide +STATIC uint32_t claimed_pins[GPIO_PORT_COUNT]; //remove? +STATIC uint32_t never_reset_pins[GPIO_PORT_COUNT]; +// There are two numbering systems used here: +// IOMUXC index, used for iterating through pins and accessing reset information, +// and GPIO port and number, used to store claimed and reset tagging. The two number +// systems are not related and one cannot determine the other without a pin object void reset_all_pins(void) { -// uint32_t pin_mask[PORT_COUNT] = PORT_OUT_IMPLEMENTED; - -// // Do not full reset USB lines. -// pin_mask[0] &= ~(PORT_PA24 | PORT_PA25); - -// // Do not reset SWD when a debugger is present. -// if (DSU->STATUSB.bit.DBGPRES == 1) { -// pin_mask[0] &= ~(PORT_PA30 | PORT_PA31); -// } - -// for (uint32_t i = 0; i < PORT_COUNT; i++) { -// pin_mask[i] &= ~never_reset_pins[i]; -// } - -// gpio_set_port_direction(GPIO_PORTA, pin_mask[0] & ~MICROPY_PORT_A, GPIO_DIRECTION_OFF); -// gpio_set_port_direction(GPIO_PORTB, pin_mask[1] & ~MICROPY_PORT_B, GPIO_DIRECTION_OFF); -// #if PORT_BITS > 64 -// gpio_set_port_direction(GPIO_PORTC, pin_mask[2] & ~MICROPY_PORT_C, GPIO_DIRECTION_OFF); -// #endif -// #if PORT_BITS > 96 -// gpio_set_port_direction(GPIO_PORTD, pin_mask[3] & ~MICROPY_PORT_D, GPIO_DIRECTION_OFF); -// #endif -// -// // Configure SWD. SWDIO will be automatically switched on PA31 when a signal is input on -// // SWCLK. -// #ifdef SAMD51 -// gpio_set_pin_function(PIN_PA30, MUX_PA30H_CM4_SWCLK); -// #endif -// #ifdef SAMD21 -// gpio_set_pin_function(PIN_PA30, GPIO_PIN_FUNCTION_G); -// gpio_set_pin_function(PIN_PA31, GPIO_PIN_FUNCTION_G); -// #endif -// - #ifdef MICROPY_HW_NEOPIXEL - neopixel_in_use = false; - #endif - #ifdef MICROPY_HW_APA102_MOSI - apa102_sck_in_use = false; - apa102_mosi_in_use = false; - #endif - - // After configuring SWD because it may be shared. - #ifdef SPEAKER_ENABLE_PIN - speaker_enable_in_use = false; -// gpio_set_pin_function(SPEAKER_ENABLE_PIN->number, GPIO_PIN_FUNCTION_OFF); -// gpio_set_pin_direction(SPEAKER_ENABLE_PIN->number, GPIO_DIRECTION_OUT); -// gpio_set_pin_level(SPEAKER_ENABLE_PIN->number, false); - #endif -} - -void never_reset_pin_number(uint8_t pin_number) { -// never_reset_pins[GPIO_PORT(pin_number)] |= 1 << GPIO_PIN(pin_number); -} - -void reset_pin_number(uint8_t pin_number) { - // never_reset_pins[GPIO_PORT(pin_number)] &= ~(1 << GPIO_PIN(pin_number)); - - if (pin_number >= IOMUXC_SW_PAD_CTL_PAD_COUNT) { - return; + for (uint8_t i = 0; i < GPIO_PORT_COUNT; i++) { + claimed_pins[i] = never_reset_pins[i]; + } + for (uint8_t i = 0; i < IOMUXC_SW_PAD_CTL_PAD_COUNT; i++) { + // mp_printf(&mp_plat_print, "CTL MUX i=%d:%x\n",i,IOMUXC->SW_MUX_CTL_PAD[i]); + // mp_printf(&mp_plat_print, "CTL PAD i=%d:%x\n",i,IOMUXC->SW_PAD_CTL_PAD[i]); + if(!(never_reset_pins[mcu_pin_list[i].port] & (1 << mcu_pin_list[i].number))) { + // mp_printf(&mp_plat_print, "SUCCESS\n"); + IOMUXC->SW_MUX_CTL_PAD[i] = mcu_pin_list[i].mux_reset; + IOMUXC->SW_PAD_CTL_PAD[i] = mcu_pin_list[i].pad_reset; + } } #ifdef MICROPY_HW_NEOPIXEL - if (pin_number == MICROPY_HW_NEOPIXEL->number) { + neopixel_in_use = false; + #endif +} + +void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number) { + never_reset_pins[pin_port] |= 1 << pin_number; +} + +// Since i.MX pins need extra register and reset information to reset properly, +// resetting pins by number alone has been removed. +void common_hal_reset_pin(const mcu_pin_obj_t* pin) { + never_reset_pins[pin->port] &= ~(1 << pin->number); + claimed_pins[pin->port] &= ~(1 << pin->number); + *(uint32_t*)pin->mux_reg = pin->mux_reset; + *(uint32_t*)pin->cfg_reg = pin->pad_reset; + + #ifdef MICROPY_HW_NEOPIXEL + if (pin == MICROPY_HW_NEOPIXEL) { neopixel_in_use = false; rgb_led_status_init(); return; } #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin_number == MICROPY_HW_APA102_MOSI->number || - pin_number == MICROPY_HW_APA102_SCK->number) { -// apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number; -// apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number; - if (!apa102_sck_in_use && !apa102_mosi_in_use) { -// rgb_led_status_init(); - } - return; - } - #endif +} -// if (pin_number == PIN_PA30 -// #ifdef SAMD51 -// ) { -// #endif -// #ifdef SAMD21 -// || pin_number == PIN_PA31) { -// #endif -// gpio_set_pin_function(pin_number, SWD_MUX); -// } else { -// gpio_set_pin_direction(pin_number, GPIO_DIRECTION_OFF); -// gpio_set_pin_function(pin_number, GPIO_PIN_FUNCTION_OFF); -// } -// - #ifdef SPEAKER_ENABLE_PIN - if (pin_number == SPEAKER_ENABLE_PIN->number) { - speaker_enable_in_use = false; -// gpio_set_pin_function(pin_number, GPIO_PIN_FUNCTION_OFF); -// gpio_set_pin_direction(SPEAKER_ENABLE_PIN->number, GPIO_DIRECTION_OUT); -// gpio_set_pin_level(SPEAKER_ENABLE_PIN->number, false); - } - #endif +void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { + never_reset_pin_number(pin->port, pin->number); } void claim_pin(const mcu_pin_obj_t* pin) { + claimed_pins[pin->port] |= 1 << pin->number; + #ifdef MICROPY_HW_NEOPIXEL if (pin == MICROPY_HW_NEOPIXEL) { neopixel_in_use = true; } #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - apa102_mosi_in_use = true; - } - if (pin == MICROPY_HW_APA102_SCK) { - apa102_sck_in_use = true; - } - #endif - - #ifdef SPEAKER_ENABLE_PIN - if (pin == SPEAKER_ENABLE_PIN) { - speaker_enable_in_use = true; - } - #endif -} - -bool pin_number_is_free(uint8_t pin_number) { -// PortGroup *const port = &PORT->Group[(enum gpio_port)GPIO_PORT(pin_number)]; -// uint8_t pin_index = GPIO_PIN(pin_number); -// volatile PORT_PINCFG_Type *state = &port->PINCFG[pin_index]; -// volatile PORT_PMUX_Type *pmux = &port->PMUX[pin_index / 2]; -// -// if (pin_number == PIN_PA30 || pin_number == PIN_PA31) { -// if (DSU->STATUSB.bit.DBGPRES == 1) { -// return false; -// } -// if (pin_number == PIN_PA30 -// #ifdef SAMD51 -// ) { -// #endif -// #ifdef SAMD21 -// || pin_number == PIN_PA31) { -// #endif) { -// return state->bit.PMUXEN == 1 && ((pmux->reg >> (4 * pin_index % 2)) & 0xf) == SWD_MUX; -// } -// } -// -// return state->bit.PMUXEN == 0 && state->bit.INEN == 0 && -// state->bit.PULLEN == 0 && (port->DIR.reg & (1 << pin_index)) == 0; - return true; } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin) { @@ -203,28 +102,23 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin) { return !neopixel_in_use; } #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - return !apa102_mosi_in_use; - } - if (pin == MICROPY_HW_APA102_SCK) { - return !apa102_sck_in_use; - } - #endif - #ifdef SPEAKER_ENABLE_PIN - if (pin == SPEAKER_ENABLE_PIN) { - return !speaker_enable_in_use; - } - #endif - - return pin_number_is_free(pin->number); + return !(claimed_pins[pin->port] & 1<number); } -void common_hal_reset_pin(const mcu_pin_obj_t* pin) { -// reset_pin_number(pin->number); +uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t* pin) { + return pin->mux_idx; // returns IOMUXC to align with pin table + // Note: IOMUXC "numbers" do not align cleanly with GPIO values } -void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { -// never_reset_pin_number(pin->port, pin->number); +void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { + claim_pin(pin); } + +void common_hal_mcu_pin_reset_number(uint8_t pin_no) { + common_hal_reset_pin(&mcu_pin_list[pin_no]); +} + +// TODO: replace use of GPIO pointers in pin struct with this system? +// GPIO_TypeDef * pin_port(uint8_t pin_port) {} +// uint16_t pin_mask(uint8_t pin_number) {} diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.h b/ports/mimxrt10xx/common-hal/microcontroller/Pin.h index 74a1f7cbbd..def583973b 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.h +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.h @@ -35,17 +35,11 @@ #ifdef MICROPY_HW_NEOPIXEL extern bool neopixel_in_use; #endif -#ifdef MICROPY_HW_APA102_MOSI -extern bool apa102_sck_in_use; -extern bool apa102_mosi_in_use; -#endif void reset_all_pins(void); // reset_pin_number takes the pin number instead of the pointer so that objects don't // need to store a full pointer. -void reset_pin_number(uint8_t pin_number); -void never_reset_pin_number(uint8_t pin_number); +void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number); void claim_pin(const mcu_pin_obj_t* pin); -bool pin_number_is_free(uint8_t pin_number); #endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_MICROCONTROLLER_PIN_H diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c index 8e68e77027..034efb3b6e 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c @@ -29,49 +29,97 @@ #include "py/mphal.h" #include "mimxrt10xx/pins.h" -const mcu_pin_obj_t pin_GPIO_00 = PIN(GPIO1, 0, GPIO_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_01 = PIN(GPIO1, 1, GPIO_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_02 = PIN(GPIO1, 2, GPIO_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_03 = PIN(GPIO1, 3, GPIO_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_04 = PIN(GPIO1, 4, GPIO_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_05 = PIN(GPIO1, 5, GPIO_05, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_06 = PIN(GPIO1, 6, GPIO_06, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_07 = PIN(GPIO1, 7, GPIO_07, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_08 = PIN(GPIO1, 8, GPIO_08, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_09 = PIN(GPIO1, 9, GPIO_09, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_10 = PIN(GPIO1, 10, GPIO_10, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_11 = PIN(GPIO1, 11, GPIO_11, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_12 = PIN(GPIO1, 12, GPIO_12, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_13 = PIN(GPIO1, 13, GPIO_13, NO_ADC, 0); +const mcu_pin_obj_t pin_GPIO_00 = PIN(GPIO1, 0, 0, GPIO_00, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_01 = PIN(GPIO1, 0, 1, GPIO_01, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_02 = PIN(GPIO1, 0, 2, GPIO_02, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_03 = PIN(GPIO1, 0, 3, GPIO_03, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_04 = PIN(GPIO1, 0, 4, GPIO_04, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_05 = PIN(GPIO1, 0, 5, GPIO_05, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_06 = PIN(GPIO1, 0, 6, GPIO_06, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_07 = PIN(GPIO1, 0, 7, GPIO_07, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_08 = PIN(GPIO1, 0, 8, GPIO_08, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_09 = PIN(GPIO1, 0, 9, GPIO_09, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_10 = PIN(GPIO1, 0, 10, GPIO_10, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_11 = PIN(GPIO1, 0, 11, GPIO_11, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_12 = PIN(GPIO1, 0, 12, GPIO_12, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_13 = PIN(GPIO1, 0, 13, GPIO_13, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_00 = PIN(GPIO1, 14, GPIO_AD_00, ADC1, 0); -const mcu_pin_obj_t pin_GPIO_AD_01 = PIN(GPIO1, 15, GPIO_AD_01, ADC1, 1); -const mcu_pin_obj_t pin_GPIO_AD_02 = PIN(GPIO1, 16, GPIO_AD_02, ADC1, 2); -const mcu_pin_obj_t pin_GPIO_AD_03 = PIN(GPIO1, 17, GPIO_AD_03, ADC1, 3); -const mcu_pin_obj_t pin_GPIO_AD_04 = PIN(GPIO1, 18, GPIO_AD_04, ADC1, 4); -const mcu_pin_obj_t pin_GPIO_AD_05 = PIN(GPIO1, 19, GPIO_AD_05, ADC1, 5); -const mcu_pin_obj_t pin_GPIO_AD_06 = PIN(GPIO1, 20, GPIO_AD_06, ADC1, 6); -const mcu_pin_obj_t pin_GPIO_AD_07 = PIN(GPIO1, 21, GPIO_AD_07, ADC1, 7); -const mcu_pin_obj_t pin_GPIO_AD_08 = PIN(GPIO1, 22, GPIO_AD_08, ADC1, 8); -const mcu_pin_obj_t pin_GPIO_AD_09 = PIN(GPIO1, 23, GPIO_AD_09, ADC1, 9); -const mcu_pin_obj_t pin_GPIO_AD_10 = PIN(GPIO1, 24, GPIO_AD_10, ADC1, 10); -const mcu_pin_obj_t pin_GPIO_AD_11 = PIN(GPIO1, 25, GPIO_AD_11, ADC1, 11); -const mcu_pin_obj_t pin_GPIO_AD_12 = PIN(GPIO1, 26, GPIO_AD_12, ADC1, 12); -const mcu_pin_obj_t pin_GPIO_AD_13 = PIN(GPIO1, 27, GPIO_AD_13, ADC1, 13); -const mcu_pin_obj_t pin_GPIO_AD_14 = PIN(GPIO1, 28, GPIO_AD_14, ADC1, 14); +const mcu_pin_obj_t pin_GPIO_AD_00 = PIN(GPIO1, 0, 14, GPIO_AD_00, ADC1, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_01 = PIN(GPIO1, 0, 15, GPIO_AD_01, ADC1, 1, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_02 = PIN(GPIO1, 0, 16, GPIO_AD_02, ADC1, 2, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_03 = PIN(GPIO1, 0, 17, GPIO_AD_03, ADC1, 3, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_04 = PIN(GPIO1, 0, 18, GPIO_AD_04, ADC1, 4, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_05 = PIN(GPIO1, 0, 19, GPIO_AD_05, ADC1, 5, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_06 = PIN(GPIO1, 0, 20, GPIO_AD_06, ADC1, 6, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_07 = PIN(GPIO1, 0, 21, GPIO_AD_07, ADC1, 7, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_08 = PIN(GPIO1, 0, 22, GPIO_AD_08, ADC1, 8, 0x00000007, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_09 = PIN(GPIO1, 0, 23, GPIO_AD_09, ADC1, 9, 0x00000007, 0x000090B1); +const mcu_pin_obj_t pin_GPIO_AD_10 = PIN(GPIO1, 0, 24, GPIO_AD_10, ADC1, 10, 0x00000007, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_11 = PIN(GPIO1, 0, 25, GPIO_AD_11, ADC1, 11, 0x00000007, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_12 = PIN(GPIO1, 0, 26, GPIO_AD_12, ADC1, 12, 0x00000007, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_13 = PIN(GPIO1, 0, 27, GPIO_AD_13, ADC1, 13, 0x00000007, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_14 = PIN(GPIO1, 0, 28, GPIO_AD_14, ADC1, 14, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_00 = PIN(GPIO2, 0, GPIO_SD_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_01 = PIN(GPIO2, 1, GPIO_SD_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_02 = PIN(GPIO2, 2, GPIO_SD_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_03 = PIN(GPIO2, 3, GPIO_SD_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_04 = PIN(GPIO2, 4, GPIO_SD_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_05 = PIN(GPIO2, 5, GPIO_SD_05, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_06 = PIN(GPIO2, 6, GPIO_SD_06, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_07 = PIN(GPIO2, 7, GPIO_SD_07, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_08 = PIN(GPIO2, 8, GPIO_SD_08, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_09 = PIN(GPIO2, 9, GPIO_SD_09, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_10 = PIN(GPIO2, 10, GPIO_SD_10, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_11 = PIN(GPIO2, 11, GPIO_SD_11, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_12 = PIN(GPIO2, 12, GPIO_SD_12, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_13 = PIN(GPIO2, 13, GPIO_SD_13, NO_ADC, 0); +const mcu_pin_obj_t pin_GPIO_SD_00 = PIN(GPIO2, 1, 0, GPIO_SD_00, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_01 = PIN(GPIO2, 1, 1, GPIO_SD_01, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_02 = PIN(GPIO2, 1, 2, GPIO_SD_02, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_03 = PIN(GPIO2, 1, 3, GPIO_SD_03, NO_ADC, 0, 0x00000006, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_SD_04 = PIN(GPIO2, 1, 4, GPIO_SD_04, NO_ADC, 0, 0x00000006, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_SD_05 = PIN(GPIO2, 1, 5, GPIO_SD_05, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_06 = PIN(GPIO2, 1, 6, GPIO_SD_06, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_07 = PIN(GPIO2, 1, 7, GPIO_SD_07, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_08 = PIN(GPIO2, 1, 8, GPIO_SD_08, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_09 = PIN(GPIO2, 1, 9, GPIO_SD_09, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_10 = PIN(GPIO2, 1, 10, GPIO_SD_10, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_11 = PIN(GPIO2, 1, 11, GPIO_SD_11, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_12 = PIN(GPIO2, 1, 12, GPIO_SD_12, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_13 = PIN(GPIO2, 1, 13, GPIO_SD_13, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_14 = PIN(GPIO2, 1, 14, GPIO_SD_14, NO_ADC, 0, 0x00000000, 0x000010A0); +// pin_GPIO_SD_14 isn't actually used as a pad but we include it anyway to make resetting easier +const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT] = { + pin_GPIO_AD_14, + pin_GPIO_AD_13, + pin_GPIO_AD_12, + pin_GPIO_AD_11, + pin_GPIO_AD_10, + pin_GPIO_AD_09, + pin_GPIO_AD_08, + pin_GPIO_AD_07, + pin_GPIO_AD_06, + pin_GPIO_AD_05, + pin_GPIO_AD_04, + pin_GPIO_AD_03, + pin_GPIO_AD_02, + pin_GPIO_AD_01, + pin_GPIO_AD_00, + pin_GPIO_SD_14, //spooky ghost pin + pin_GPIO_SD_13, + pin_GPIO_SD_12, + pin_GPIO_SD_11, + pin_GPIO_SD_10, + pin_GPIO_SD_09, + pin_GPIO_SD_08, + pin_GPIO_SD_07, + pin_GPIO_SD_06, + pin_GPIO_SD_05, + pin_GPIO_SD_04, + pin_GPIO_SD_03, + pin_GPIO_SD_02, + pin_GPIO_SD_01, + pin_GPIO_SD_00, + pin_GPIO_13, + pin_GPIO_12, + pin_GPIO_11, + pin_GPIO_10, + pin_GPIO_09, + pin_GPIO_08, + pin_GPIO_07, + pin_GPIO_06, + pin_GPIO_05, + pin_GPIO_04, + pin_GPIO_03, + pin_GPIO_02, + pin_GPIO_01, + pin_GPIO_00, +}; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h index 6b31d6d8ed..58ef7329e7 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h @@ -74,4 +74,6 @@ extern const mcu_pin_obj_t pin_GPIO_AD_12; extern const mcu_pin_obj_t pin_GPIO_AD_13; extern const mcu_pin_obj_t pin_GPIO_AD_14; +extern const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT]; + #endif // MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PINS_H diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c index 4106c9bad4..629fdf4bd6 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c @@ -29,100 +29,196 @@ #include "py/mphal.h" #include "mimxrt10xx/pins.h" -const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, GPIO_AD_B0_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 1, GPIO_AD_B0_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 2, GPIO_AD_B0_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 3, GPIO_AD_B0_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 4, GPIO_AD_B0_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 5, GPIO_AD_B0_05, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 6, GPIO_AD_B0_06, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 7, GPIO_AD_B0_07, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 8, GPIO_AD_B0_08, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 9, GPIO_AD_B0_09, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 10, GPIO_AD_B0_10, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 11, GPIO_AD_B0_11, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 12, GPIO_AD_B0_12, ADC1, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 13, GPIO_AD_B0_13, ADC2, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 14, GPIO_AD_B0_14, ADC2, 1); -const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 15, GPIO_AD_B0_15, ADC1, 2); +const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, 0, GPIO_AD_B0_00, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 0, 1, GPIO_AD_B0_01, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 0, 2, GPIO_AD_B0_02, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 0, 3, GPIO_AD_B0_03, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 0, 4, GPIO_AD_B0_04, NO_ADC, 0, 0x00000000, 0x000090B1); +const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 0, 5, GPIO_AD_B0_05, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 0, 6, GPIO_AD_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 0, 7, GPIO_AD_B0_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 0, 8, GPIO_AD_B0_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 0, 9, GPIO_AD_B0_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 0, 10, GPIO_AD_B0_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 0, 11, GPIO_AD_B0_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 0, 12, GPIO_AD_B0_12, ADC1, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 0, 13, GPIO_AD_B0_13, ADC2, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 0, 14, GPIO_AD_B0_14, ADC2, 1, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 0, 15, GPIO_AD_B0_15, ADC1, 2, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 16, GPIO_AD_B1_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 17, GPIO_AD_B1_01, ADC1, 3); -const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 18, GPIO_AD_B1_02, ADC2, 3); -const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 19, GPIO_AD_B1_03, ADC1, 4); -const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 20, GPIO_AD_B1_04, ADC2, 4); -const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 21, GPIO_AD_B1_05, ADC2, 5); -const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 22, GPIO_AD_B1_06, ADC2, 6); -const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 23, GPIO_AD_B1_07, ADC2, 7); -const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 24, GPIO_AD_B1_08, ADC2, 8); -const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 25, GPIO_AD_B1_09, ADC2, 9); -const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 26, GPIO_AD_B1_10, ADC2, 10); -const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 27, GPIO_AD_B1_11, ADC2, 11); -const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 28, GPIO_AD_B1_12, ADC2, 12); -const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 29, GPIO_AD_B1_13, ADC2, 13); -const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 30, GPIO_AD_B1_14, ADC2, 14); -const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 31, GPIO_AD_B1_15, ADC2, 15); +const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 0, 16, GPIO_AD_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 0, 17, GPIO_AD_B1_01, ADC1, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 0, 18, GPIO_AD_B1_02, ADC2, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 0, 19, GPIO_AD_B1_03, ADC1, 4, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 0, 20, GPIO_AD_B1_04, ADC2, 4, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 0, 21, GPIO_AD_B1_05, ADC2, 5, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 0, 22, GPIO_AD_B1_06, ADC2, 6, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 0, 23, GPIO_AD_B1_07, ADC2, 7, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 0, 24, GPIO_AD_B1_08, ADC2, 8, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 0, 25, GPIO_AD_B1_09, ADC2, 9, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 0, 26, GPIO_AD_B1_10, ADC2, 10, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 0, 27, GPIO_AD_B1_11, ADC2, 11, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 0, 28, GPIO_AD_B1_12, ADC2, 12, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 0, 29, GPIO_AD_B1_13, ADC2, 13, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 0, 30, GPIO_AD_B1_14, ADC2, 14, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 0, 31, GPIO_AD_B1_15, ADC2, 15, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_00 = PIN(GPIO2, 0, GPIO_EMC_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_01 = PIN(GPIO2, 1, GPIO_EMC_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_02 = PIN(GPIO2, 2, GPIO_EMC_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_03 = PIN(GPIO2, 3, GPIO_EMC_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_04 = PIN(GPIO2, 4, GPIO_EMC_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_05 = PIN(GPIO2, 5, GPIO_EMC_05, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_06 = PIN(GPIO2, 6, GPIO_EMC_06, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_07 = PIN(GPIO2, 7, GPIO_EMC_07, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_08 = PIN(GPIO2, 8, GPIO_EMC_08, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_09 = PIN(GPIO2, 9, GPIO_EMC_09, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_10 = PIN(GPIO2, 10, GPIO_EMC_10, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_11 = PIN(GPIO2, 11, GPIO_EMC_11, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_12 = PIN(GPIO2, 12, GPIO_EMC_12, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_13 = PIN(GPIO2, 13, GPIO_EMC_13, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_14 = PIN(GPIO2, 14, GPIO_EMC_14, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_15 = PIN(GPIO2, 15, GPIO_EMC_15, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_16 = PIN(GPIO2, 16, GPIO_EMC_16, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_17 = PIN(GPIO2, 17, GPIO_EMC_17, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_18 = PIN(GPIO2, 18, GPIO_EMC_18, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_19 = PIN(GPIO2, 19, GPIO_EMC_19, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_20 = PIN(GPIO2, 20, GPIO_EMC_20, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_21 = PIN(GPIO2, 21, GPIO_EMC_21, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_22 = PIN(GPIO2, 22, GPIO_EMC_22, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO2, 23, GPIO_EMC_23, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO2, 24, GPIO_EMC_24, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO2, 25, GPIO_EMC_25, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO2, 26, GPIO_EMC_26, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO2, 27, GPIO_EMC_27, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_28 = PIN(GPIO2, 28, GPIO_EMC_28, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_29 = PIN(GPIO2, 29, GPIO_EMC_29, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_30 = PIN(GPIO2, 30, GPIO_EMC_30, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_31 = PIN(GPIO2, 31, GPIO_EMC_31, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_32 = PIN(GPIO3, 0, GPIO_EMC_32, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_33 = PIN(GPIO3, 1, GPIO_EMC_33, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_34 = PIN(GPIO3, 2, GPIO_EMC_34, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_35 = PIN(GPIO3, 3, GPIO_EMC_35, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_36 = PIN(GPIO3, 4, GPIO_EMC_36, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_37 = PIN(GPIO3, 5, GPIO_EMC_37, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_38 = PIN(GPIO3, 6, GPIO_EMC_38, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_39 = PIN(GPIO3, 7, GPIO_EMC_39, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_40 = PIN(GPIO3, 8, GPIO_EMC_40, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_41 = PIN(GPIO3, 9, GPIO_EMC_41, NO_ADC, 0); +const mcu_pin_obj_t pin_GPIO_EMC_00 = PIN(GPIO2, 1, 0, GPIO_EMC_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_01 = PIN(GPIO2, 1, 1, GPIO_EMC_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_02 = PIN(GPIO2, 1, 2, GPIO_EMC_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_03 = PIN(GPIO2, 1, 3, GPIO_EMC_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_04 = PIN(GPIO2, 1, 4, GPIO_EMC_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_05 = PIN(GPIO2, 1, 5, GPIO_EMC_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_06 = PIN(GPIO2, 1, 6, GPIO_EMC_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_07 = PIN(GPIO2, 1, 7, GPIO_EMC_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_08 = PIN(GPIO2, 1, 8, GPIO_EMC_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_09 = PIN(GPIO2, 1, 9, GPIO_EMC_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_10 = PIN(GPIO2, 1, 10, GPIO_EMC_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_11 = PIN(GPIO2, 1, 11, GPIO_EMC_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_12 = PIN(GPIO2, 1, 12, GPIO_EMC_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_13 = PIN(GPIO2, 1, 13, GPIO_EMC_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_14 = PIN(GPIO2, 1, 14, GPIO_EMC_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_15 = PIN(GPIO2, 1, 15, GPIO_EMC_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_16 = PIN(GPIO2, 1, 16, GPIO_EMC_16, NO_ADC, 0, 0x00000006, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_EMC_17 = PIN(GPIO2, 1, 17, GPIO_EMC_17, NO_ADC, 0, 0x00000006, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_EMC_18 = PIN(GPIO2, 1, 18, GPIO_EMC_18, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_19 = PIN(GPIO2, 1, 19, GPIO_EMC_19, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_20 = PIN(GPIO2, 1, 20, GPIO_EMC_20, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_21 = PIN(GPIO2, 1, 21, GPIO_EMC_21, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_22 = PIN(GPIO2, 1, 22, GPIO_EMC_22, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO2, 1, 23, GPIO_EMC_23, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO2, 1, 24, GPIO_EMC_24, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO2, 1, 25, GPIO_EMC_25, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO2, 1, 26, GPIO_EMC_26, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO2, 1, 27, GPIO_EMC_27, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_28 = PIN(GPIO2, 1, 28, GPIO_EMC_28, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_29 = PIN(GPIO2, 1, 29, GPIO_EMC_29, NO_ADC, 0, 0x00000005, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_EMC_30 = PIN(GPIO2, 1, 30, GPIO_EMC_30, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_31 = PIN(GPIO2, 1, 31, GPIO_EMC_31, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_32 = PIN(GPIO3, 1, 0, GPIO_EMC_32, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_33 = PIN(GPIO3, 1, 1, GPIO_EMC_33, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_34 = PIN(GPIO3, 1, 2, GPIO_EMC_34, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_35 = PIN(GPIO3, 1, 3, GPIO_EMC_35, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_36 = PIN(GPIO3, 1, 4, GPIO_EMC_36, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_37 = PIN(GPIO3, 1, 5, GPIO_EMC_37, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_38 = PIN(GPIO3, 1, 6, GPIO_EMC_38, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_39 = PIN(GPIO3, 1, 7, GPIO_EMC_39, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_40 = PIN(GPIO3, 1, 8, GPIO_EMC_40, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_41 = PIN(GPIO3, 1, 9, GPIO_EMC_41, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_00 = PIN(GPIO3, 13, GPIO_SD_B0_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B0_01 = PIN(GPIO3, 14, GPIO_SD_B0_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B0_02 = PIN(GPIO3, 15, GPIO_SD_B0_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B0_03 = PIN(GPIO3, 16, GPIO_SD_B0_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B0_04 = PIN(GPIO3, 17, GPIO_SD_B0_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B0_05 = PIN(GPIO3, 18, GPIO_SD_B0_05, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B0_06 = PIN(GPIO3, 19, GPIO_SD_B0_06, NO_ADC, 0); +const mcu_pin_obj_t pin_GPIO_SD_B0_00 = PIN(GPIO3, 2, 13, GPIO_SD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_01 = PIN(GPIO3, 2, 14, GPIO_SD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_02 = PIN(GPIO3, 2, 15, GPIO_SD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_03 = PIN(GPIO3, 2, 16, GPIO_SD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_04 = PIN(GPIO3, 2, 17, GPIO_SD_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_05 = PIN(GPIO3, 2, 18, GPIO_SD_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_06 = PIN(GPIO3, 2, 19, GPIO_SD_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO3, 20, GPIO_SD_B1_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO3, 21, GPIO_SD_B1_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO3, 22, GPIO_SD_B1_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO3, 23, GPIO_SD_B1_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO3, 24, GPIO_SD_B1_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO3, 25, GPIO_SD_B1_05, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_06 = PIN(GPIO3, 26, GPIO_SD_B1_06, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_07 = PIN(GPIO3, 27, GPIO_SD_B1_07, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 28, GPIO_SD_B1_08, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 29, GPIO_SD_B1_09, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 30, GPIO_SD_B1_10, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 31, GPIO_SD_B1_11, NO_ADC, 0); +const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO3, 2, 20, GPIO_SD_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO3, 2, 21, GPIO_SD_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO3, 2, 22, GPIO_SD_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO3, 2, 23, GPIO_SD_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO3, 2, 24, GPIO_SD_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO3, 2, 25, GPIO_SD_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_06 = PIN(GPIO3, 2, 26, GPIO_SD_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_07 = PIN(GPIO3, 2, 27, GPIO_SD_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 2, 28, GPIO_SD_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 2, 29, GPIO_SD_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 2, 30, GPIO_SD_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 2, 31, GPIO_SD_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); + +const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT] = { + pin_GPIO_EMC_00, + pin_GPIO_EMC_01, + pin_GPIO_EMC_02, + pin_GPIO_EMC_03, + pin_GPIO_EMC_04, + pin_GPIO_EMC_05, + pin_GPIO_EMC_06, + pin_GPIO_EMC_07, + pin_GPIO_EMC_08, + pin_GPIO_EMC_09, + pin_GPIO_EMC_10, + pin_GPIO_EMC_11, + pin_GPIO_EMC_12, + pin_GPIO_EMC_13, + pin_GPIO_EMC_14, + pin_GPIO_EMC_15, + pin_GPIO_EMC_16, + pin_GPIO_EMC_17, + pin_GPIO_EMC_18, + pin_GPIO_EMC_19, + pin_GPIO_EMC_20, + pin_GPIO_EMC_21, + pin_GPIO_EMC_22, + pin_GPIO_EMC_23, + pin_GPIO_EMC_24, + pin_GPIO_EMC_25, + pin_GPIO_EMC_26, + pin_GPIO_EMC_27, + pin_GPIO_EMC_28, + pin_GPIO_EMC_29, + pin_GPIO_EMC_30, + pin_GPIO_EMC_31, + pin_GPIO_EMC_32, + pin_GPIO_EMC_33, + pin_GPIO_EMC_34, + pin_GPIO_EMC_35, + pin_GPIO_EMC_36, + pin_GPIO_EMC_37, + pin_GPIO_EMC_38, + pin_GPIO_EMC_39, + pin_GPIO_EMC_40, + pin_GPIO_EMC_41, + pin_GPIO_AD_B0_00, + pin_GPIO_AD_B0_01, + pin_GPIO_AD_B0_02, + pin_GPIO_AD_B0_03, + pin_GPIO_AD_B0_04, + pin_GPIO_AD_B0_05, + pin_GPIO_AD_B0_06, + pin_GPIO_AD_B0_07, + pin_GPIO_AD_B0_08, + pin_GPIO_AD_B0_09, + pin_GPIO_AD_B0_10, + pin_GPIO_AD_B0_11, + pin_GPIO_AD_B0_12, + pin_GPIO_AD_B0_13, + pin_GPIO_AD_B0_14, + pin_GPIO_AD_B0_15, + pin_GPIO_AD_B1_00, + pin_GPIO_AD_B1_01, + pin_GPIO_AD_B1_02, + pin_GPIO_AD_B1_03, + pin_GPIO_AD_B1_04, + pin_GPIO_AD_B1_05, + pin_GPIO_AD_B1_06, + pin_GPIO_AD_B1_07, + pin_GPIO_AD_B1_08, + pin_GPIO_AD_B1_09, + pin_GPIO_AD_B1_10, + pin_GPIO_AD_B1_11, + pin_GPIO_AD_B1_12, + pin_GPIO_AD_B1_13, + pin_GPIO_AD_B1_14, + pin_GPIO_AD_B1_15, + pin_GPIO_SD_B0_00, + pin_GPIO_SD_B0_01, + pin_GPIO_SD_B0_02, + pin_GPIO_SD_B0_03, + pin_GPIO_SD_B0_04, + pin_GPIO_SD_B0_05, + pin_GPIO_SD_B0_06, + pin_GPIO_SD_B1_00, + pin_GPIO_SD_B1_01, + pin_GPIO_SD_B1_02, + pin_GPIO_SD_B1_03, + pin_GPIO_SD_B1_04, + pin_GPIO_SD_B1_05, + pin_GPIO_SD_B1_06, + pin_GPIO_SD_B1_07, + pin_GPIO_SD_B1_08, + pin_GPIO_SD_B1_09, + pin_GPIO_SD_B1_10, + pin_GPIO_SD_B1_11, +}; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h index a13bacfc35..4485b6e152 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h @@ -126,4 +126,6 @@ extern const mcu_pin_obj_t pin_GPIO_SD_B1_09; extern const mcu_pin_obj_t pin_GPIO_SD_B1_10; extern const mcu_pin_obj_t pin_GPIO_SD_B1_11; +extern const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT]; + #endif // MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1021_PINS_H diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c index c622e759ae..5b3fce1f5e 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c @@ -29,133 +29,260 @@ #include "py/mphal.h" #include "mimxrt10xx/pins.h" -const mcu_pin_obj_t pin_GPIO_EMC_00 = PIN(GPIO4, 0, GPIO_EMC_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_01 = PIN(GPIO4, 1, GPIO_EMC_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_02 = PIN(GPIO4, 2, GPIO_EMC_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_03 = PIN(GPIO4, 3, GPIO_EMC_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_04 = PIN(GPIO4, 4, GPIO_EMC_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_05 = PIN(GPIO4, 5, GPIO_EMC_05, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_06 = PIN(GPIO4, 6, GPIO_EMC_06, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_07 = PIN(GPIO4, 7, GPIO_EMC_07, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_08 = PIN(GPIO4, 8, GPIO_EMC_08, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_09 = PIN(GPIO4, 9, GPIO_EMC_09, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_10 = PIN(GPIO4, 10, GPIO_EMC_10, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_11 = PIN(GPIO4, 11, GPIO_EMC_11, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_12 = PIN(GPIO4, 12, GPIO_EMC_12, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_13 = PIN(GPIO4, 13, GPIO_EMC_13, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_14 = PIN(GPIO4, 14, GPIO_EMC_14, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_15 = PIN(GPIO4, 15, GPIO_EMC_15, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_16 = PIN(GPIO4, 16, GPIO_EMC_16, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_17 = PIN(GPIO4, 17, GPIO_EMC_17, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_18 = PIN(GPIO4, 18, GPIO_EMC_18, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_19 = PIN(GPIO4, 19, GPIO_EMC_19, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_20 = PIN(GPIO4, 20, GPIO_EMC_20, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_21 = PIN(GPIO4, 21, GPIO_EMC_21, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_22 = PIN(GPIO4, 22, GPIO_EMC_22, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO4, 23, GPIO_EMC_23, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO4, 24, GPIO_EMC_24, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO4, 25, GPIO_EMC_25, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO4, 26, GPIO_EMC_26, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO4, 27, GPIO_EMC_27, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_28 = PIN(GPIO4, 28, GPIO_EMC_28, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_29 = PIN(GPIO4, 29, GPIO_EMC_29, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_30 = PIN(GPIO4, 30, GPIO_EMC_30, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_31 = PIN(GPIO4, 31, GPIO_EMC_31, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_32 = PIN(GPIO3, 18, GPIO_EMC_32, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_33 = PIN(GPIO3, 19, GPIO_EMC_33, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_34 = PIN(GPIO3, 20, GPIO_EMC_34, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_35 = PIN(GPIO3, 21, GPIO_EMC_35, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_36 = PIN(GPIO3, 22, GPIO_EMC_36, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_37 = PIN(GPIO3, 23, GPIO_EMC_37, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_38 = PIN(GPIO3, 24, GPIO_EMC_38, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_39 = PIN(GPIO3, 25, GPIO_EMC_39, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_40 = PIN(GPIO3, 26, GPIO_EMC_40, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_EMC_41 = PIN(GPIO3, 27, GPIO_EMC_41, NO_ADC, 0); +const mcu_pin_obj_t pin_GPIO_EMC_00 = PIN(GPIO4, 3, 0, GPIO_EMC_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_01 = PIN(GPIO4, 3, 1, GPIO_EMC_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_02 = PIN(GPIO4, 3, 2, GPIO_EMC_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_03 = PIN(GPIO4, 3, 3, GPIO_EMC_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_04 = PIN(GPIO4, 3, 4, GPIO_EMC_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_05 = PIN(GPIO4, 3, 5, GPIO_EMC_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_06 = PIN(GPIO4, 3, 6, GPIO_EMC_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_07 = PIN(GPIO4, 3, 7, GPIO_EMC_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_08 = PIN(GPIO4, 3, 8, GPIO_EMC_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_09 = PIN(GPIO4, 3, 9, GPIO_EMC_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_10 = PIN(GPIO4, 3, 10, GPIO_EMC_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_11 = PIN(GPIO4, 3, 11, GPIO_EMC_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_12 = PIN(GPIO4, 3, 12, GPIO_EMC_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_13 = PIN(GPIO4, 3, 13, GPIO_EMC_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_14 = PIN(GPIO4, 3, 14, GPIO_EMC_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_15 = PIN(GPIO4, 3, 15, GPIO_EMC_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_16 = PIN(GPIO4, 3, 16, GPIO_EMC_16, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_17 = PIN(GPIO4, 3, 17, GPIO_EMC_17, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_18 = PIN(GPIO4, 3, 18, GPIO_EMC_18, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_19 = PIN(GPIO4, 3, 19, GPIO_EMC_19, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_20 = PIN(GPIO4, 3, 20, GPIO_EMC_20, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_21 = PIN(GPIO4, 3, 21, GPIO_EMC_21, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_22 = PIN(GPIO4, 3, 22, GPIO_EMC_22, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO4, 3, 23, GPIO_EMC_23, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO4, 3, 24, GPIO_EMC_24, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO4, 3, 25, GPIO_EMC_25, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO4, 3, 26, GPIO_EMC_26, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO4, 3, 27, GPIO_EMC_27, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_28 = PIN(GPIO4, 3, 28, GPIO_EMC_28, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_29 = PIN(GPIO4, 3, 29, GPIO_EMC_29, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_30 = PIN(GPIO4, 3, 30, GPIO_EMC_30, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_31 = PIN(GPIO4, 3, 31, GPIO_EMC_31, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_32 = PIN(GPIO3, 2, 18, GPIO_EMC_32, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_33 = PIN(GPIO3, 2, 19, GPIO_EMC_33, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_34 = PIN(GPIO3, 2, 20, GPIO_EMC_34, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_35 = PIN(GPIO3, 2, 21, GPIO_EMC_35, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_36 = PIN(GPIO3, 2, 22, GPIO_EMC_36, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_37 = PIN(GPIO3, 2, 23, GPIO_EMC_37, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_38 = PIN(GPIO3, 2, 24, GPIO_EMC_38, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_39 = PIN(GPIO3, 2, 25, GPIO_EMC_39, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_40 = PIN(GPIO3, 2, 26, GPIO_EMC_40, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_41 = PIN(GPIO3, 2, 27, GPIO_EMC_41, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, GPIO_AD_B0_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 1, GPIO_AD_B0_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 2, GPIO_AD_B0_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 3, GPIO_AD_B0_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 4, GPIO_AD_B0_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 5, GPIO_AD_B0_05, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 6, GPIO_AD_B0_06, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 7, GPIO_AD_B0_07, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 8, GPIO_AD_B0_08, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 9, GPIO_AD_B0_09, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 10, GPIO_AD_B0_10, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 11, GPIO_AD_B0_11, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 12, GPIO_AD_B0_12, ADC1, 1); -const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 13, GPIO_AD_B0_13, ADC1, 2); -const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 14, GPIO_AD_B0_14, ADC1, 3); -const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 15, GPIO_AD_B0_15, ADC1, 4); +const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, 0, GPIO_AD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 0, 1, GPIO_AD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 0, 2, GPIO_AD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 0, 3, GPIO_AD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 0, 4, GPIO_AD_B0_04, NO_ADC, 0, 0x00000000, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 0, 5, GPIO_AD_B0_05, NO_ADC, 0, 0x00000000, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 0, 6, GPIO_AD_B0_06, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 0, 7, GPIO_AD_B0_07, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 0, 8, GPIO_AD_B0_08, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 0, 9, GPIO_AD_B0_09, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 0, 10, GPIO_AD_B0_10, NO_ADC, 0, 0x00000000, 0x000090B1); +const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 0, 11, GPIO_AD_B0_11, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 0, 12, GPIO_AD_B0_12, ADC1, 1, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 0, 13, GPIO_AD_B0_13, ADC1, 2, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 0, 14, GPIO_AD_B0_14, ADC1, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 0, 15, GPIO_AD_B0_15, ADC1, 4, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 16, GPIO_AD_B1_00, ADC1, 5); -const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 17, GPIO_AD_B1_01, ADC1, 6); -const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 18, GPIO_AD_B1_02, ADC1, 7); -const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 19, GPIO_AD_B1_03, ADC1, 8); -const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 20, GPIO_AD_B1_04, ADC1, 9); -const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 21, GPIO_AD_B1_05, ADC1, 10); -const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 22, GPIO_AD_B1_06, ADC1, 11); -const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 23, GPIO_AD_B1_07, ADC1, 12); -const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 24, GPIO_AD_B1_08, ADC1, 13); -const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 25, GPIO_AD_B1_09, ADC1, 14); -const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 26, GPIO_AD_B1_10, ADC1, 15); -const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 27, GPIO_AD_B1_11, ADC1, 0); -const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 28, GPIO_AD_B1_12, ADC2, 1); -const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 29, GPIO_AD_B1_13, ADC2, 2); -const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 30, GPIO_AD_B1_14, ADC2, 3); -const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 31, GPIO_AD_B1_15, ADC2, 4); +const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 0, 16, GPIO_AD_B1_00, ADC1, 5, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 0, 17, GPIO_AD_B1_01, ADC1, 6, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 0, 18, GPIO_AD_B1_02, ADC1, 7, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 0, 19, GPIO_AD_B1_03, ADC1, 8, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 0, 20, GPIO_AD_B1_04, ADC1, 9, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 0, 21, GPIO_AD_B1_05, ADC1, 10, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 0, 22, GPIO_AD_B1_06, ADC1, 11, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 0, 23, GPIO_AD_B1_07, ADC1, 12, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 0, 24, GPIO_AD_B1_08, ADC1, 13, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 0, 25, GPIO_AD_B1_09, ADC1, 14, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 0, 26, GPIO_AD_B1_10, ADC1, 15, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 0, 27, GPIO_AD_B1_11, ADC1, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 0, 28, GPIO_AD_B1_12, ADC2, 1, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 0, 29, GPIO_AD_B1_13, ADC2, 2, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 0, 30, GPIO_AD_B1_14, ADC2, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 0, 31, GPIO_AD_B1_15, ADC2, 4, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_00 = PIN(GPIO2, 0, GPIO_B0_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_01 = PIN(GPIO2, 1, GPIO_B0_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_02 = PIN(GPIO2, 2, GPIO_B0_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_03 = PIN(GPIO2, 3, GPIO_B0_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_04 = PIN(GPIO2, 4, GPIO_B0_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_05 = PIN(GPIO2, 5, GPIO_B0_05, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_06 = PIN(GPIO2, 6, GPIO_B0_06, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_07 = PIN(GPIO2, 7, GPIO_B0_07, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_08 = PIN(GPIO2, 8, GPIO_B0_08, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_09 = PIN(GPIO2, 9, GPIO_B0_09, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_10 = PIN(GPIO2, 10, GPIO_B0_10, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_11 = PIN(GPIO2, 11, GPIO_B0_11, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_12 = PIN(GPIO2, 12, GPIO_B0_12, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_13 = PIN(GPIO2, 13, GPIO_B0_13, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_14 = PIN(GPIO2, 14, GPIO_B0_14, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B0_15 = PIN(GPIO2, 15, GPIO_B0_15, NO_ADC, 0); +const mcu_pin_obj_t pin_GPIO_B0_00 = PIN(GPIO2, 1, 0, GPIO_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_01 = PIN(GPIO2, 1, 1, GPIO_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_02 = PIN(GPIO2, 1, 2, GPIO_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_03 = PIN(GPIO2, 1, 3, GPIO_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_04 = PIN(GPIO2, 1, 4, GPIO_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_05 = PIN(GPIO2, 1, 5, GPIO_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_06 = PIN(GPIO2, 1, 6, GPIO_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_07 = PIN(GPIO2, 1, 7, GPIO_B0_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_08 = PIN(GPIO2, 1, 8, GPIO_B0_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_09 = PIN(GPIO2, 1, 9, GPIO_B0_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_10 = PIN(GPIO2, 1, 10, GPIO_B0_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_11 = PIN(GPIO2, 1, 11, GPIO_B0_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_12 = PIN(GPIO2, 1, 12, GPIO_B0_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_13 = PIN(GPIO2, 1, 13, GPIO_B0_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_14 = PIN(GPIO2, 1, 14, GPIO_B0_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_15 = PIN(GPIO2, 1, 15, GPIO_B0_15, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_00 = PIN(GPIO2, 16, GPIO_B1_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_01 = PIN(GPIO2, 17, GPIO_B1_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_02 = PIN(GPIO2, 18, GPIO_B1_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_03 = PIN(GPIO2, 19, GPIO_B1_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_04 = PIN(GPIO2, 20, GPIO_B1_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_05 = PIN(GPIO2, 21, GPIO_B1_05, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_06 = PIN(GPIO2, 22, GPIO_B1_06, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_07 = PIN(GPIO2, 23, GPIO_B1_07, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_08 = PIN(GPIO2, 24, GPIO_B1_08, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_09 = PIN(GPIO2, 25, GPIO_B1_09, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_10 = PIN(GPIO2, 26, GPIO_B1_10, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_11 = PIN(GPIO2, 27, GPIO_B1_11, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_12 = PIN(GPIO2, 28, GPIO_B1_12, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_13 = PIN(GPIO2, 29, GPIO_B1_13, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_14 = PIN(GPIO2, 30, GPIO_B1_14, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_B1_15 = PIN(GPIO2, 31, GPIO_B1_15, NO_ADC, 0); +const mcu_pin_obj_t pin_GPIO_B1_00 = PIN(GPIO2, 1, 16, GPIO_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_01 = PIN(GPIO2, 1, 17, GPIO_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_02 = PIN(GPIO2, 1, 18, GPIO_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_03 = PIN(GPIO2, 1, 19, GPIO_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_04 = PIN(GPIO2, 1, 20, GPIO_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_05 = PIN(GPIO2, 1, 21, GPIO_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_06 = PIN(GPIO2, 1, 22, GPIO_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_07 = PIN(GPIO2, 1, 23, GPIO_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_08 = PIN(GPIO2, 1, 24, GPIO_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_09 = PIN(GPIO2, 1, 25, GPIO_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_10 = PIN(GPIO2, 1, 26, GPIO_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_11 = PIN(GPIO2, 1, 27, GPIO_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_12 = PIN(GPIO2, 1, 28, GPIO_B1_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_13 = PIN(GPIO2, 1, 29, GPIO_B1_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_14 = PIN(GPIO2, 1, 30, GPIO_B1_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_15 = PIN(GPIO2, 1, 31, GPIO_B1_15, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_00 = PIN(GPIO3, 12, GPIO_SD_B0_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B0_01 = PIN(GPIO3, 13, GPIO_SD_B0_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B0_02 = PIN(GPIO3, 14, GPIO_SD_B0_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B0_03 = PIN(GPIO3, 15, GPIO_SD_B0_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B0_04 = PIN(GPIO3, 16, GPIO_SD_B0_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B0_05 = PIN(GPIO3, 17, GPIO_SD_B0_05, NO_ADC, 0); +const mcu_pin_obj_t pin_GPIO_SD_B0_00 = PIN(GPIO3, 2, 12, GPIO_SD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_01 = PIN(GPIO3, 2, 13, GPIO_SD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_02 = PIN(GPIO3, 2, 14, GPIO_SD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_03 = PIN(GPIO3, 2, 15, GPIO_SD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_04 = PIN(GPIO3, 2, 16, GPIO_SD_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_05 = PIN(GPIO3, 2, 17, GPIO_SD_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO3, 0, GPIO_B1_00, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO3, 1, GPIO_B1_01, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO3, 2, GPIO_B1_02, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO3, 3, GPIO_B1_03, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO3, 4, GPIO_B1_04, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO3, 5, GPIO_B1_05, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_06 = PIN(GPIO3, 6, GPIO_B1_06, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_07 = PIN(GPIO3, 7, GPIO_B1_07, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 8, GPIO_B1_08, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 9, GPIO_B1_09, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 10, GPIO_B1_10, NO_ADC, 0); -const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 11, GPIO_B1_11, NO_ADC, 0); +const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO3, 2, 0, GPIO_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO3, 2, 1, GPIO_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO3, 2, 2, GPIO_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO3, 2, 3, GPIO_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO3, 2, 4, GPIO_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO3, 2, 5, GPIO_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_06 = PIN(GPIO3, 2, 6, GPIO_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_07 = PIN(GPIO3, 2, 7, GPIO_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 2, 8, GPIO_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 2, 9, GPIO_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 2, 10, GPIO_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 2, 11, GPIO_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); + +const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT] = { + pin_GPIO_EMC_00, + pin_GPIO_EMC_01, + pin_GPIO_EMC_02, + pin_GPIO_EMC_03, + pin_GPIO_EMC_04, + pin_GPIO_EMC_05, + pin_GPIO_EMC_06, + pin_GPIO_EMC_07, + pin_GPIO_EMC_08, + pin_GPIO_EMC_09, + pin_GPIO_EMC_10, + pin_GPIO_EMC_11, + pin_GPIO_EMC_12, + pin_GPIO_EMC_13, + pin_GPIO_EMC_14, + pin_GPIO_EMC_15, + pin_GPIO_EMC_16, + pin_GPIO_EMC_17, + pin_GPIO_EMC_18, + pin_GPIO_EMC_19, + pin_GPIO_EMC_20, + pin_GPIO_EMC_21, + pin_GPIO_EMC_22, + pin_GPIO_EMC_23, + pin_GPIO_EMC_24, + pin_GPIO_EMC_25, + pin_GPIO_EMC_26, + pin_GPIO_EMC_27, + pin_GPIO_EMC_28, + pin_GPIO_EMC_29, + pin_GPIO_EMC_30, + pin_GPIO_EMC_31, + pin_GPIO_EMC_32, + pin_GPIO_EMC_33, + pin_GPIO_EMC_34, + pin_GPIO_EMC_35, + pin_GPIO_EMC_36, + pin_GPIO_EMC_37, + pin_GPIO_EMC_38, + pin_GPIO_EMC_39, + pin_GPIO_EMC_40, + pin_GPIO_EMC_41, + pin_GPIO_AD_B0_00, + pin_GPIO_AD_B0_01, + pin_GPIO_AD_B0_02, + pin_GPIO_AD_B0_03, + pin_GPIO_AD_B0_04, + pin_GPIO_AD_B0_05, + pin_GPIO_AD_B0_06, + pin_GPIO_AD_B0_07, + pin_GPIO_AD_B0_08, + pin_GPIO_AD_B0_09, + pin_GPIO_AD_B0_10, + pin_GPIO_AD_B0_11, + pin_GPIO_AD_B0_12, + pin_GPIO_AD_B0_13, + pin_GPIO_AD_B0_14, + pin_GPIO_AD_B0_15, + pin_GPIO_AD_B1_00, + pin_GPIO_AD_B1_01, + pin_GPIO_AD_B1_02, + pin_GPIO_AD_B1_03, + pin_GPIO_AD_B1_04, + pin_GPIO_AD_B1_05, + pin_GPIO_AD_B1_06, + pin_GPIO_AD_B1_07, + pin_GPIO_AD_B1_08, + pin_GPIO_AD_B1_09, + pin_GPIO_AD_B1_10, + pin_GPIO_AD_B1_11, + pin_GPIO_AD_B1_12, + pin_GPIO_AD_B1_13, + pin_GPIO_AD_B1_14, + pin_GPIO_AD_B1_15, + pin_GPIO_B0_00, + pin_GPIO_B0_01, + pin_GPIO_B0_02, + pin_GPIO_B0_03, + pin_GPIO_B0_04, + pin_GPIO_B0_05, + pin_GPIO_B0_06, + pin_GPIO_B0_07, + pin_GPIO_B0_08, + pin_GPIO_B0_09, + pin_GPIO_B0_10, + pin_GPIO_B0_11, + pin_GPIO_B0_12, + pin_GPIO_B0_13, + pin_GPIO_B0_14, + pin_GPIO_B0_15, + pin_GPIO_B1_00, + pin_GPIO_B1_01, + pin_GPIO_B1_02, + pin_GPIO_B1_03, + pin_GPIO_B1_04, + pin_GPIO_B1_05, + pin_GPIO_B1_06, + pin_GPIO_B1_07, + pin_GPIO_B1_08, + pin_GPIO_B1_09, + pin_GPIO_B1_10, + pin_GPIO_B1_11, + pin_GPIO_B1_12, + pin_GPIO_B1_13, + pin_GPIO_B1_14, + pin_GPIO_B1_15, + pin_GPIO_SD_B0_00, + pin_GPIO_SD_B0_01, + pin_GPIO_SD_B0_02, + pin_GPIO_SD_B0_03, + pin_GPIO_SD_B0_04, + pin_GPIO_SD_B0_05, + pin_GPIO_SD_B1_00, + pin_GPIO_SD_B1_01, + pin_GPIO_SD_B1_02, + pin_GPIO_SD_B1_03, + pin_GPIO_SD_B1_04, + pin_GPIO_SD_B1_05, + pin_GPIO_SD_B1_06, + pin_GPIO_SD_B1_07, + pin_GPIO_SD_B1_08, + pin_GPIO_SD_B1_09, + pin_GPIO_SD_B1_10, + pin_GPIO_SD_B1_11, +}; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h index 1e69224595..6a72eaa7b2 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h @@ -158,4 +158,6 @@ extern const mcu_pin_obj_t pin_GPIO_SD_B1_09; extern const mcu_pin_obj_t pin_GPIO_SD_B1_10; extern const mcu_pin_obj_t pin_GPIO_SD_B1_11; +extern const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT]; + #endif // MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1062_PINS_H diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h index 404a411e18..68710f999a 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h @@ -48,22 +48,30 @@ extern const mp_obj_type_t mcu_pin_type; typedef struct { mp_obj_base_t base; GPIO_Type *gpio; - uint8_t number; + uint8_t port:3; //0 start index + uint8_t number:5; + uint16_t mux_idx; uint32_t mux_reg; uint32_t cfg_reg; ADC_Type *adc; uint8_t adc_channel; + uint32_t mux_reset; + uint32_t pad_reset; } mcu_pin_obj_t; -#define PIN(p_gpio, p_number, p_enum, p_adc, p_adc_channel) \ +#define PIN(p_gpio, p_port, p_number, p_enum, p_adc, p_adc_channel, p_mux_reset, p_pad_reset) \ { \ { &mcu_pin_type }, \ .gpio = p_gpio, \ + .port = p_port, \ .number = p_number, \ + .mux_idx = kIOMUXC_SW_MUX_CTL_PAD_ ## p_enum, \ .mux_reg = (uint32_t)&(IOMUXC->SW_MUX_CTL_PAD[kIOMUXC_SW_MUX_CTL_PAD_ ## p_enum]), \ .cfg_reg = (uint32_t)&(IOMUXC->SW_PAD_CTL_PAD[kIOMUXC_SW_PAD_CTL_PAD_ ## p_enum]), \ .adc = p_adc, \ .adc_channel = p_adc_channel, \ + .mux_reset = p_mux_reset, \ + .pad_reset = p_pad_reset, \ } #ifdef MIMXRT1011_SERIES From 2acd173e1459f7816e687ba5362a737e67c205fb Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 19 May 2020 13:54:47 -0400 Subject: [PATCH 02/13] Implement core requested changes --- ports/mimxrt10xx/Makefile | 4 +- .../mimxrt10xx/boards/feather_m7_1011/board.c | 5 - .../boards/feather_mimxrt1011/board.c | 5 - .../boards/feather_mimxrt1062/board.c | 11 -- .../common-hal/microcontroller/Pin.c | 14 +- .../common-hal/microcontroller/__init__.c | 91 +++++++------ .../peripherals/mimxrt10xx/MIMXRT1011/pins.c | 47 ------- .../peripherals/mimxrt10xx/MIMXRT1021/pins.c | 96 ------------- .../peripherals/mimxrt10xx/MIMXRT1062/pins.c | 127 ------------------ 9 files changed, 54 insertions(+), 346 deletions(-) diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 9e2c6d236d..922978ac2e 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -82,17 +82,15 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_ #Debugging/Optimization ifeq ($(DEBUG), 1) - CFLAGS += -ggdb # You may want to disable -flto if it interferes with debugging. # CFLAGS += -flto -flto-partition=none # You may want to enable these flags to make setting breakpoints easier. CFLAGS += -fno-inline -fno-ipa-sra else - CFLAGS += -ggdb #CFLAGS += -flto -flto-partition=none endif -CFLAGS += $(INC) -Wall -Wno-cast-align -std=gnu11 -nostdlib $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) +CFLAGS += $(INC) -ggdb -Wall -Wno-cast-align -std=gnu11 -nostdlib $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) # TODO: add these when -Werror is applied # Disable some warnings, as do most ports. NXP SDK causes undef, tinyusb causes cast-align diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/board.c b/ports/mimxrt10xx/boards/feather_m7_1011/board.c index 8763cd5708..ed543e1b06 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/board.c +++ b/ports/mimxrt10xx/boards/feather_m7_1011/board.c @@ -33,7 +33,6 @@ void board_init(void) { // SWD Pins common_hal_never_reset_pin(&pin_GPIO_AD_13);//SWDIO common_hal_never_reset_pin(&pin_GPIO_AD_12);//SWCLK - common_hal_never_reset_pin(&pin_GPIO_AD_09);//SWO // FLEX flash common_hal_never_reset_pin(&pin_GPIO_SD_12); @@ -43,10 +42,6 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO_SD_08); common_hal_never_reset_pin(&pin_GPIO_SD_07); common_hal_never_reset_pin(&pin_GPIO_SD_06); - - // USB Pins - common_hal_never_reset_pin(&pin_GPIO_12); - common_hal_never_reset_pin(&pin_GPIO_13); } bool board_requests_safe_mode(void) { diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c index 8763cd5708..ed543e1b06 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c @@ -33,7 +33,6 @@ void board_init(void) { // SWD Pins common_hal_never_reset_pin(&pin_GPIO_AD_13);//SWDIO common_hal_never_reset_pin(&pin_GPIO_AD_12);//SWCLK - common_hal_never_reset_pin(&pin_GPIO_AD_09);//SWO // FLEX flash common_hal_never_reset_pin(&pin_GPIO_SD_12); @@ -43,10 +42,6 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO_SD_08); common_hal_never_reset_pin(&pin_GPIO_SD_07); common_hal_never_reset_pin(&pin_GPIO_SD_06); - - // USB Pins - common_hal_never_reset_pin(&pin_GPIO_12); - common_hal_never_reset_pin(&pin_GPIO_13); } bool board_requests_safe_mode(void) { diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c b/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c index c3895473ef..9878a62a29 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c @@ -33,25 +33,14 @@ void board_init(void) { // SWD Pins common_hal_never_reset_pin(&pin_GPIO_AD_B0_06);//SWDIO common_hal_never_reset_pin(&pin_GPIO_AD_B0_07);//SWCLK - common_hal_never_reset_pin(&pin_GPIO_AD_B0_10);//SWO // FLEX flash - common_hal_never_reset_pin(&pin_GPIO_SD_B1_00); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_01); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_02); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_03); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_04); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_05); common_hal_never_reset_pin(&pin_GPIO_SD_B1_06); common_hal_never_reset_pin(&pin_GPIO_SD_B1_07); common_hal_never_reset_pin(&pin_GPIO_SD_B1_08); common_hal_never_reset_pin(&pin_GPIO_SD_B1_09); common_hal_never_reset_pin(&pin_GPIO_SD_B1_10); common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); - - // USB Pins - common_hal_never_reset_pin(&pin_GPIO_AD_B0_01); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_03); } bool board_requests_safe_mode(void) { diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c index 0b438144ca..783ae4877d 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c @@ -24,7 +24,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - +#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/shared/rgb_led_status.h" @@ -47,12 +47,10 @@ void reset_all_pins(void) { claimed_pins[i] = never_reset_pins[i]; } for (uint8_t i = 0; i < IOMUXC_SW_PAD_CTL_PAD_COUNT; i++) { - // mp_printf(&mp_plat_print, "CTL MUX i=%d:%x\n",i,IOMUXC->SW_MUX_CTL_PAD[i]); - // mp_printf(&mp_plat_print, "CTL PAD i=%d:%x\n",i,IOMUXC->SW_PAD_CTL_PAD[i]); - if(!(never_reset_pins[mcu_pin_list[i].port] & (1 << mcu_pin_list[i].number))) { - // mp_printf(&mp_plat_print, "SUCCESS\n"); - IOMUXC->SW_MUX_CTL_PAD[i] = mcu_pin_list[i].mux_reset; - IOMUXC->SW_PAD_CTL_PAD[i] = mcu_pin_list[i].pad_reset; + if(!(never_reset_pins[((mcu_pin_obj_t*)(mcu_pin_globals.map.table[i].value))->port] + & (1 << ((mcu_pin_obj_t*)(mcu_pin_globals.map.table[i].value))->number))) { + IOMUXC->SW_MUX_CTL_PAD[i] = ((mcu_pin_obj_t*)(mcu_pin_globals.map.table[i].value))->mux_reset; + IOMUXC->SW_PAD_CTL_PAD[i] = ((mcu_pin_obj_t*)(mcu_pin_globals.map.table[i].value))->pad_reset; } } @@ -116,7 +114,7 @@ void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { } void common_hal_mcu_pin_reset_number(uint8_t pin_no) { - common_hal_reset_pin(&mcu_pin_list[pin_no]); + common_hal_reset_pin((mcu_pin_obj_t*)(mcu_pin_globals.map.table[pin_no].value)); } // TODO: replace use of GPIO pointers in pin struct with this system? diff --git a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c index a9f4c740fe..6a8537e2da 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c @@ -107,53 +107,53 @@ const nvm_bytearray_obj_t common_hal_mcu_nvm_obj = { #endif // This maps MCU pin names to pin objects. +// NOTE: for all i.MX chips, order MUST match _iomuxc_sw_mux_ctl_pad enum STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[] = { #ifdef MIMXRT1011_SERIES - { MP_ROM_QSTR(MP_QSTR_GPIO_00), MP_ROM_PTR(&pin_GPIO_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_01), MP_ROM_PTR(&pin_GPIO_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_02), MP_ROM_PTR(&pin_GPIO_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_03), MP_ROM_PTR(&pin_GPIO_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_04), MP_ROM_PTR(&pin_GPIO_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_05), MP_ROM_PTR(&pin_GPIO_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_06), MP_ROM_PTR(&pin_GPIO_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_07), MP_ROM_PTR(&pin_GPIO_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_08), MP_ROM_PTR(&pin_GPIO_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_09), MP_ROM_PTR(&pin_GPIO_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_10), MP_ROM_PTR(&pin_GPIO_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_11), MP_ROM_PTR(&pin_GPIO_11) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_12), MP_ROM_PTR(&pin_GPIO_12) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_13), MP_ROM_PTR(&pin_GPIO_13) }, - - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_00), MP_ROM_PTR(&pin_GPIO_SD_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_01), MP_ROM_PTR(&pin_GPIO_SD_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_02), MP_ROM_PTR(&pin_GPIO_SD_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_03), MP_ROM_PTR(&pin_GPIO_SD_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_04), MP_ROM_PTR(&pin_GPIO_SD_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_05), MP_ROM_PTR(&pin_GPIO_SD_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_06), MP_ROM_PTR(&pin_GPIO_SD_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_07), MP_ROM_PTR(&pin_GPIO_SD_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_08), MP_ROM_PTR(&pin_GPIO_SD_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_09), MP_ROM_PTR(&pin_GPIO_SD_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_10), MP_ROM_PTR(&pin_GPIO_SD_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_11), MP_ROM_PTR(&pin_GPIO_SD_11) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_12), MP_ROM_PTR(&pin_GPIO_SD_12) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_13), MP_ROM_PTR(&pin_GPIO_SD_13) }, - - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_00), MP_ROM_PTR(&pin_GPIO_AD_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_01), MP_ROM_PTR(&pin_GPIO_AD_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_02), MP_ROM_PTR(&pin_GPIO_AD_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_03), MP_ROM_PTR(&pin_GPIO_AD_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_04), MP_ROM_PTR(&pin_GPIO_AD_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_05), MP_ROM_PTR(&pin_GPIO_AD_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_06), MP_ROM_PTR(&pin_GPIO_AD_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_07), MP_ROM_PTR(&pin_GPIO_AD_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_08), MP_ROM_PTR(&pin_GPIO_AD_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_09), MP_ROM_PTR(&pin_GPIO_AD_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_10), MP_ROM_PTR(&pin_GPIO_AD_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_11), MP_ROM_PTR(&pin_GPIO_AD_11) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_12), MP_ROM_PTR(&pin_GPIO_AD_12) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_13), MP_ROM_PTR(&pin_GPIO_AD_13) }, { MP_ROM_QSTR(MP_QSTR_GPIO_AD_14), MP_ROM_PTR(&pin_GPIO_AD_14) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_13), MP_ROM_PTR(&pin_GPIO_AD_13) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_12), MP_ROM_PTR(&pin_GPIO_AD_12) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_11), MP_ROM_PTR(&pin_GPIO_AD_11) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_10), MP_ROM_PTR(&pin_GPIO_AD_10) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_09), MP_ROM_PTR(&pin_GPIO_AD_09) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_08), MP_ROM_PTR(&pin_GPIO_AD_08) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_07), MP_ROM_PTR(&pin_GPIO_AD_07) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_06), MP_ROM_PTR(&pin_GPIO_AD_06) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_05), MP_ROM_PTR(&pin_GPIO_AD_05) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_04), MP_ROM_PTR(&pin_GPIO_AD_04) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_03), MP_ROM_PTR(&pin_GPIO_AD_03) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_02), MP_ROM_PTR(&pin_GPIO_AD_02) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_01), MP_ROM_PTR(&pin_GPIO_AD_01) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_AD_00), MP_ROM_PTR(&pin_GPIO_AD_00) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_14), MP_ROM_PTR(&pin_GPIO_SD_14) }, //spooky ghost pin + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_13), MP_ROM_PTR(&pin_GPIO_SD_13) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_12), MP_ROM_PTR(&pin_GPIO_SD_12) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_11), MP_ROM_PTR(&pin_GPIO_SD_11) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_10), MP_ROM_PTR(&pin_GPIO_SD_10) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_09), MP_ROM_PTR(&pin_GPIO_SD_09) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_08), MP_ROM_PTR(&pin_GPIO_SD_08) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_07), MP_ROM_PTR(&pin_GPIO_SD_07) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_06), MP_ROM_PTR(&pin_GPIO_SD_06) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_05), MP_ROM_PTR(&pin_GPIO_SD_05) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_04), MP_ROM_PTR(&pin_GPIO_SD_04) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_03), MP_ROM_PTR(&pin_GPIO_SD_03) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_02), MP_ROM_PTR(&pin_GPIO_SD_02) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_01), MP_ROM_PTR(&pin_GPIO_SD_01) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_00), MP_ROM_PTR(&pin_GPIO_SD_00) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_13), MP_ROM_PTR(&pin_GPIO_13) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_12), MP_ROM_PTR(&pin_GPIO_12) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_11), MP_ROM_PTR(&pin_GPIO_11) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_10), MP_ROM_PTR(&pin_GPIO_10) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_09), MP_ROM_PTR(&pin_GPIO_09) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_08), MP_ROM_PTR(&pin_GPIO_08) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_07), MP_ROM_PTR(&pin_GPIO_07) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_06), MP_ROM_PTR(&pin_GPIO_06) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_05), MP_ROM_PTR(&pin_GPIO_05) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_04), MP_ROM_PTR(&pin_GPIO_04) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_03), MP_ROM_PTR(&pin_GPIO_03) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_02), MP_ROM_PTR(&pin_GPIO_02) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_01), MP_ROM_PTR(&pin_GPIO_01) }, + { MP_ROM_QSTR(MP_QSTR_GPIO_00), MP_ROM_PTR(&pin_GPIO_00) }, #else { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_00), MP_ROM_PTR(&pin_GPIO_EMC_00) }, { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_01), MP_ROM_PTR(&pin_GPIO_EMC_01) }, @@ -269,6 +269,9 @@ STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B0_03), MP_ROM_PTR(&pin_GPIO_SD_B0_03) }, { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B0_04), MP_ROM_PTR(&pin_GPIO_SD_B0_04) }, { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B0_05), MP_ROM_PTR(&pin_GPIO_SD_B0_05) }, + #ifdef MIMXRT1021_SERIES + { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B0_06), MP_ROM_PTR(&pin_GPIO_SD_B0_06) }, + #endif { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_00), MP_ROM_PTR(&pin_GPIO_SD_B1_00) }, { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_01), MP_ROM_PTR(&pin_GPIO_SD_B1_01) }, { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_02), MP_ROM_PTR(&pin_GPIO_SD_B1_02) }, diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c index 034efb3b6e..b60dcbdabb 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c @@ -76,50 +76,3 @@ const mcu_pin_obj_t pin_GPIO_SD_12 = PIN(GPIO2, 1, 12, GPIO_SD_12, NO_ADC, 0, 0x const mcu_pin_obj_t pin_GPIO_SD_13 = PIN(GPIO2, 1, 13, GPIO_SD_13, NO_ADC, 0, 0x00000005, 0x000010A0); const mcu_pin_obj_t pin_GPIO_SD_14 = PIN(GPIO2, 1, 14, GPIO_SD_14, NO_ADC, 0, 0x00000000, 0x000010A0); // pin_GPIO_SD_14 isn't actually used as a pad but we include it anyway to make resetting easier - -const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT] = { - pin_GPIO_AD_14, - pin_GPIO_AD_13, - pin_GPIO_AD_12, - pin_GPIO_AD_11, - pin_GPIO_AD_10, - pin_GPIO_AD_09, - pin_GPIO_AD_08, - pin_GPIO_AD_07, - pin_GPIO_AD_06, - pin_GPIO_AD_05, - pin_GPIO_AD_04, - pin_GPIO_AD_03, - pin_GPIO_AD_02, - pin_GPIO_AD_01, - pin_GPIO_AD_00, - pin_GPIO_SD_14, //spooky ghost pin - pin_GPIO_SD_13, - pin_GPIO_SD_12, - pin_GPIO_SD_11, - pin_GPIO_SD_10, - pin_GPIO_SD_09, - pin_GPIO_SD_08, - pin_GPIO_SD_07, - pin_GPIO_SD_06, - pin_GPIO_SD_05, - pin_GPIO_SD_04, - pin_GPIO_SD_03, - pin_GPIO_SD_02, - pin_GPIO_SD_01, - pin_GPIO_SD_00, - pin_GPIO_13, - pin_GPIO_12, - pin_GPIO_11, - pin_GPIO_10, - pin_GPIO_09, - pin_GPIO_08, - pin_GPIO_07, - pin_GPIO_06, - pin_GPIO_05, - pin_GPIO_04, - pin_GPIO_03, - pin_GPIO_02, - pin_GPIO_01, - pin_GPIO_00, -}; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c index 629fdf4bd6..d992931f2c 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c @@ -126,99 +126,3 @@ const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 2, 28, GPIO_SD_B1_08, NO_ADC, const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 2, 29, GPIO_SD_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 2, 30, GPIO_SD_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 2, 31, GPIO_SD_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT] = { - pin_GPIO_EMC_00, - pin_GPIO_EMC_01, - pin_GPIO_EMC_02, - pin_GPIO_EMC_03, - pin_GPIO_EMC_04, - pin_GPIO_EMC_05, - pin_GPIO_EMC_06, - pin_GPIO_EMC_07, - pin_GPIO_EMC_08, - pin_GPIO_EMC_09, - pin_GPIO_EMC_10, - pin_GPIO_EMC_11, - pin_GPIO_EMC_12, - pin_GPIO_EMC_13, - pin_GPIO_EMC_14, - pin_GPIO_EMC_15, - pin_GPIO_EMC_16, - pin_GPIO_EMC_17, - pin_GPIO_EMC_18, - pin_GPIO_EMC_19, - pin_GPIO_EMC_20, - pin_GPIO_EMC_21, - pin_GPIO_EMC_22, - pin_GPIO_EMC_23, - pin_GPIO_EMC_24, - pin_GPIO_EMC_25, - pin_GPIO_EMC_26, - pin_GPIO_EMC_27, - pin_GPIO_EMC_28, - pin_GPIO_EMC_29, - pin_GPIO_EMC_30, - pin_GPIO_EMC_31, - pin_GPIO_EMC_32, - pin_GPIO_EMC_33, - pin_GPIO_EMC_34, - pin_GPIO_EMC_35, - pin_GPIO_EMC_36, - pin_GPIO_EMC_37, - pin_GPIO_EMC_38, - pin_GPIO_EMC_39, - pin_GPIO_EMC_40, - pin_GPIO_EMC_41, - pin_GPIO_AD_B0_00, - pin_GPIO_AD_B0_01, - pin_GPIO_AD_B0_02, - pin_GPIO_AD_B0_03, - pin_GPIO_AD_B0_04, - pin_GPIO_AD_B0_05, - pin_GPIO_AD_B0_06, - pin_GPIO_AD_B0_07, - pin_GPIO_AD_B0_08, - pin_GPIO_AD_B0_09, - pin_GPIO_AD_B0_10, - pin_GPIO_AD_B0_11, - pin_GPIO_AD_B0_12, - pin_GPIO_AD_B0_13, - pin_GPIO_AD_B0_14, - pin_GPIO_AD_B0_15, - pin_GPIO_AD_B1_00, - pin_GPIO_AD_B1_01, - pin_GPIO_AD_B1_02, - pin_GPIO_AD_B1_03, - pin_GPIO_AD_B1_04, - pin_GPIO_AD_B1_05, - pin_GPIO_AD_B1_06, - pin_GPIO_AD_B1_07, - pin_GPIO_AD_B1_08, - pin_GPIO_AD_B1_09, - pin_GPIO_AD_B1_10, - pin_GPIO_AD_B1_11, - pin_GPIO_AD_B1_12, - pin_GPIO_AD_B1_13, - pin_GPIO_AD_B1_14, - pin_GPIO_AD_B1_15, - pin_GPIO_SD_B0_00, - pin_GPIO_SD_B0_01, - pin_GPIO_SD_B0_02, - pin_GPIO_SD_B0_03, - pin_GPIO_SD_B0_04, - pin_GPIO_SD_B0_05, - pin_GPIO_SD_B0_06, - pin_GPIO_SD_B1_00, - pin_GPIO_SD_B1_01, - pin_GPIO_SD_B1_02, - pin_GPIO_SD_B1_03, - pin_GPIO_SD_B1_04, - pin_GPIO_SD_B1_05, - pin_GPIO_SD_B1_06, - pin_GPIO_SD_B1_07, - pin_GPIO_SD_B1_08, - pin_GPIO_SD_B1_09, - pin_GPIO_SD_B1_10, - pin_GPIO_SD_B1_11, -}; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c index 5b3fce1f5e..4bb025f372 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c @@ -159,130 +159,3 @@ const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 2, 8, GPIO_B1_08, NO_ADC, 0, const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 2, 9, GPIO_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 2, 10, GPIO_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 2, 11, GPIO_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT] = { - pin_GPIO_EMC_00, - pin_GPIO_EMC_01, - pin_GPIO_EMC_02, - pin_GPIO_EMC_03, - pin_GPIO_EMC_04, - pin_GPIO_EMC_05, - pin_GPIO_EMC_06, - pin_GPIO_EMC_07, - pin_GPIO_EMC_08, - pin_GPIO_EMC_09, - pin_GPIO_EMC_10, - pin_GPIO_EMC_11, - pin_GPIO_EMC_12, - pin_GPIO_EMC_13, - pin_GPIO_EMC_14, - pin_GPIO_EMC_15, - pin_GPIO_EMC_16, - pin_GPIO_EMC_17, - pin_GPIO_EMC_18, - pin_GPIO_EMC_19, - pin_GPIO_EMC_20, - pin_GPIO_EMC_21, - pin_GPIO_EMC_22, - pin_GPIO_EMC_23, - pin_GPIO_EMC_24, - pin_GPIO_EMC_25, - pin_GPIO_EMC_26, - pin_GPIO_EMC_27, - pin_GPIO_EMC_28, - pin_GPIO_EMC_29, - pin_GPIO_EMC_30, - pin_GPIO_EMC_31, - pin_GPIO_EMC_32, - pin_GPIO_EMC_33, - pin_GPIO_EMC_34, - pin_GPIO_EMC_35, - pin_GPIO_EMC_36, - pin_GPIO_EMC_37, - pin_GPIO_EMC_38, - pin_GPIO_EMC_39, - pin_GPIO_EMC_40, - pin_GPIO_EMC_41, - pin_GPIO_AD_B0_00, - pin_GPIO_AD_B0_01, - pin_GPIO_AD_B0_02, - pin_GPIO_AD_B0_03, - pin_GPIO_AD_B0_04, - pin_GPIO_AD_B0_05, - pin_GPIO_AD_B0_06, - pin_GPIO_AD_B0_07, - pin_GPIO_AD_B0_08, - pin_GPIO_AD_B0_09, - pin_GPIO_AD_B0_10, - pin_GPIO_AD_B0_11, - pin_GPIO_AD_B0_12, - pin_GPIO_AD_B0_13, - pin_GPIO_AD_B0_14, - pin_GPIO_AD_B0_15, - pin_GPIO_AD_B1_00, - pin_GPIO_AD_B1_01, - pin_GPIO_AD_B1_02, - pin_GPIO_AD_B1_03, - pin_GPIO_AD_B1_04, - pin_GPIO_AD_B1_05, - pin_GPIO_AD_B1_06, - pin_GPIO_AD_B1_07, - pin_GPIO_AD_B1_08, - pin_GPIO_AD_B1_09, - pin_GPIO_AD_B1_10, - pin_GPIO_AD_B1_11, - pin_GPIO_AD_B1_12, - pin_GPIO_AD_B1_13, - pin_GPIO_AD_B1_14, - pin_GPIO_AD_B1_15, - pin_GPIO_B0_00, - pin_GPIO_B0_01, - pin_GPIO_B0_02, - pin_GPIO_B0_03, - pin_GPIO_B0_04, - pin_GPIO_B0_05, - pin_GPIO_B0_06, - pin_GPIO_B0_07, - pin_GPIO_B0_08, - pin_GPIO_B0_09, - pin_GPIO_B0_10, - pin_GPIO_B0_11, - pin_GPIO_B0_12, - pin_GPIO_B0_13, - pin_GPIO_B0_14, - pin_GPIO_B0_15, - pin_GPIO_B1_00, - pin_GPIO_B1_01, - pin_GPIO_B1_02, - pin_GPIO_B1_03, - pin_GPIO_B1_04, - pin_GPIO_B1_05, - pin_GPIO_B1_06, - pin_GPIO_B1_07, - pin_GPIO_B1_08, - pin_GPIO_B1_09, - pin_GPIO_B1_10, - pin_GPIO_B1_11, - pin_GPIO_B1_12, - pin_GPIO_B1_13, - pin_GPIO_B1_14, - pin_GPIO_B1_15, - pin_GPIO_SD_B0_00, - pin_GPIO_SD_B0_01, - pin_GPIO_SD_B0_02, - pin_GPIO_SD_B0_03, - pin_GPIO_SD_B0_04, - pin_GPIO_SD_B0_05, - pin_GPIO_SD_B1_00, - pin_GPIO_SD_B1_01, - pin_GPIO_SD_B1_02, - pin_GPIO_SD_B1_03, - pin_GPIO_SD_B1_04, - pin_GPIO_SD_B1_05, - pin_GPIO_SD_B1_06, - pin_GPIO_SD_B1_07, - pin_GPIO_SD_B1_08, - pin_GPIO_SD_B1_09, - pin_GPIO_SD_B1_10, - pin_GPIO_SD_B1_11, -}; From b310b040073d636ead04d3c9c3a4338e18e1627d Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 19 May 2020 14:20:07 -0400 Subject: [PATCH 03/13] Remove pin/port distinction --- .../common-hal/digitalio/DigitalInOut.c | 2 +- .../common-hal/microcontroller/Pin.c | 49 ++-- .../common-hal/microcontroller/Pin.h | 3 - .../peripherals/mimxrt10xx/MIMXRT1011/pins.c | 90 +++---- .../peripherals/mimxrt10xx/MIMXRT1021/pins.c | 190 +++++++------ .../peripherals/mimxrt10xx/MIMXRT1062/pins.c | 254 +++++++++--------- .../mimxrt10xx/peripherals/mimxrt10xx/pins.h | 6 +- 7 files changed, 283 insertions(+), 311 deletions(-) diff --git a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c index 4c2f8c87ee..4931599d4e 100644 --- a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c +++ b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c @@ -74,7 +74,7 @@ digitalinout_result_t common_hal_digitalio_digitalinout_construct( void common_hal_digitalio_digitalinout_never_reset( digitalio_digitalinout_obj_t *self) { - never_reset_pin_number(self->pin->port, self->pin->number); + common_hal_never_reset_pin(self->pin); } bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t* self) { diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c index 783ae4877d..4989a91863 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c @@ -34,21 +34,19 @@ bool neopixel_in_use; #define GPIO_PORT_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT / 32 + 1) -// GPIO ports are 32 pins wide -STATIC uint32_t claimed_pins[GPIO_PORT_COUNT]; //remove? -STATIC uint32_t never_reset_pins[GPIO_PORT_COUNT]; +STATIC bool claimed_pins[IOMUXC_SW_PAD_CTL_PAD_COUNT]; +STATIC bool never_reset_pins[IOMUXC_SW_PAD_CTL_PAD_COUNT]; // There are two numbering systems used here: // IOMUXC index, used for iterating through pins and accessing reset information, // and GPIO port and number, used to store claimed and reset tagging. The two number // systems are not related and one cannot determine the other without a pin object void reset_all_pins(void) { - for (uint8_t i = 0; i < GPIO_PORT_COUNT; i++) { + for (uint8_t i = 0; i < IOMUXC_SW_PAD_CTL_PAD_COUNT; i++) { claimed_pins[i] = never_reset_pins[i]; } for (uint8_t i = 0; i < IOMUXC_SW_PAD_CTL_PAD_COUNT; i++) { - if(!(never_reset_pins[((mcu_pin_obj_t*)(mcu_pin_globals.map.table[i].value))->port] - & (1 << ((mcu_pin_obj_t*)(mcu_pin_globals.map.table[i].value))->number))) { + if(!never_reset_pins[i]) { IOMUXC->SW_MUX_CTL_PAD[i] = ((mcu_pin_obj_t*)(mcu_pin_globals.map.table[i].value))->mux_reset; IOMUXC->SW_PAD_CTL_PAD[i] = ((mcu_pin_obj_t*)(mcu_pin_globals.map.table[i].value))->pad_reset; } @@ -59,15 +57,11 @@ void reset_all_pins(void) { #endif } -void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number) { - never_reset_pins[pin_port] |= 1 << pin_number; -} - // Since i.MX pins need extra register and reset information to reset properly, // resetting pins by number alone has been removed. void common_hal_reset_pin(const mcu_pin_obj_t* pin) { - never_reset_pins[pin->port] &= ~(1 << pin->number); - claimed_pins[pin->port] &= ~(1 << pin->number); + never_reset_pins[pin->mux_idx] = false; + claimed_pins[pin->mux_idx] = false; *(uint32_t*)pin->mux_reg = pin->mux_reset; *(uint32_t*)pin->cfg_reg = pin->pad_reset; @@ -81,17 +75,7 @@ void common_hal_reset_pin(const mcu_pin_obj_t* pin) { } void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { - never_reset_pin_number(pin->port, pin->number); -} - -void claim_pin(const mcu_pin_obj_t* pin) { - claimed_pins[pin->port] |= 1 << pin->number; - - #ifdef MICROPY_HW_NEOPIXEL - if (pin == MICROPY_HW_NEOPIXEL) { - neopixel_in_use = true; - } - #endif + never_reset_pins[pin->mux_idx] = true; } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin) { @@ -101,22 +85,27 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin) { } #endif - return !(claimed_pins[pin->port] & 1<number); + return !claimed_pins[pin->mux_idx]; } uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t* pin) { return pin->mux_idx; // returns IOMUXC to align with pin table - // Note: IOMUXC "numbers" do not align cleanly with GPIO values } void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { - claim_pin(pin); + claimed_pins[pin->mux_idx] = true; + + #ifdef MICROPY_HW_NEOPIXEL + if (pin == MICROPY_HW_NEOPIXEL) { + neopixel_in_use = true; + } + #endif +} + +void claim_pin(const mcu_pin_obj_t* pin) { + common_hal_mcu_pin_claim(pin); } void common_hal_mcu_pin_reset_number(uint8_t pin_no) { common_hal_reset_pin((mcu_pin_obj_t*)(mcu_pin_globals.map.table[pin_no].value)); } - -// TODO: replace use of GPIO pointers in pin struct with this system? -// GPIO_TypeDef * pin_port(uint8_t pin_port) {} -// uint16_t pin_mask(uint8_t pin_number) {} diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.h b/ports/mimxrt10xx/common-hal/microcontroller/Pin.h index def583973b..59ca83082e 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.h +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.h @@ -37,9 +37,6 @@ extern bool neopixel_in_use; #endif void reset_all_pins(void); -// reset_pin_number takes the pin number instead of the pointer so that objects don't -// need to store a full pointer. -void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number); void claim_pin(const mcu_pin_obj_t* pin); #endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_MICROCONTROLLER_PIN_H diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c index b60dcbdabb..cfab35cea8 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c @@ -29,50 +29,48 @@ #include "py/mphal.h" #include "mimxrt10xx/pins.h" -const mcu_pin_obj_t pin_GPIO_00 = PIN(GPIO1, 0, 0, GPIO_00, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_01 = PIN(GPIO1, 0, 1, GPIO_01, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_02 = PIN(GPIO1, 0, 2, GPIO_02, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_03 = PIN(GPIO1, 0, 3, GPIO_03, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_04 = PIN(GPIO1, 0, 4, GPIO_04, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_05 = PIN(GPIO1, 0, 5, GPIO_05, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_06 = PIN(GPIO1, 0, 6, GPIO_06, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_07 = PIN(GPIO1, 0, 7, GPIO_07, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_08 = PIN(GPIO1, 0, 8, GPIO_08, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_09 = PIN(GPIO1, 0, 9, GPIO_09, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_10 = PIN(GPIO1, 0, 10, GPIO_10, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_11 = PIN(GPIO1, 0, 11, GPIO_11, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_12 = PIN(GPIO1, 0, 12, GPIO_12, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_13 = PIN(GPIO1, 0, 13, GPIO_13, NO_ADC, 0, 0x00000005, 0x000010A0); - -const mcu_pin_obj_t pin_GPIO_AD_00 = PIN(GPIO1, 0, 14, GPIO_AD_00, ADC1, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_01 = PIN(GPIO1, 0, 15, GPIO_AD_01, ADC1, 1, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_02 = PIN(GPIO1, 0, 16, GPIO_AD_02, ADC1, 2, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_03 = PIN(GPIO1, 0, 17, GPIO_AD_03, ADC1, 3, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_04 = PIN(GPIO1, 0, 18, GPIO_AD_04, ADC1, 4, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_05 = PIN(GPIO1, 0, 19, GPIO_AD_05, ADC1, 5, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_06 = PIN(GPIO1, 0, 20, GPIO_AD_06, ADC1, 6, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_07 = PIN(GPIO1, 0, 21, GPIO_AD_07, ADC1, 7, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_08 = PIN(GPIO1, 0, 22, GPIO_AD_08, ADC1, 8, 0x00000007, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_09 = PIN(GPIO1, 0, 23, GPIO_AD_09, ADC1, 9, 0x00000007, 0x000090B1); -const mcu_pin_obj_t pin_GPIO_AD_10 = PIN(GPIO1, 0, 24, GPIO_AD_10, ADC1, 10, 0x00000007, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_11 = PIN(GPIO1, 0, 25, GPIO_AD_11, ADC1, 11, 0x00000007, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_AD_12 = PIN(GPIO1, 0, 26, GPIO_AD_12, ADC1, 12, 0x00000007, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_AD_13 = PIN(GPIO1, 0, 27, GPIO_AD_13, ADC1, 13, 0x00000007, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_14 = PIN(GPIO1, 0, 28, GPIO_AD_14, ADC1, 14, 0x00000005, 0x000010A0); - -const mcu_pin_obj_t pin_GPIO_SD_00 = PIN(GPIO2, 1, 0, GPIO_SD_00, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_01 = PIN(GPIO2, 1, 1, GPIO_SD_01, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_02 = PIN(GPIO2, 1, 2, GPIO_SD_02, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_03 = PIN(GPIO2, 1, 3, GPIO_SD_03, NO_ADC, 0, 0x00000006, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_SD_04 = PIN(GPIO2, 1, 4, GPIO_SD_04, NO_ADC, 0, 0x00000006, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_SD_05 = PIN(GPIO2, 1, 5, GPIO_SD_05, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_06 = PIN(GPIO2, 1, 6, GPIO_SD_06, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_07 = PIN(GPIO2, 1, 7, GPIO_SD_07, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_08 = PIN(GPIO2, 1, 8, GPIO_SD_08, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_09 = PIN(GPIO2, 1, 9, GPIO_SD_09, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_10 = PIN(GPIO2, 1, 10, GPIO_SD_10, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_11 = PIN(GPIO2, 1, 11, GPIO_SD_11, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_12 = PIN(GPIO2, 1, 12, GPIO_SD_12, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_13 = PIN(GPIO2, 1, 13, GPIO_SD_13, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_14 = PIN(GPIO2, 1, 14, GPIO_SD_14, NO_ADC, 0, 0x00000000, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_00 = PIN(GPIO1, 0, GPIO_00, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_01 = PIN(GPIO1, 1, GPIO_01, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_02 = PIN(GPIO1, 2, GPIO_02, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_03 = PIN(GPIO1, 3, GPIO_03, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_04 = PIN(GPIO1, 4, GPIO_04, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_05 = PIN(GPIO1, 5, GPIO_05, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_06 = PIN(GPIO1, 6, GPIO_06, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_07 = PIN(GPIO1, 7, GPIO_07, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_08 = PIN(GPIO1, 8, GPIO_08, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_09 = PIN(GPIO1, 9, GPIO_09, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_10 = PIN(GPIO1, 10, GPIO_10, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_11 = PIN(GPIO1, 11, GPIO_11, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_12 = PIN(GPIO1, 12, GPIO_12, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_13 = PIN(GPIO1, 13, GPIO_13, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_00 = PIN(GPIO1, 14, GPIO_AD_00, ADC1, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_01 = PIN(GPIO1, 15, GPIO_AD_01, ADC1, 1, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_02 = PIN(GPIO1, 16, GPIO_AD_02, ADC1, 2, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_03 = PIN(GPIO1, 17, GPIO_AD_03, ADC1, 3, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_04 = PIN(GPIO1, 18, GPIO_AD_04, ADC1, 4, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_05 = PIN(GPIO1, 19, GPIO_AD_05, ADC1, 5, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_06 = PIN(GPIO1, 20, GPIO_AD_06, ADC1, 6, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_07 = PIN(GPIO1, 21, GPIO_AD_07, ADC1, 7, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_08 = PIN(GPIO1, 22, GPIO_AD_08, ADC1, 8, 0x00000007, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_09 = PIN(GPIO1, 23, GPIO_AD_09, ADC1, 9, 0x00000007, 0x000090B1); +const mcu_pin_obj_t pin_GPIO_AD_10 = PIN(GPIO1, 24, GPIO_AD_10, ADC1, 10, 0x00000007, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_11 = PIN(GPIO1, 25, GPIO_AD_11, ADC1, 11, 0x00000007, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_12 = PIN(GPIO1, 26, GPIO_AD_12, ADC1, 12, 0x00000007, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_13 = PIN(GPIO1, 27, GPIO_AD_13, ADC1, 13, 0x00000007, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_14 = PIN(GPIO1, 28, GPIO_AD_14, ADC1, 14, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_00 = PIN(GPIO2, 0, GPIO_SD_00, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_01 = PIN(GPIO2, 1, GPIO_SD_01, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_02 = PIN(GPIO2, 2, GPIO_SD_02, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_03 = PIN(GPIO2, 3, GPIO_SD_03, NO_ADC, 0, 0x00000006, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_SD_04 = PIN(GPIO2, 4, GPIO_SD_04, NO_ADC, 0, 0x00000006, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_SD_05 = PIN(GPIO2, 5, GPIO_SD_05, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_06 = PIN(GPIO2, 6, GPIO_SD_06, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_07 = PIN(GPIO2, 7, GPIO_SD_07, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_08 = PIN(GPIO2, 8, GPIO_SD_08, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_09 = PIN(GPIO2, 9, GPIO_SD_09, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_10 = PIN(GPIO2, 10, GPIO_SD_10, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_11 = PIN(GPIO2, 11, GPIO_SD_11, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_12 = PIN(GPIO2, 12, GPIO_SD_12, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_13 = PIN(GPIO2, 13, GPIO_SD_13, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_14 = PIN(GPIO2, 14, GPIO_SD_14, NO_ADC, 0, 0x00000000, 0x000010A0); // pin_GPIO_SD_14 isn't actually used as a pad but we include it anyway to make resetting easier diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c index d992931f2c..a25937cab7 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c @@ -29,100 +29,96 @@ #include "py/mphal.h" #include "mimxrt10xx/pins.h" -const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, 0, GPIO_AD_B0_00, NO_ADC, 0, 0x00000000, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 0, 1, GPIO_AD_B0_01, NO_ADC, 0, 0x00000000, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 0, 2, GPIO_AD_B0_02, NO_ADC, 0, 0x00000000, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 0, 3, GPIO_AD_B0_03, NO_ADC, 0, 0x00000000, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 0, 4, GPIO_AD_B0_04, NO_ADC, 0, 0x00000000, 0x000090B1); -const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 0, 5, GPIO_AD_B0_05, NO_ADC, 0, 0x00000000, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 0, 6, GPIO_AD_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 0, 7, GPIO_AD_B0_07, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 0, 8, GPIO_AD_B0_08, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 0, 9, GPIO_AD_B0_09, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 0, 10, GPIO_AD_B0_10, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 0, 11, GPIO_AD_B0_11, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 0, 12, GPIO_AD_B0_12, ADC1, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 0, 13, GPIO_AD_B0_13, ADC2, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 0, 14, GPIO_AD_B0_14, ADC2, 1, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 0, 15, GPIO_AD_B0_15, ADC1, 2, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 0, 16, GPIO_AD_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 0, 17, GPIO_AD_B1_01, ADC1, 3, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 0, 18, GPIO_AD_B1_02, ADC2, 3, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 0, 19, GPIO_AD_B1_03, ADC1, 4, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 0, 20, GPIO_AD_B1_04, ADC2, 4, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 0, 21, GPIO_AD_B1_05, ADC2, 5, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 0, 22, GPIO_AD_B1_06, ADC2, 6, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 0, 23, GPIO_AD_B1_07, ADC2, 7, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 0, 24, GPIO_AD_B1_08, ADC2, 8, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 0, 25, GPIO_AD_B1_09, ADC2, 9, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 0, 26, GPIO_AD_B1_10, ADC2, 10, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 0, 27, GPIO_AD_B1_11, ADC2, 11, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 0, 28, GPIO_AD_B1_12, ADC2, 12, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 0, 29, GPIO_AD_B1_13, ADC2, 13, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 0, 30, GPIO_AD_B1_14, ADC2, 14, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 0, 31, GPIO_AD_B1_15, ADC2, 15, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t pin_GPIO_EMC_00 = PIN(GPIO2, 1, 0, GPIO_EMC_00, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_01 = PIN(GPIO2, 1, 1, GPIO_EMC_01, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_02 = PIN(GPIO2, 1, 2, GPIO_EMC_02, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_03 = PIN(GPIO2, 1, 3, GPIO_EMC_03, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_04 = PIN(GPIO2, 1, 4, GPIO_EMC_04, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_05 = PIN(GPIO2, 1, 5, GPIO_EMC_05, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_06 = PIN(GPIO2, 1, 6, GPIO_EMC_06, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_07 = PIN(GPIO2, 1, 7, GPIO_EMC_07, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_08 = PIN(GPIO2, 1, 8, GPIO_EMC_08, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_09 = PIN(GPIO2, 1, 9, GPIO_EMC_09, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_10 = PIN(GPIO2, 1, 10, GPIO_EMC_10, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_11 = PIN(GPIO2, 1, 11, GPIO_EMC_11, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_12 = PIN(GPIO2, 1, 12, GPIO_EMC_12, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_13 = PIN(GPIO2, 1, 13, GPIO_EMC_13, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_14 = PIN(GPIO2, 1, 14, GPIO_EMC_14, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_15 = PIN(GPIO2, 1, 15, GPIO_EMC_15, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_16 = PIN(GPIO2, 1, 16, GPIO_EMC_16, NO_ADC, 0, 0x00000006, 0x000030B0); -const mcu_pin_obj_t pin_GPIO_EMC_17 = PIN(GPIO2, 1, 17, GPIO_EMC_17, NO_ADC, 0, 0x00000006, 0x000030B0); -const mcu_pin_obj_t pin_GPIO_EMC_18 = PIN(GPIO2, 1, 18, GPIO_EMC_18, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_19 = PIN(GPIO2, 1, 19, GPIO_EMC_19, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_20 = PIN(GPIO2, 1, 20, GPIO_EMC_20, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_21 = PIN(GPIO2, 1, 21, GPIO_EMC_21, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_22 = PIN(GPIO2, 1, 22, GPIO_EMC_22, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO2, 1, 23, GPIO_EMC_23, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO2, 1, 24, GPIO_EMC_24, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO2, 1, 25, GPIO_EMC_25, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO2, 1, 26, GPIO_EMC_26, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO2, 1, 27, GPIO_EMC_27, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_28 = PIN(GPIO2, 1, 28, GPIO_EMC_28, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_29 = PIN(GPIO2, 1, 29, GPIO_EMC_29, NO_ADC, 0, 0x00000005, 0x000030B0); -const mcu_pin_obj_t pin_GPIO_EMC_30 = PIN(GPIO2, 1, 30, GPIO_EMC_30, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_31 = PIN(GPIO2, 1, 31, GPIO_EMC_31, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_32 = PIN(GPIO3, 1, 0, GPIO_EMC_32, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_33 = PIN(GPIO3, 1, 1, GPIO_EMC_33, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_34 = PIN(GPIO3, 1, 2, GPIO_EMC_34, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_35 = PIN(GPIO3, 1, 3, GPIO_EMC_35, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_36 = PIN(GPIO3, 1, 4, GPIO_EMC_36, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_37 = PIN(GPIO3, 1, 5, GPIO_EMC_37, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_38 = PIN(GPIO3, 1, 6, GPIO_EMC_38, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_39 = PIN(GPIO3, 1, 7, GPIO_EMC_39, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_40 = PIN(GPIO3, 1, 8, GPIO_EMC_40, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_41 = PIN(GPIO3, 1, 9, GPIO_EMC_41, NO_ADC, 0, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t pin_GPIO_SD_B0_00 = PIN(GPIO3, 2, 13, GPIO_SD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_01 = PIN(GPIO3, 2, 14, GPIO_SD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_02 = PIN(GPIO3, 2, 15, GPIO_SD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_03 = PIN(GPIO3, 2, 16, GPIO_SD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_04 = PIN(GPIO3, 2, 17, GPIO_SD_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_05 = PIN(GPIO3, 2, 18, GPIO_SD_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_06 = PIN(GPIO3, 2, 19, GPIO_SD_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO3, 2, 20, GPIO_SD_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO3, 2, 21, GPIO_SD_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO3, 2, 22, GPIO_SD_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO3, 2, 23, GPIO_SD_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO3, 2, 24, GPIO_SD_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO3, 2, 25, GPIO_SD_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_06 = PIN(GPIO3, 2, 26, GPIO_SD_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_07 = PIN(GPIO3, 2, 27, GPIO_SD_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 2, 28, GPIO_SD_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 2, 29, GPIO_SD_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 2, 30, GPIO_SD_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 2, 31, GPIO_SD_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, GPIO_AD_B0_00, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 1, GPIO_AD_B0_01, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 2, GPIO_AD_B0_02, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 3, GPIO_AD_B0_03, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 4, GPIO_AD_B0_04, NO_ADC, 0, 0x00000000, 0x000090B1); +const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 5, GPIO_AD_B0_05, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 6, GPIO_AD_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 7, GPIO_AD_B0_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 8, GPIO_AD_B0_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 9, GPIO_AD_B0_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 10, GPIO_AD_B0_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 11, GPIO_AD_B0_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 12, GPIO_AD_B0_12, ADC1, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 13, GPIO_AD_B0_13, ADC2, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 14, GPIO_AD_B0_14, ADC2, 1, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 15, GPIO_AD_B0_15, ADC1, 2, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 16, GPIO_AD_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 17, GPIO_AD_B1_01, ADC1, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 18, GPIO_AD_B1_02, ADC2, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 19, GPIO_AD_B1_03, ADC1, 4, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 20, GPIO_AD_B1_04, ADC2, 4, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 21, GPIO_AD_B1_05, ADC2, 5, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 22, GPIO_AD_B1_06, ADC2, 6, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 23, GPIO_AD_B1_07, ADC2, 7, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 24, GPIO_AD_B1_08, ADC2, 8, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 25, GPIO_AD_B1_09, ADC2, 9, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 26, GPIO_AD_B1_10, ADC2, 10, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 27, GPIO_AD_B1_11, ADC2, 11, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 28, GPIO_AD_B1_12, ADC2, 12, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 29, GPIO_AD_B1_13, ADC2, 13, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 30, GPIO_AD_B1_14, ADC2, 14, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 31, GPIO_AD_B1_15, ADC2, 15, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_00 = PIN(GPIO2, 0, GPIO_EMC_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_01 = PIN(GPIO2, 1, GPIO_EMC_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_02 = PIN(GPIO2, 2, GPIO_EMC_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_03 = PIN(GPIO2, 3, GPIO_EMC_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_04 = PIN(GPIO2, 4, GPIO_EMC_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_05 = PIN(GPIO2, 5, GPIO_EMC_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_06 = PIN(GPIO2, 6, GPIO_EMC_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_07 = PIN(GPIO2, 7, GPIO_EMC_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_08 = PIN(GPIO2, 8, GPIO_EMC_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_09 = PIN(GPIO2, 9, GPIO_EMC_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_10 = PIN(GPIO2, 10, GPIO_EMC_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_11 = PIN(GPIO2, 11, GPIO_EMC_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_12 = PIN(GPIO2, 12, GPIO_EMC_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_13 = PIN(GPIO2, 13, GPIO_EMC_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_14 = PIN(GPIO2, 14, GPIO_EMC_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_15 = PIN(GPIO2, 15, GPIO_EMC_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_16 = PIN(GPIO2, 16, GPIO_EMC_16, NO_ADC, 0, 0x00000006, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_EMC_17 = PIN(GPIO2, 17, GPIO_EMC_17, NO_ADC, 0, 0x00000006, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_EMC_18 = PIN(GPIO2, 18, GPIO_EMC_18, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_19 = PIN(GPIO2, 19, GPIO_EMC_19, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_20 = PIN(GPIO2, 20, GPIO_EMC_20, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_21 = PIN(GPIO2, 21, GPIO_EMC_21, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_22 = PIN(GPIO2, 22, GPIO_EMC_22, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO2, 23, GPIO_EMC_23, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO2, 24, GPIO_EMC_24, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO2, 25, GPIO_EMC_25, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO2, 26, GPIO_EMC_26, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO2, 27, GPIO_EMC_27, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_28 = PIN(GPIO2, 28, GPIO_EMC_28, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_29 = PIN(GPIO2, 29, GPIO_EMC_29, NO_ADC, 0, 0x00000005, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_EMC_30 = PIN(GPIO2, 30, GPIO_EMC_30, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_31 = PIN(GPIO2, 31, GPIO_EMC_31, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_32 = PIN(GPIO3, 0, GPIO_EMC_32, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_33 = PIN(GPIO3, 1, GPIO_EMC_33, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_34 = PIN(GPIO3, 2, GPIO_EMC_34, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_35 = PIN(GPIO3, 3, GPIO_EMC_35, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_36 = PIN(GPIO3, 4, GPIO_EMC_36, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_37 = PIN(GPIO3, 5, GPIO_EMC_37, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_38 = PIN(GPIO3, 6, GPIO_EMC_38, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_39 = PIN(GPIO3, 7, GPIO_EMC_39, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_40 = PIN(GPIO3, 8, GPIO_EMC_40, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_41 = PIN(GPIO3, 9, GPIO_EMC_41, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_00 = PIN(GPIO3, 13, GPIO_SD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_01 = PIN(GPIO3, 14, GPIO_SD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_02 = PIN(GPIO3, 15, GPIO_SD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_03 = PIN(GPIO3, 16, GPIO_SD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_04 = PIN(GPIO3, 17, GPIO_SD_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_05 = PIN(GPIO3, 18, GPIO_SD_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_06 = PIN(GPIO3, 19, GPIO_SD_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO3, 20, GPIO_SD_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO3, 21, GPIO_SD_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO3, 22, GPIO_SD_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO3, 23, GPIO_SD_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO3, 24, GPIO_SD_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO3, 25, GPIO_SD_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_06 = PIN(GPIO3, 26, GPIO_SD_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_07 = PIN(GPIO3, 27, GPIO_SD_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 28, GPIO_SD_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 29, GPIO_SD_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 30, GPIO_SD_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 31, GPIO_SD_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c index 4bb025f372..9f25225bb6 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c @@ -29,133 +29,127 @@ #include "py/mphal.h" #include "mimxrt10xx/pins.h" -const mcu_pin_obj_t pin_GPIO_EMC_00 = PIN(GPIO4, 3, 0, GPIO_EMC_00, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_01 = PIN(GPIO4, 3, 1, GPIO_EMC_01, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_02 = PIN(GPIO4, 3, 2, GPIO_EMC_02, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_03 = PIN(GPIO4, 3, 3, GPIO_EMC_03, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_04 = PIN(GPIO4, 3, 4, GPIO_EMC_04, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_05 = PIN(GPIO4, 3, 5, GPIO_EMC_05, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_06 = PIN(GPIO4, 3, 6, GPIO_EMC_06, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_07 = PIN(GPIO4, 3, 7, GPIO_EMC_07, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_08 = PIN(GPIO4, 3, 8, GPIO_EMC_08, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_09 = PIN(GPIO4, 3, 9, GPIO_EMC_09, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_10 = PIN(GPIO4, 3, 10, GPIO_EMC_10, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_11 = PIN(GPIO4, 3, 11, GPIO_EMC_11, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_12 = PIN(GPIO4, 3, 12, GPIO_EMC_12, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_13 = PIN(GPIO4, 3, 13, GPIO_EMC_13, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_14 = PIN(GPIO4, 3, 14, GPIO_EMC_14, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_15 = PIN(GPIO4, 3, 15, GPIO_EMC_15, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_16 = PIN(GPIO4, 3, 16, GPIO_EMC_16, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_17 = PIN(GPIO4, 3, 17, GPIO_EMC_17, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_18 = PIN(GPIO4, 3, 18, GPIO_EMC_18, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_19 = PIN(GPIO4, 3, 19, GPIO_EMC_19, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_20 = PIN(GPIO4, 3, 20, GPIO_EMC_20, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_21 = PIN(GPIO4, 3, 21, GPIO_EMC_21, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_22 = PIN(GPIO4, 3, 22, GPIO_EMC_22, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO4, 3, 23, GPIO_EMC_23, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO4, 3, 24, GPIO_EMC_24, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO4, 3, 25, GPIO_EMC_25, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO4, 3, 26, GPIO_EMC_26, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO4, 3, 27, GPIO_EMC_27, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_28 = PIN(GPIO4, 3, 28, GPIO_EMC_28, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_29 = PIN(GPIO4, 3, 29, GPIO_EMC_29, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_30 = PIN(GPIO4, 3, 30, GPIO_EMC_30, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_31 = PIN(GPIO4, 3, 31, GPIO_EMC_31, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_32 = PIN(GPIO3, 2, 18, GPIO_EMC_32, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_33 = PIN(GPIO3, 2, 19, GPIO_EMC_33, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_34 = PIN(GPIO3, 2, 20, GPIO_EMC_34, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_35 = PIN(GPIO3, 2, 21, GPIO_EMC_35, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_36 = PIN(GPIO3, 2, 22, GPIO_EMC_36, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_37 = PIN(GPIO3, 2, 23, GPIO_EMC_37, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_38 = PIN(GPIO3, 2, 24, GPIO_EMC_38, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_39 = PIN(GPIO3, 2, 25, GPIO_EMC_39, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_40 = PIN(GPIO3, 2, 26, GPIO_EMC_40, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_41 = PIN(GPIO3, 2, 27, GPIO_EMC_41, NO_ADC, 0, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, 0, GPIO_AD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 0, 1, GPIO_AD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 0, 2, GPIO_AD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 0, 3, GPIO_AD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 0, 4, GPIO_AD_B0_04, NO_ADC, 0, 0x00000000, 0x000030B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 0, 5, GPIO_AD_B0_05, NO_ADC, 0, 0x00000000, 0x000030B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 0, 6, GPIO_AD_B0_06, NO_ADC, 0, 0x00000000, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 0, 7, GPIO_AD_B0_07, NO_ADC, 0, 0x00000000, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 0, 8, GPIO_AD_B0_08, NO_ADC, 0, 0x00000000, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 0, 9, GPIO_AD_B0_09, NO_ADC, 0, 0x00000000, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 0, 10, GPIO_AD_B0_10, NO_ADC, 0, 0x00000000, 0x000090B1); -const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 0, 11, GPIO_AD_B0_11, NO_ADC, 0, 0x00000000, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 0, 12, GPIO_AD_B0_12, ADC1, 1, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 0, 13, GPIO_AD_B0_13, ADC1, 2, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 0, 14, GPIO_AD_B0_14, ADC1, 3, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 0, 15, GPIO_AD_B0_15, ADC1, 4, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 0, 16, GPIO_AD_B1_00, ADC1, 5, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 0, 17, GPIO_AD_B1_01, ADC1, 6, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 0, 18, GPIO_AD_B1_02, ADC1, 7, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 0, 19, GPIO_AD_B1_03, ADC1, 8, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 0, 20, GPIO_AD_B1_04, ADC1, 9, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 0, 21, GPIO_AD_B1_05, ADC1, 10, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 0, 22, GPIO_AD_B1_06, ADC1, 11, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 0, 23, GPIO_AD_B1_07, ADC1, 12, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 0, 24, GPIO_AD_B1_08, ADC1, 13, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 0, 25, GPIO_AD_B1_09, ADC1, 14, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 0, 26, GPIO_AD_B1_10, ADC1, 15, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 0, 27, GPIO_AD_B1_11, ADC1, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 0, 28, GPIO_AD_B1_12, ADC2, 1, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 0, 29, GPIO_AD_B1_13, ADC2, 2, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 0, 30, GPIO_AD_B1_14, ADC2, 3, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 0, 31, GPIO_AD_B1_15, ADC2, 4, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t pin_GPIO_B0_00 = PIN(GPIO2, 1, 0, GPIO_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_01 = PIN(GPIO2, 1, 1, GPIO_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_02 = PIN(GPIO2, 1, 2, GPIO_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_03 = PIN(GPIO2, 1, 3, GPIO_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_04 = PIN(GPIO2, 1, 4, GPIO_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_05 = PIN(GPIO2, 1, 5, GPIO_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_06 = PIN(GPIO2, 1, 6, GPIO_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_07 = PIN(GPIO2, 1, 7, GPIO_B0_07, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_08 = PIN(GPIO2, 1, 8, GPIO_B0_08, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_09 = PIN(GPIO2, 1, 9, GPIO_B0_09, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_10 = PIN(GPIO2, 1, 10, GPIO_B0_10, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_11 = PIN(GPIO2, 1, 11, GPIO_B0_11, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_12 = PIN(GPIO2, 1, 12, GPIO_B0_12, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_13 = PIN(GPIO2, 1, 13, GPIO_B0_13, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_14 = PIN(GPIO2, 1, 14, GPIO_B0_14, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B0_15 = PIN(GPIO2, 1, 15, GPIO_B0_15, NO_ADC, 0, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t pin_GPIO_B1_00 = PIN(GPIO2, 1, 16, GPIO_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_01 = PIN(GPIO2, 1, 17, GPIO_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_02 = PIN(GPIO2, 1, 18, GPIO_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_03 = PIN(GPIO2, 1, 19, GPIO_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_04 = PIN(GPIO2, 1, 20, GPIO_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_05 = PIN(GPIO2, 1, 21, GPIO_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_06 = PIN(GPIO2, 1, 22, GPIO_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_07 = PIN(GPIO2, 1, 23, GPIO_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_08 = PIN(GPIO2, 1, 24, GPIO_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_09 = PIN(GPIO2, 1, 25, GPIO_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_10 = PIN(GPIO2, 1, 26, GPIO_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_11 = PIN(GPIO2, 1, 27, GPIO_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_12 = PIN(GPIO2, 1, 28, GPIO_B1_12, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_13 = PIN(GPIO2, 1, 29, GPIO_B1_13, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_14 = PIN(GPIO2, 1, 30, GPIO_B1_14, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_B1_15 = PIN(GPIO2, 1, 31, GPIO_B1_15, NO_ADC, 0, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t pin_GPIO_SD_B0_00 = PIN(GPIO3, 2, 12, GPIO_SD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_01 = PIN(GPIO3, 2, 13, GPIO_SD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_02 = PIN(GPIO3, 2, 14, GPIO_SD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_03 = PIN(GPIO3, 2, 15, GPIO_SD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_04 = PIN(GPIO3, 2, 16, GPIO_SD_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B0_05 = PIN(GPIO3, 2, 17, GPIO_SD_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); - -const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO3, 2, 0, GPIO_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO3, 2, 1, GPIO_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO3, 2, 2, GPIO_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO3, 2, 3, GPIO_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO3, 2, 4, GPIO_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO3, 2, 5, GPIO_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_06 = PIN(GPIO3, 2, 6, GPIO_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_07 = PIN(GPIO3, 2, 7, GPIO_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 2, 8, GPIO_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 2, 9, GPIO_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 2, 10, GPIO_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 2, 11, GPIO_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_00 = PIN(GPIO4, 0, GPIO_EMC_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_01 = PIN(GPIO4, 1, GPIO_EMC_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_02 = PIN(GPIO4, 2, GPIO_EMC_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_03 = PIN(GPIO4, 3, GPIO_EMC_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_04 = PIN(GPIO4, 4, GPIO_EMC_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_05 = PIN(GPIO4, 5, GPIO_EMC_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_06 = PIN(GPIO4, 6, GPIO_EMC_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_07 = PIN(GPIO4, 7, GPIO_EMC_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_08 = PIN(GPIO4, 8, GPIO_EMC_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_09 = PIN(GPIO4, 9, GPIO_EMC_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_10 = PIN(GPIO4, 10, GPIO_EMC_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_11 = PIN(GPIO4, 11, GPIO_EMC_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_12 = PIN(GPIO4, 12, GPIO_EMC_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_13 = PIN(GPIO4, 13, GPIO_EMC_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_14 = PIN(GPIO4, 14, GPIO_EMC_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_15 = PIN(GPIO4, 15, GPIO_EMC_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_16 = PIN(GPIO4, 16, GPIO_EMC_16, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_17 = PIN(GPIO4, 17, GPIO_EMC_17, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_18 = PIN(GPIO4, 18, GPIO_EMC_18, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_19 = PIN(GPIO4, 19, GPIO_EMC_19, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_20 = PIN(GPIO4, 20, GPIO_EMC_20, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_21 = PIN(GPIO4, 21, GPIO_EMC_21, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_22 = PIN(GPIO4, 22, GPIO_EMC_22, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO4, 23, GPIO_EMC_23, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO4, 24, GPIO_EMC_24, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO4, 25, GPIO_EMC_25, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO4, 26, GPIO_EMC_26, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO4, 27, GPIO_EMC_27, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_28 = PIN(GPIO4, 28, GPIO_EMC_28, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_29 = PIN(GPIO4, 29, GPIO_EMC_29, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_30 = PIN(GPIO4, 30, GPIO_EMC_30, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_31 = PIN(GPIO4, 31, GPIO_EMC_31, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_32 = PIN(GPIO3, 18, GPIO_EMC_32, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_33 = PIN(GPIO3, 19, GPIO_EMC_33, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_34 = PIN(GPIO3, 20, GPIO_EMC_34, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_35 = PIN(GPIO3, 21, GPIO_EMC_35, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_36 = PIN(GPIO3, 22, GPIO_EMC_36, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_37 = PIN(GPIO3, 23, GPIO_EMC_37, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_38 = PIN(GPIO3, 24, GPIO_EMC_38, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_39 = PIN(GPIO3, 25, GPIO_EMC_39, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_40 = PIN(GPIO3, 26, GPIO_EMC_40, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_41 = PIN(GPIO3, 27, GPIO_EMC_41, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, GPIO_AD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 1, GPIO_AD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 2, GPIO_AD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 3, GPIO_AD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 4, GPIO_AD_B0_04, NO_ADC, 0, 0x00000000, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 5, GPIO_AD_B0_05, NO_ADC, 0, 0x00000000, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 6, GPIO_AD_B0_06, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 7, GPIO_AD_B0_07, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 8, GPIO_AD_B0_08, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 9, GPIO_AD_B0_09, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 10, GPIO_AD_B0_10, NO_ADC, 0, 0x00000000, 0x000090B1); +const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 11, GPIO_AD_B0_11, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 12, GPIO_AD_B0_12, ADC1, 1, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 13, GPIO_AD_B0_13, ADC1, 2, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 14, GPIO_AD_B0_14, ADC1, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 15, GPIO_AD_B0_15, ADC1, 4, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 16, GPIO_AD_B1_00, ADC1, 5, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 17, GPIO_AD_B1_01, ADC1, 6, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 18, GPIO_AD_B1_02, ADC1, 7, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 19, GPIO_AD_B1_03, ADC1, 8, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 20, GPIO_AD_B1_04, ADC1, 9, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 21, GPIO_AD_B1_05, ADC1, 10, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 22, GPIO_AD_B1_06, ADC1, 11, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 23, GPIO_AD_B1_07, ADC1, 12, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 24, GPIO_AD_B1_08, ADC1, 13, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 25, GPIO_AD_B1_09, ADC1, 14, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 26, GPIO_AD_B1_10, ADC1, 15, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 27, GPIO_AD_B1_11, ADC1, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 28, GPIO_AD_B1_12, ADC2, 1, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 29, GPIO_AD_B1_13, ADC2, 2, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 30, GPIO_AD_B1_14, ADC2, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 31, GPIO_AD_B1_15, ADC2, 4, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_00 = PIN(GPIO2, 0, GPIO_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_01 = PIN(GPIO2, 1, GPIO_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_02 = PIN(GPIO2, 2, GPIO_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_03 = PIN(GPIO2, 3, GPIO_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_04 = PIN(GPIO2, 4, GPIO_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_05 = PIN(GPIO2, 5, GPIO_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_06 = PIN(GPIO2, 6, GPIO_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_07 = PIN(GPIO2, 7, GPIO_B0_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_08 = PIN(GPIO2, 8, GPIO_B0_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_09 = PIN(GPIO2, 9, GPIO_B0_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_10 = PIN(GPIO2, 10, GPIO_B0_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_11 = PIN(GPIO2, 11, GPIO_B0_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_12 = PIN(GPIO2, 12, GPIO_B0_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_13 = PIN(GPIO2, 13, GPIO_B0_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_14 = PIN(GPIO2, 14, GPIO_B0_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_15 = PIN(GPIO2, 15, GPIO_B0_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_00 = PIN(GPIO2, 16, GPIO_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_01 = PIN(GPIO2, 17, GPIO_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_02 = PIN(GPIO2, 18, GPIO_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_03 = PIN(GPIO2, 19, GPIO_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_04 = PIN(GPIO2, 20, GPIO_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_05 = PIN(GPIO2, 21, GPIO_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_06 = PIN(GPIO2, 22, GPIO_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_07 = PIN(GPIO2, 23, GPIO_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_08 = PIN(GPIO2, 24, GPIO_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_09 = PIN(GPIO2, 25, GPIO_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_10 = PIN(GPIO2, 26, GPIO_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_11 = PIN(GPIO2, 27, GPIO_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_12 = PIN(GPIO2, 28, GPIO_B1_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_13 = PIN(GPIO2, 29, GPIO_B1_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_14 = PIN(GPIO2, 30, GPIO_B1_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_15 = PIN(GPIO2, 31, GPIO_B1_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_00 = PIN(GPIO3, 12, GPIO_SD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_01 = PIN(GPIO3, 13, GPIO_SD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_02 = PIN(GPIO3, 14, GPIO_SD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_03 = PIN(GPIO3, 15, GPIO_SD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_04 = PIN(GPIO3, 16, GPIO_SD_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_05 = PIN(GPIO3, 17, GPIO_SD_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO3, 0, GPIO_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO3, 1, GPIO_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO3, 2, GPIO_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO3, 3, GPIO_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO3, 4, GPIO_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO3, 5, GPIO_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_06 = PIN(GPIO3, 6, GPIO_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_07 = PIN(GPIO3, 7, GPIO_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 8, GPIO_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 9, GPIO_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 10, GPIO_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 11, GPIO_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h index 68710f999a..7168854a5e 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h @@ -48,8 +48,7 @@ extern const mp_obj_type_t mcu_pin_type; typedef struct { mp_obj_base_t base; GPIO_Type *gpio; - uint8_t port:3; //0 start index - uint8_t number:5; + uint8_t number; uint16_t mux_idx; uint32_t mux_reg; uint32_t cfg_reg; @@ -59,11 +58,10 @@ typedef struct { uint32_t pad_reset; } mcu_pin_obj_t; -#define PIN(p_gpio, p_port, p_number, p_enum, p_adc, p_adc_channel, p_mux_reset, p_pad_reset) \ +#define PIN(p_gpio, p_number, p_enum, p_adc, p_adc_channel, p_mux_reset, p_pad_reset) \ { \ { &mcu_pin_type }, \ .gpio = p_gpio, \ - .port = p_port, \ .number = p_number, \ .mux_idx = kIOMUXC_SW_MUX_CTL_PAD_ ## p_enum, \ .mux_reg = (uint32_t)&(IOMUXC->SW_MUX_CTL_PAD[kIOMUXC_SW_MUX_CTL_PAD_ ## p_enum]), \ From 38fd9c25f22ec68920afcf736cb75d4d316ba8bb Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Tue, 19 May 2020 15:33:34 -0400 Subject: [PATCH 04/13] Re-add APA102 --- .../common-hal/microcontroller/Pin.c | 37 ++++++++++++++++++- .../common-hal/microcontroller/Pin.h | 4 ++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c index 4989a91863..e75df6e609 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c @@ -31,8 +31,10 @@ #ifdef MICROPY_HW_NEOPIXEL bool neopixel_in_use; #endif - -#define GPIO_PORT_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT / 32 + 1) +#ifdef MICROPY_HW_APA102_MOSI +bool apa102_sck_in_use; +bool apa102_mosi_in_use; +#endif STATIC bool claimed_pins[IOMUXC_SW_PAD_CTL_PAD_COUNT]; STATIC bool never_reset_pins[IOMUXC_SW_PAD_CTL_PAD_COUNT]; @@ -55,6 +57,10 @@ void reset_all_pins(void) { #ifdef MICROPY_HW_NEOPIXEL neopixel_in_use = false; #endif + #ifdef MICROPY_HW_APA102_MOSI + apa102_sck_in_use = false; + apa102_mosi_in_use = false; + #endif } // Since i.MX pins need extra register and reset information to reset properly, @@ -72,6 +78,17 @@ void common_hal_reset_pin(const mcu_pin_obj_t* pin) { return; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin->mux_idx == MICROPY_HW_APA102_MOSI->mux_idx || + pin->mux_idx == MICROPY_HW_APA102_SCK->mux_idx) { + apa102_mosi_in_use = apa102_mosi_in_use && pin->mux_idx != MICROPY_HW_APA102_MOSI->mux_idx; + apa102_sck_in_use = apa102_sck_in_use && pin->mux_idx != MICROPY_HW_APA102_SCK->mux_idx; + if (!apa102_sck_in_use && !apa102_mosi_in_use) { + rgb_led_status_init(); + } + return; + } + #endif } void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) { @@ -84,6 +101,14 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin) { return !neopixel_in_use; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin == MICROPY_HW_APA102_MOSI) { + return !apa102_mosi_in_use; + } + if (pin == MICROPY_HW_APA102_SCK) { + return !apa102_sck_in_use; + } + #endif return !claimed_pins[pin->mux_idx]; } @@ -100,6 +125,14 @@ void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { neopixel_in_use = true; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin == MICROPY_HW_APA102_MOSI) { + apa102_mosi_in_use = true; + } + if (pin == MICROPY_HW_APA102_SCK) { + apa102_sck_in_use = true; + } + #endif } void claim_pin(const mcu_pin_obj_t* pin) { diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.h b/ports/mimxrt10xx/common-hal/microcontroller/Pin.h index 59ca83082e..2f1aaa8955 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.h +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.h @@ -35,6 +35,10 @@ #ifdef MICROPY_HW_NEOPIXEL extern bool neopixel_in_use; #endif +#ifdef MICROPY_HW_APA102_MOSI +extern bool apa102_sck_in_use; +extern bool apa102_mosi_in_use; +#endif void reset_all_pins(void); void claim_pin(const mcu_pin_obj_t* pin); From 4cca455c9b5651d7b846b9e1a8b49ea81adc8cd7 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Wed, 20 May 2020 16:44:18 +0800 Subject: [PATCH 05/13] nrf: reset rtc as part of port_reset() On NRF, the `rtc_reset()` function is never called. As a result, calls to `time.time()` return a cryptic error> ``` >>> import time >>> time.time() '' object has no attribute 'datetime' >>> ``` This is because `MP_STATE_VM(rtc_time_source)` is not initialized due to `rtc_reset()` never being called. If `CIRCUITPY_RTC` is enabled, call `rtc_reset()` as part of the `reset_port()` call. This ensures that `time.time()` works as expected. Signed-off-by: Sean Cross --- ports/nrf/supervisor/port.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index 4edb78f7c0..e88b6c26fe 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -161,6 +161,10 @@ void reset_port(void) { pulsein_reset(); #endif +#if CIRCUITPY_RTC + rtc_reset(); +#endif + timers_reset(); #if CIRCUITPY_BLEIO From cee428663745c67622bbba2765ba304369472b90 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Tue, 19 May 2020 21:17:31 +0000 Subject: [PATCH 06/13] Translated using Weblate (Swedish) Currently translated at 100.0% (747 of 747 strings) Translation: CircuitPython/master Translate-URL: https://hosted.weblate.org/projects/circuitpython/master/sv/ --- locale/sv.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 25ed8009fb..02f865b9c2 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-05-19 15:01+0800\n" -"PO-Revision-Date: 2020-05-17 20:56+0000\n" -"Last-Translator: Anonymous \n" +"PO-Revision-Date: 2020-05-20 18:32+0000\n" +"Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" "MIME-Version: 1.0\n" @@ -463,7 +463,7 @@ msgstr "Kan inte ställa in CCCD på lokal karaktäristik" #: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" -msgstr "Kan radera värden" +msgstr "Kan inte radera värden" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c @@ -1289,7 +1289,7 @@ msgstr "Plus eventuella moduler i filsystemet\n" #: shared-module/vectorio/Polygon.c msgid "Polygon needs at least 3 points" -msgstr "" +msgstr "Polygonen behöver minst 3 punkter" #: shared-bindings/ps2io/Ps2.c msgid "Pop from an empty Ps2 buffer" @@ -1515,7 +1515,7 @@ msgstr "Tile-bredd måste vara jämnt delbar med bredd på bitmap" #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" -msgstr "" +msgstr "Åtgärden tog för lång tid: Max väntetid är %d sekunder" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." @@ -1699,7 +1699,7 @@ msgstr "" "\n" "Besök learning.adafruit.com/category/circuitpython för projektguider.\n" "\n" -"För att lista inbyggda moduler, vänligen `help(\" modules \")`.\n" +"För att lista inbyggda moduler, ange `help(\"modules\")`.\n" #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" From 02d0881fca69afca8a04a6d807103f127e92603f Mon Sep 17 00:00:00 2001 From: George Waters Date: Wed, 20 May 2020 17:34:34 -0400 Subject: [PATCH 07/13] Fix error when getting a pixelbuf slice --- shared-bindings/_pixelbuf/PixelBuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/_pixelbuf/PixelBuf.c b/shared-bindings/_pixelbuf/PixelBuf.c index 71a91d7076..d8f1810db8 100644 --- a/shared-bindings/_pixelbuf/PixelBuf.c +++ b/shared-bindings/_pixelbuf/PixelBuf.c @@ -311,7 +311,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp } mp_obj_tuple_t* t = MP_OBJ_TO_PTR(mp_obj_new_tuple(len, NULL)); for (uint i = 0; i < len; i++) { - t->items[i] = common_hal__pixelbuf_pixelbuf_get_pixel(self_in, i * slice.step); + t->items[i] = common_hal__pixelbuf_pixelbuf_get_pixel(self_in, i * slice.step + slice.start); } return MP_OBJ_FROM_PTR(t); } else { // Set From 4f54514be460385161c291ac644cb6cc1c067b5a Mon Sep 17 00:00:00 2001 From: jason <14111408+jpecor@users.noreply.github.com> Date: Wed, 20 May 2020 21:11:06 -0500 Subject: [PATCH 08/13] Initial version --- .github/workflows/build.yml | 1 + .../boards/aloriumtech_evo_m51/board.c | 57 ++++++++++++++++++ .../aloriumtech_evo_m51/mpconfigboard.h | 47 +++++++++++++++ .../aloriumtech_evo_m51/mpconfigboard.mk | 18 ++++++ .../boards/aloriumtech_evo_m51/pins.c | 60 +++++++++++++++++++ 5 files changed, 183 insertions(+) create mode 100644 ports/atmel-samd/boards/aloriumtech_evo_m51/board.c create mode 100644 ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/aloriumtech_evo_m51/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c379e890e1..6eb55ed127 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -136,6 +136,7 @@ jobs: board: - "8086_commander" - "TG-Watch02A" + - "aloriumtech_evo_m51" - "aramcon_badge_2019" - "arduino_mkr1300" - "arduino_mkrzero" diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c b/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c new file mode 100644 index 0000000000..b418d0f1b9 --- /dev/null +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c @@ -0,0 +1,57 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Updated to support Alorium Technology Evo M51 +// Author: Bryan Craker +// Date: 2020-05-20 + +#include "boards/board.h" +#include "mpconfigboard.h" + +void board_init(void) { + REG_PORT_DIRSET1 = PORT_PB20; // PB20 as output + REG_PORT_OUTCLR1 = PORT_PB20; // PB20 cleared + PORT->Group[1].PINCFG[20].reg |= PORT_PINCFG_PMUXEN; // Mux enabled on PB20 + PORT->Group[1].PMUX[10].reg = 0x0C; // PB20 as mux function "M" + // Gclk[6] is on PB20 + GCLK->GENCTRL[6].reg = GCLK_GENCTRL_SRC(GCLK_GENCTRL_SRC_DPLL0) | + GCLK_GENCTRL_IDC | + GCLK_GENCTRL_DIV(10) | + //GCLK_GENCTRL_DIVSEL | + GCLK_GENCTRL_OE | + GCLK_GENCTRL_GENEN; + while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_GENCTRL6) + { + // Wait for synchronization + } +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h new file mode 100644 index 0000000000..cafc82605d --- /dev/null +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h @@ -0,0 +1,47 @@ +#define MICROPY_HW_BOARD_NAME "AloriumTech Evo M51" +#define MICROPY_HW_MCU_NAME "samd51p19" + +#define CIRCUITPY_MCU_FAMILY samd51 + +// Rev E + +#define MICROPY_HW_LED_STATUS (&pin_PA23) +#define MICROPY_HW_NEOPIXEL (&pin_PB03) + +// These are pins not to reset. +// QSPI Data pins +#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) +// QSPI CS, QSPI SCK and NeoPixel pin +#define MICROPY_PORT_B (PORT_PB03 | PORT_PB10 | PORT_PB11 | PORT_PB20) +#define MICROPY_PORT_C (0) +#define MICROPY_PORT_D (0) + +// BC needed? +//#define AUTORESET_DELAY_MS 500 + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code +//#define CIRCUITPY_INTERNAL_NVM_SIZE 8192 + +//#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) +// End BC + +#define EXTERNAL_FLASH_QSPI_DUAL + +#define BOARD_HAS_CRYSTAL 1 + +//#define DEFAULT_I2C_BUS_SCL (&pin_PA13) +//#define DEFAULT_I2C_BUS_SDA (&pin_PA12) +#define DEFAULT_I2C_BUS_SCL (&pin_PA13) +#define DEFAULT_I2C_BUS_SDA (&pin_PA12) + +#define DEFAULT_SPI_BUS_SCK (&pin_PA17) +#define DEFAULT_SPI_BUS_MOSI (&pin_PB23) +#define DEFAULT_SPI_BUS_MISO (&pin_PB22) + +#define DEFAULT_UART_BUS_RX (&pin_PB17) +#define DEFAULT_UART_BUS_TX (&pin_PB16) + +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk new file mode 100644 index 0000000000..28b1434fb7 --- /dev/null +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk @@ -0,0 +1,18 @@ +LD_FILE = boards/samd51x19-bootloader-external-flash.ld + +USB_VID = 0x32BD +USB_PID = 0x3001 +USB_PRODUCT = "AloriumTech Evo M51" +USB_MANUFACTURER = "Alorium Technology, LLC" + +CHIP_VARIANT = SAMD51P19A +CHIP_FAMILY = samd51 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = GD25Q16C +LONGINT_IMPL = MPZ + +CIRCUITPY_NETWORK = 1 +MICROPY_PY_WIZNET5K = 5500 +CIRCUITPY_PS2IO = 1 diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/pins.c b/ports/atmel-samd/boards/aloriumtech_evo_m51/pins.c new file mode 100644 index 0000000000..129a3eed9c --- /dev/null +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/pins.c @@ -0,0 +1,60 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA02) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA05) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PB08) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PB09) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PA04) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PA06) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB23) }, + { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_PB23) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB22) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_PB22) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB17) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB17) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB16) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB16) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB03) }, + + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PB01) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB01) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_SDA_1), MP_ROM_PTR(&pin_PD09) }, + { MP_ROM_QSTR(MP_QSTR_SCL_1), MP_ROM_PTR(&pin_PD08) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 5ed4e4d0abfc49d3cde89cebc166ebbe0ef512d8 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 21 May 2020 21:34:44 +0800 Subject: [PATCH 09/13] lib: tinyusb: update to get tud_task_is_queue_empty This update gives us access to a function we can run with interrupts disabled to determine if the queue is empty. Signed-off-by: Sean Cross --- lib/tinyusb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tinyusb b/lib/tinyusb index 76bf96bcb0..dc5445e2f4 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 76bf96bcb0c12ba241ee4ecc175afb257e550d19 +Subproject commit dc5445e2f45cb348a44fe24fc1be4bc8b5ba5bab From d1a7fdd9d4720c43d0ab9f16267fd124a414ce9d Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 8 May 2020 12:37:32 +0800 Subject: [PATCH 10/13] supervisor: support debugging tinyusb Allow for passing `-DCFG_TUSB_DEBUG=1` or `-DCFG_TUSB_DEBUG=2` on the command line to enable debugging tinyusb within circuitpython. Signed-off-by: Sean Cross --- supervisor/shared/usb/tusb_config.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/supervisor/shared/usb/tusb_config.h b/supervisor/shared/usb/tusb_config.h index 627de743e2..5b7230983e 100644 --- a/supervisor/shared/usb/tusb_config.h +++ b/supervisor/shared/usb/tusb_config.h @@ -49,7 +49,9 @@ //--------------------------------------------------------------------+ #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE +#ifndef CFG_TUSB_DEBUG #define CFG_TUSB_DEBUG 0 +#endif /*------------- RTOS -------------*/ #ifndef CFG_TUSB_OS From 77cf4dce8f1ae03edbe275cb82e250daeba8990f Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 8 May 2020 12:38:23 +0800 Subject: [PATCH 11/13] nrf: disable interrupts before running wfi In order to ensure we don't have any outstanding requests, disable interrupts prior to issuing `WFI`. As part of this process, check to see if there are any pending USB requests, and only execute the `WFI` if there is no pending data. This fixes #2855 on NRF. Signed-off-by: Sean Cross --- ports/nrf/supervisor/port.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index ea09115f76..aa138e4814 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -51,8 +51,11 @@ #include "common-hal/rtc/RTC.h" #include "common-hal/neopixel_write/__init__.h" +#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/rtc/__init__.h" +#include "lib/tinyusb/src/device/usbd.h" + #ifdef CIRCUITPY_AUDIOBUSIO #include "common-hal/audiobusio/I2SOut.h" #endif @@ -264,7 +267,15 @@ void port_sleep_until_interrupt(void) { sd_app_evt_wait(); } else { // Call wait for interrupt ourselves if the SD isn't enabled. - __WFI(); + // Note that `wfi` should be called with interrupts disabled, + // to ensure that the queue is properly drained. The `wfi` + // instruction will returned as long as an interrupt is + // available, even though the actual handler won't fire until + // we re-enable interrupts. + common_hal_mcu_disable_interrupts(); + if (!tud_task_event_ready()) + __WFI(); + common_hal_mcu_enable_interrupts(); } } From fd4ef233c6d9b312c3582466c68390a16ddf15fa Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 21 May 2020 21:46:37 +0800 Subject: [PATCH 12/13] nrf: port: add memory barrier before wfi ARM recommends issuing a DSB instruction propr to issuing WFI, as it is required on many parts suchas Cortex-M7. This is effectively a no-op on the Cortex-M4 used in most NRF parts, however it ensures that we won't be surprised when new parts come out. See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHICBGB.html for more information. Signed-off-by: Sean Cross --- ports/nrf/supervisor/port.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index aa138e4814..36725293c8 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -273,8 +273,10 @@ void port_sleep_until_interrupt(void) { // available, even though the actual handler won't fire until // we re-enable interrupts. common_hal_mcu_disable_interrupts(); - if (!tud_task_event_ready()) + if (!tud_task_event_ready()) { + __DSB(); __WFI(); + } common_hal_mcu_enable_interrupts(); } } From 67cf005ee545df6b1d6f2a4947c58d6c2afb0f51 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 8 May 2020 16:59:39 +0800 Subject: [PATCH 13/13] nrf: nvm: assume sd is not enabled if interrupts are off If interrupts are disabled, then calling sd_* functions will hardfault. Instead, assume that it's safe to write if interrupts are disabled. Signed-off-by: Sean Cross --- ports/nrf/peripherals/nrf/nvm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/nrf/peripherals/nrf/nvm.c b/ports/nrf/peripherals/nrf/nvm.c index 63b168f14e..dc50e2eefa 100644 --- a/ports/nrf/peripherals/nrf/nvm.c +++ b/ports/nrf/peripherals/nrf/nvm.c @@ -40,6 +40,8 @@ STATIC bool sd_is_enabled(void) { uint8_t sd_en = 0; + if (__get_PRIMASK()) + return false; (void) sd_softdevice_is_enabled(&sd_en); return sd_en; }