From 9962ea644946a5388457bec85f82ec07571602f9 Mon Sep 17 00:00:00 2001 From: arturo182 Date: Mon, 12 Feb 2018 22:33:01 +0100 Subject: [PATCH] nrf: Change pin names on DKs to match silkscreen Quite a big revamp of the make-pins script, it is now used on each build to generate the pin files, so the static ones are not needed anymore. --- ports/nrf/Makefile | 17 +- ports/nrf/boards/feather52/mpconfigboard.h | 10 +- ports/nrf/boards/feather52/pins.c | 126 ------------- ports/nrf/boards/feather52/pins.csv | 49 +++-- ports/nrf/boards/feather52/pins.h | 28 --- ports/nrf/boards/make-pins.py | 201 ++------------------- ports/nrf/boards/nrf52_prefix.c | 19 +- ports/nrf/boards/pca10040/mpconfigboard.h | 14 +- ports/nrf/boards/pca10040/pins.c | 143 --------------- ports/nrf/boards/pca10040/pins.csv | 61 ++++--- ports/nrf/boards/pca10040/pins.h | 35 ---- ports/nrf/boards/pca10056/mpconfigboard.h | 14 +- ports/nrf/boards/pca10056/pins.c | 191 -------------------- ports/nrf/boards/pca10056/pins.csv | 96 +++++----- ports/nrf/boards/pca10056/pins.h | 51 ------ ports/nrf/modules/machine/pin.h | 2 - ports/nrf/nrf52_af.csv | 96 +++++----- ports/nrf/pin_defs_nrf5.h | 27 +-- 18 files changed, 203 insertions(+), 977 deletions(-) delete mode 100644 ports/nrf/boards/feather52/pins.c delete mode 100644 ports/nrf/boards/feather52/pins.h delete mode 100644 ports/nrf/boards/pca10040/pins.c delete mode 100644 ports/nrf/boards/pca10040/pins.h delete mode 100644 ports/nrf/boards/pca10056/pins.c delete mode 100644 ports/nrf/boards/pca10056/pins.h diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 6385092593..899e8686b9 100644 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -31,7 +31,7 @@ endif # qstr definitions (must come before including py.mk) -QSTR_DEFS = qstrdefsport.h +QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h FROZEN_MPY_DIR = freeze @@ -49,6 +49,7 @@ MCU_VARIANT_UPPER = $(shell echo $(MCU_VARIANT) | tr '[:lower:]' '[:upper:]') INC += -I. INC += -I../.. INC += -I$(BUILD) +INC += -I$(BUILD)/genhdr INC += -I./../../lib/cmsis/inc INC += -I./device INC += -I./device/$(MCU_VARIANT) @@ -142,7 +143,6 @@ SRC_C += \ drivers/bluetooth/ble_drv.c \ drivers/bluetooth/ble_uart.c \ boards/$(BOARD)/board.c \ - boards/$(BOARD)/pins.c \ device/$(MCU_VARIANT)/system_$(MCU_SUB_VARIANT).c \ device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \ lib/oofatfs/ff.c \ @@ -257,6 +257,7 @@ FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py') FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy)) OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) +OBJ += $(BUILD)/pins_gen.o OBJ += $(addprefix $(BUILD)/, $(SRC_HAL:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.c=.o)) @@ -326,16 +327,16 @@ SRC_QSTR_AUTO_DEPS += # any of the objects. The normal dependency generation will deal with the # case when pins.h is modified. But when it doesn't exist, we don't know # which source files might need it. -#$(OBJ): | $(HEADER_BUILD)/pins.h +$(OBJ): | $(HEADER_BUILD)/pins.h # Use a pattern rule here so that make will only call make-pins.py once to make # both pins_$(BOARD).c and pins.h -#$(BUILD)/%_$(BOARD).c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h $(BUILD)/%_qstr.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD) -# $(ECHO) "Create $@" -# $(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --qstr $(GEN_PINS_QSTR) --af-const $(GEN_PINS_AF_CONST) --af-py $(GEN_PINS_AF_PY) > $(GEN_PINS_SRC) +$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h $(BUILD)/%_qstr.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD) + $(ECHO) "Create $@" + $(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --qstr $(GEN_PINS_QSTR) --af-const $(GEN_PINS_AF_CONST) --af-py $(GEN_PINS_AF_PY) > $(GEN_PINS_SRC) -#$(BUILD)/pins_gen.o: $(BUILD)/pins_gen.c -# $(call compile_c) +$(BUILD)/pins_gen.o: $(BUILD)/pins_gen.c + $(call compile_c) MAKE_PINS = boards/make-pins.py BOARD_PINS = boards/$(BOARD)/pins.csv diff --git a/ports/nrf/boards/feather52/mpconfigboard.h b/ports/nrf/boards/feather52/mpconfigboard.h index 555cffde41..176e614996 100644 --- a/ports/nrf/boards/feather52/mpconfigboard.h +++ b/ports/nrf/boards/feather52/mpconfigboard.h @@ -57,15 +57,15 @@ #define MICROPY_HW_LED2 (19) // LED2 // UART config -#define MICROPY_HW_UART1_RX (pin_PA08) -#define MICROPY_HW_UART1_TX (pin_PA06) +#define MICROPY_HW_UART1_RX (pin_P0_08) +#define MICROPY_HW_UART1_TX (pin_P0_06) #define MICROPY_HW_UART1_HWFC (0) // SPI0 config #define MICROPY_HW_SPI0_NAME "SPI0" -#define MICROPY_HW_SPI0_SCK (pin_PA12) // (Arduino D13) -#define MICROPY_HW_SPI0_MOSI (pin_PA13) // (Arduino D11) -#define MICROPY_HW_SPI0_MISO (pin_PA14) // (Arduino D12) +#define MICROPY_HW_SPI0_SCK (pin_P0_12) // (Arduino D13) +#define MICROPY_HW_SPI0_MOSI (pin_P0_13) // (Arduino D11) +#define MICROPY_HW_SPI0_MISO (pin_P0_14) // (Arduino D12) #define MICROPY_HW_PWM0_NAME "PWM0" #define MICROPY_HW_PWM1_NAME "PWM1" diff --git a/ports/nrf/boards/feather52/pins.c b/ports/nrf/boards/feather52/pins.c deleted file mode 100644 index 36ce2cc6f3..0000000000 --- a/ports/nrf/boards/feather52/pins.c +++ /dev/null @@ -1,126 +0,0 @@ -// This file was automatically generated by make-pins.py -// -// --af nrf52_af.csv -// --board boards/feather52/pins.csv -// --prefix boards/nrf52_prefix.c - -// nrf52_prefix.c becomes the initial portion of the generated pins file. - -#include - -#include "py/obj.h" -#include "py/mphal.h" -#include "pin.h" - -#define AF(af_idx, af_fn, af_unit, af_type, af_ptr) \ -{ \ - { &pin_af_type }, \ - .name = MP_QSTR_AF ## af_idx ## _ ## af_fn ## af_unit, \ - .idx = (af_idx), \ - .fn = AF_FN_ ## af_fn, \ - .unit = (af_unit), \ - .type = AF_PIN_TYPE_ ## af_fn ## _ ## af_type, \ - .af_fn = (af_ptr) \ -} - -#define PIN(p_port, p_pin, p_af, p_adc_channel) \ -{ \ - { &mcu_pin_type }, \ - .name = MP_QSTR_ ## p_port ## p_pin, \ - .port = PORT_ ## p_port, \ - .pin = (p_pin), \ - .num_af = (sizeof(p_af) / sizeof(pin_af_obj_t)), \ - /*.pin_mask = (1 << p_pin), */\ - .af = p_af, \ - .adc_channel = p_adc_channel,\ -} - -#define NO_ADC 0 - -const pin_obj_t pin_PA02 = PIN(A, 2, NULL, SAADC_CH_PSELP_PSELP_AnalogInput0); -const pin_obj_t pin_PA03 = PIN(A, 3, NULL, SAADC_CH_PSELP_PSELP_AnalogInput1); -const pin_obj_t pin_PA04 = PIN(A, 4, NULL, SAADC_CH_PSELP_PSELP_AnalogInput2); -const pin_obj_t pin_PA05 = PIN(A, 5, NULL, SAADC_CH_PSELP_PSELP_AnalogInput3); -const pin_obj_t pin_PA06 = PIN(A, 6, NULL, NO_ADC); -const pin_obj_t pin_PA07 = PIN(A, 7, NULL, NO_ADC); -const pin_obj_t pin_PA08 = PIN(A, 8, NULL, NO_ADC); -const pin_obj_t pin_PA09 = PIN(A, 9, NULL, NO_ADC); -const pin_obj_t pin_PA10 = PIN(A, 10, NULL, NO_ADC); -const pin_obj_t pin_PA11 = PIN(A, 11, NULL, NO_ADC); -const pin_obj_t pin_PA12 = PIN(A, 12, NULL, NO_ADC); -const pin_obj_t pin_PA13 = PIN(A, 13, NULL, NO_ADC); -const pin_obj_t pin_PA14 = PIN(A, 14, NULL, NO_ADC); -const pin_obj_t pin_PA15 = PIN(A, 15, NULL, NO_ADC); -const pin_obj_t pin_PA16 = PIN(A, 16, NULL, NO_ADC); -const pin_obj_t pin_PA17 = PIN(A, 17, NULL, NO_ADC); - -const pin_obj_t pin_PA19 = PIN(A, 19, NULL, NO_ADC); -const pin_obj_t pin_PA20 = PIN(A, 20, NULL, NO_ADC); - -const pin_obj_t pin_PA25 = PIN(A, 25, NULL, NO_ADC); -const pin_obj_t pin_PA26 = PIN(A, 26, NULL, NO_ADC); -const pin_obj_t pin_PA27 = PIN(A, 27, NULL, NO_ADC); -const pin_obj_t pin_PA28 = PIN(A, 28, NULL, SAADC_CH_PSELP_PSELP_AnalogInput4); -const pin_obj_t pin_PA29 = PIN(A, 29, NULL, SAADC_CH_PSELP_PSELP_AnalogInput5); -const pin_obj_t pin_PA30 = PIN(A, 30, NULL, SAADC_CH_PSELP_PSELP_AnalogInput6); -const pin_obj_t pin_PA31 = PIN(A, 31, NULL, SAADC_CH_PSELP_PSELP_AnalogInput7); - -STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR_PA02), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_PA03), MP_ROM_PTR(&pin_PA03) }, - { MP_ROM_QSTR(MP_QSTR_PA04), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_PA05), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_PA07), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_PA12) }, - { MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) }, - { MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_PA16), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_PA17), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_PA19), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_PA20), MP_ROM_PTR(&pin_PA20) }, - { MP_ROM_QSTR(MP_QSTR_PA25), MP_ROM_PTR(&pin_PA25) }, - { MP_ROM_QSTR(MP_QSTR_PA26), MP_ROM_PTR(&pin_PA26) }, - { MP_ROM_QSTR(MP_QSTR_PA27), MP_ROM_PTR(&pin_PA27) }, - { MP_ROM_QSTR(MP_QSTR_PA28), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_PA29), MP_ROM_PTR(&pin_PA29) }, - { MP_ROM_QSTR(MP_QSTR_PA30), MP_ROM_PTR(&pin_PA30) }, - { MP_ROM_QSTR(MP_QSTR_PA31), MP_ROM_PTR(&pin_PA31) }, -}; -MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table); - -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0 ), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_A1 ), MP_ROM_PTR(&pin_PA03) }, - { MP_ROM_QSTR(MP_QSTR_A2 ), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_A3 ), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_TX ), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_A7 ), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_RX ), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_NFC1 ), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_NFC2 ), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_D11 ), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_SCK ), MP_ROM_PTR(&pin_PA12) }, - { MP_ROM_QSTR(MP_QSTR_MOSI ), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_MISO ), MP_ROM_PTR(&pin_PA14) }, - { MP_ROM_QSTR(MP_QSTR_D15 ), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_D16 ), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_LED1 ), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_LED2 ), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_DFU ), MP_ROM_PTR(&pin_PA20) }, - { MP_ROM_QSTR(MP_QSTR_SDA ), MP_ROM_PTR(&pin_PA25) }, - { MP_ROM_QSTR(MP_QSTR_SCL ), MP_ROM_PTR(&pin_PA26) }, - { MP_ROM_QSTR(MP_QSTR_D27 ), MP_ROM_PTR(&pin_PA27) }, - { MP_ROM_QSTR(MP_QSTR_A4 ), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_A5 ), MP_ROM_PTR(&pin_PA29) }, - { MP_ROM_QSTR(MP_QSTR_A6 ), MP_ROM_PTR(&pin_PA30) }, - { MP_ROM_QSTR(MP_QSTR_A7 ), MP_ROM_PTR(&pin_PA31) }, - // LED for standard examples - { MP_ROM_QSTR(MP_QSTR_D13 ), MP_ROM_PTR(&pin_PA17) }, -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/nrf/boards/feather52/pins.csv b/ports/nrf/boards/feather52/pins.csv index 8997ec559a..3ffab88d42 100644 --- a/ports/nrf/boards/feather52/pins.csv +++ b/ports/nrf/boards/feather52/pins.csv @@ -1,25 +1,24 @@ -A0,PA2,ADC0_IN0 -A1,PA3,ADC0_IN1 -A2,PA4,ADC0_IN2 -A3,PA5,ADC0_IN3 -TX,PA6 -PA7,PA7 -RX,PA8 -NFC1,PA9 -NFC2,PA10 -D11,PA11 -SCK,PA12 -MOSI,PA13 -MISO,PA14 -D15,PA15 -D16,PA16 -LED1,PA17 -LED2,PA19 -DFU,PA20 -SDA,PA25 -SCL,PA26 -D27,PA27 -A4,PA28,ADC0_IN4 -A5,PA29,ADC0_IN5 -A6,PA30,ADC0_IN6 -A7,PA31,ADC0_IN7 +A0,P0_02,ADC0_IN0 +A1,P0_03,ADC0_IN1 +A2,P0_04,ADC0_IN2 +A3,P0_05,ADC0_IN3 +TX,P0_06 +RX,P0_08 +NFC1,P0_09 +NFC2,P0_10 +D11,P0_11 +SCK,P0_12 +MOSI,P0_13 +MISO,P0_14 +D15,P0_15 +D16,P0_16 +LED1,P0_17 +LED2,P0_19 +DFU,P0_20 +SDA,P0_25 +SCL,P0_26 +D27,P0_27 +A4,P0_28,ADC0_IN4 +A5,P0_29,ADC0_IN5 +A6,P0_30,ADC0_IN6 +A7,P0_31,ADC0_IN7 diff --git a/ports/nrf/boards/feather52/pins.h b/ports/nrf/boards/feather52/pins.h deleted file mode 100644 index 6ad86fa285..0000000000 --- a/ports/nrf/boards/feather52/pins.h +++ /dev/null @@ -1,28 +0,0 @@ -extern const pin_obj_t pin_PA02; -extern const pin_obj_t pin_PA03; -extern const pin_obj_t pin_PA04; -extern const pin_obj_t pin_PA05; -extern const pin_obj_t pin_PA06; -extern const pin_obj_t pin_PA07; -extern const pin_obj_t pin_PA08; -extern const pin_obj_t pin_PA09; -extern const pin_obj_t pin_PA10; -extern const pin_obj_t pin_PA11; -extern const pin_obj_t pin_PA12; -extern const pin_obj_t pin_PA13; -extern const pin_obj_t pin_PA14; -extern const pin_obj_t pin_PA15; -extern const pin_obj_t pin_PA16; -extern const pin_obj_t pin_PA17; -extern const pin_obj_t pin_PA19; -extern const pin_obj_t pin_PA20; -extern const pin_obj_t pin_PA25; -extern const pin_obj_t pin_PA26; -extern const pin_obj_t pin_PA27; -extern const pin_obj_t pin_PA28; -extern const pin_obj_t pin_PA29; -extern const pin_obj_t pin_PA30; -extern const pin_obj_t pin_PA31; -extern const pin_obj_t * const pin_PAdc1[]; -extern const pin_obj_t * const pin_PAdc2[]; -extern const pin_obj_t * const pin_PAdc3[]; diff --git a/ports/nrf/boards/make-pins.py b/ports/nrf/boards/make-pins.py index 1edd2f99a9..5fe6005071 100644 --- a/ports/nrf/boards/make-pins.py +++ b/ports/nrf/boards/make-pins.py @@ -7,24 +7,22 @@ import argparse import sys import csv -SUPPORTED_FN = { - 'UART' : ['RX', 'TX', 'CTS', 'RTS'] -} def parse_port_pin(name_str): """Parses a string and returns a (port-num, pin-num) tuple.""" - if len(name_str) < 3: - raise ValueError("Expecting pin name to be at least 4 charcters.") + if len(name_str) < 4: + raise ValueError("Expecting pin name to be at least 5 charcters.") if name_str[0] != 'P': raise ValueError("Expecting pin name to start with P") - if name_str[1] not in ('A', 'B'): - raise ValueError("Expecting pin port to be in A or B") - port = ord(name_str[1]) - ord('A') - pin_str = name_str[2:].split('/')[0] + if name_str[1] not in ('0', '1'): + raise ValueError("Expecting pin port to be in 0 or 1") + port = ord(name_str[1]) - ord('0') + pin_str = name_str[3:] if not pin_str.isdigit(): raise ValueError("Expecting numeric pin number.") return (port, int(pin_str)) + def split_name_num(name_num): num = None for num_idx in range(len(name_num) - 1, -1, -1): @@ -37,72 +35,17 @@ def split_name_num(name_num): return name, num -class AlternateFunction(object): - """Holds the information associated with a pins alternate function.""" - - def __init__(self, idx, af_str): - self.idx = idx - self.af_str = af_str - - self.func = '' - self.fn_num = None - self.pin_type = '' - self.supported = False - - af_words = af_str.split('_', 1) - self.func, self.fn_num = split_name_num(af_words[0]) - if len(af_words) > 1: - self.pin_type = af_words[1] - if self.func in SUPPORTED_FN: - pin_types = SUPPORTED_FN[self.func] - if self.pin_type in pin_types: - self.supported = True - - def is_supported(self): - return self.supported - - def ptr(self): - """Returns the numbered function (i.e. USART6) for this AF.""" - if self.fn_num is None: - return self.func - return '{:s}{:d}'.format(self.func, self.fn_num) - - def mux_name(self): - return 'AF{:d}_{:s}'.format(self.idx, self.ptr()) - - def print(self): - """Prints the C representation of this AF.""" - if self.supported: - print(' AF', end='') - else: - print(' //', end='') - fn_num = self.fn_num - if fn_num is None: - fn_num = 0 - print('({:2d}, {:8s}, {:2d}, {:10s}, {:8s}), // {:s}'.format(self.idx, - self.func, fn_num, self.pin_type, self.ptr(), self.af_str)) - - def qstr_list(self): - return [self.mux_name()] - - class Pin(object): """Holds the information associated with a pin.""" def __init__(self, port, pin): self.port = port self.pin = pin - self.alt_fn = [] - self.alt_fn_count = 0 - self.adc_num = 0 - self.adc_channel = 0 + self.adc_channel = '0' self.board_pin = False - def port_letter(self): - return chr(self.port + ord('A')) - def cpu_pin_name(self): - return '{:s}{:d}'.format(self.port_letter(), self.pin) + return 'P{:d}_{:02d}'.format(self.port, self.pin) def is_board_pin(self): return self.board_pin @@ -113,69 +56,17 @@ class Pin(object): def parse_adc(self, adc_str): if (adc_str[:3] != 'ADC'): return - (adc,channel) = adc_str.split('_') - for idx in range(3, len(adc)): - self.adc_num = int(adc[idx]) - self.adc_channel = int(channel[2:]) - - def parse_af(self, af_idx, af_strs_in): - if len(af_strs_in) == 0: - return - # If there is a slash, then the slash separates 2 aliases for the - # same alternate function. - af_strs = af_strs_in.split('/') - for af_str in af_strs: - alt_fn = AlternateFunction(af_idx, af_str) - self.alt_fn.append(alt_fn) - if alt_fn.is_supported(): - self.alt_fn_count += 1 - - def alt_fn_name(self, null_if_0=False): - if null_if_0 and self.alt_fn_count == 0: - return 'NULL' - return 'pin_{:s}_af'.format(self.cpu_pin_name()) - - def adc_num_str(self): - str = '' - for adc_num in range(1,4): - if self.adc_num & (1 << (adc_num - 1)): - if len(str) > 0: - str += ' | ' - str += 'PIN_ADC' - str += chr(ord('0') + adc_num) - if len(str) == 0: - str = '0' - return str + (adc, channel) = adc_str.split('_IN') + self.adc_channel = 'SAADC_CH_PSELP_PSELP_AnalogInput%d' % int(channel) def print(self): - if self.alt_fn_count == 0: - print("// ", end='') - print('const pin_af_obj_t {:s}[] = {{'.format(self.alt_fn_name())) - for alt_fn in self.alt_fn: - alt_fn.print() - if self.alt_fn_count == 0: - print("// ", end='') - print('};') - print('') - print('const pin_obj_t pin_{:s} = PIN({:s}, {:d}, {:s}, {:s}, {:d});'.format( - self.cpu_pin_name(), self.port_letter(), self.pin, - self.alt_fn_name(null_if_0=True), - self.adc_num_str(), self.adc_channel)) - print('') + print('const pin_obj_t pin_{:s} = PIN({:s}, {:d}, {:d}, {:s});'.format( + self.cpu_pin_name(), self.cpu_pin_name(), + self.port, self.pin, self.adc_channel)) def print_header(self, hdr_file): hdr_file.write('extern const pin_obj_t pin_{:s};\n'. format(self.cpu_pin_name())) - if self.alt_fn_count > 0: - hdr_file.write('extern const pin_af_obj_t pin_{:s}_af[];\n'. - format(self.cpu_pin_name())) - - def qstr_list(self): - result = [] - for alt_fn in self.alt_fn: - if alt_fn.is_supported(): - result += alt_fn.qstr_list() - return result class NamedPin(object): @@ -194,8 +85,8 @@ class NamedPin(object): class Pins(object): def __init__(self): - self.cpu_pins = [] # list of NamedPin objects - self.board_pins = [] # list of NamedPin objects + self.cpu_pins = [] # list of NamedPin objects + self.board_pins = [] # list of NamedPin objects def find_pin(self, port_num, pin_num): for named_pin in self.cpu_pins: @@ -230,16 +121,19 @@ class Pins(object): pin = self.find_pin(port_num, pin_num) if pin: pin.set_is_board_pin() + if len(row) == 3: + pin.parse_adc(row[2]) self.board_pins.append(NamedPin(row[0], pin)) def print_named(self, label, named_pins): + print('') print('STATIC const mp_rom_map_elem_t {:s}_table[] = {{'.format(label)) for named_pin in named_pins: pin = named_pin.pin() if pin.is_board_pin(): print(' {{ MP_ROM_QSTR(MP_QSTR_{:s}), MP_ROM_PTR(&pin_{:s}) }},'.format(named_pin.name(), pin.cpu_pin_name())) print('};') - print('MP_DEFINE_CONST_DICT({:s}, {:s}_table);'.format(label, label)); + print('MP_DEFINE_CONST_DICT({:s}, {:s}_table);'.format(label, label)) def print(self): for named_pin in self.cpu_pins: @@ -247,35 +141,14 @@ class Pins(object): if pin.is_board_pin(): pin.print() self.print_named('mcu_pin_globals', self.cpu_pins) - print('') self.print_named('board_module_globals', self.board_pins) - def print_adc(self, adc_num): - print(''); - print('const pin_obj_t * const pin_adc{:d}[] = {{'.format(adc_num)) - for channel in range(16): - adc_found = False - for named_pin in self.cpu_pins: - pin = named_pin.pin() - if (pin.is_board_pin() and - (pin.adc_num & (1 << (adc_num - 1))) and (pin.adc_channel == channel)): - print(' &pin_{:s}, // {:d}'.format(pin.cpu_pin_name(), channel)) - adc_found = True - break - if not adc_found: - print(' NULL, // {:d}'.format(channel)) - print('};') - - def print_header(self, hdr_filename): with open(hdr_filename, 'wt') as hdr_file: for named_pin in self.cpu_pins: pin = named_pin.pin() if pin.is_board_pin(): pin.print_header(hdr_file) - hdr_file.write('extern const pin_obj_t * const pin_adc1[];\n') - hdr_file.write('extern const pin_obj_t * const pin_adc2[];\n') - hdr_file.write('extern const pin_obj_t * const pin_adc3[];\n') def print_qstr(self, qstr_filename): with open(qstr_filename, 'wt') as qstr_file: @@ -283,7 +156,6 @@ class Pins(object): for named_pin in self.cpu_pins: pin = named_pin.pin() if pin.is_board_pin(): - qstr_set |= set(pin.qstr_list()) qstr_set |= set([named_pin.name()]) for named_pin in self.board_pins: qstr_set |= set([named_pin.name()]) @@ -291,37 +163,6 @@ class Pins(object): print('Q({})'.format(qstr), file=qstr_file) - def print_af_hdr(self, af_const_filename): - with open(af_const_filename, 'wt') as af_const_file: - af_hdr_set = set([]) - mux_name_width = 0 - for named_pin in self.cpu_pins: - pin = named_pin.pin() - if pin.is_board_pin(): - for af in pin.alt_fn: - if af.is_supported(): - mux_name = af.mux_name() - af_hdr_set |= set([mux_name]) - if len(mux_name) > mux_name_width: - mux_name_width = len(mux_name) - for mux_name in sorted(af_hdr_set): - key = 'MP_ROM_QSTR(MP_QSTR_{}),'.format(mux_name) - val = 'MP_ROM_INT(GPIO_{})'.format(mux_name) - print(' { %-*s %s },' % (mux_name_width + 26, key, val), - file=af_const_file) - - def print_af_py(self, af_py_filename): - with open(af_py_filename, 'wt') as af_py_file: - print('PINS_AF = (', file=af_py_file); - for named_pin in self.board_pins: - print(" ('%s', " % named_pin.name(), end='', file=af_py_file) - for af in named_pin.pin().alt_fn: - if af.is_supported(): - print("(%d, '%s'), " % (af.idx, af.af_str), end='', file=af_py_file) - print('),', file=af_py_file) - print(')', file=af_py_file) - - def main(): parser = argparse.ArgumentParser( prog="make-pins.py", @@ -391,8 +232,6 @@ def main(): pins.print() pins.print_header(args.hdr_filename) pins.print_qstr(args.qstr_filename) - pins.print_af_hdr(args.af_const_filename) - pins.print_af_py(args.af_py_filename) if __name__ == "__main__": diff --git a/ports/nrf/boards/nrf52_prefix.c b/ports/nrf/boards/nrf52_prefix.c index f408bdcf45..f9b25a8510 100644 --- a/ports/nrf/boards/nrf52_prefix.c +++ b/ports/nrf/boards/nrf52_prefix.c @@ -6,26 +6,11 @@ #include "py/mphal.h" #include "pin.h" -#define AF(af_idx, af_fn, af_unit, af_type, af_ptr) \ -{ \ - { &pin_af_type }, \ - .name = MP_QSTR_AF ## af_idx ## _ ## af_fn ## af_unit, \ - .idx = (af_idx), \ - .fn = AF_FN_ ## af_fn, \ - .unit = (af_unit), \ - .type = AF_PIN_TYPE_ ## af_fn ## _ ## af_type, \ - .af_fn = (af_ptr) \ -} - -#define PIN(p_port, p_pin, p_af, p_adc_num, p_adc_channel) \ +#define PIN(p_name, p_port, p_pin, p_adc_channel) \ { \ { &mcu_pin_type }, \ - .name = MP_QSTR_ ## p_port ## p_pin, \ + .name = MP_QSTR_ ## p_name, \ .port = PORT_ ## p_port, \ .pin = (p_pin), \ - .num_af = (sizeof(p_af) / sizeof(pin_af_obj_t)), \ - .pin_mask = (1 << p_pin), \ - .af = p_af, \ - .adc_num = p_adc_num, \ .adc_channel = p_adc_channel, \ } diff --git a/ports/nrf/boards/pca10040/mpconfigboard.h b/ports/nrf/boards/pca10040/mpconfigboard.h index 5852881db3..905ef0f4ab 100644 --- a/ports/nrf/boards/pca10040/mpconfigboard.h +++ b/ports/nrf/boards/pca10040/mpconfigboard.h @@ -61,17 +61,17 @@ #define MICROPY_HW_LED4 (20) // LED4 // UART config -#define MICROPY_HW_UART1_RX (pin_A8) -#define MICROPY_HW_UART1_TX (pin_A6) -#define MICROPY_HW_UART1_CTS (pin_A7) -#define MICROPY_HW_UART1_RTS (pin_A5) +#define MICROPY_HW_UART1_RX (pin_P0_08) +#define MICROPY_HW_UART1_TX (pin_P0_06) +#define MICROPY_HW_UART1_CTS (pin_P0_07) +#define MICROPY_HW_UART1_RTS (pin_P0_05) #define MICROPY_HW_UART1_HWFC (1) // SPI0 config #define MICROPY_HW_SPI0_NAME "SPI0" -#define MICROPY_HW_SPI0_SCK (pin_A25) // (Arduino D13) -#define MICROPY_HW_SPI0_MOSI (pin_A23) // (Arduino D11) -#define MICROPY_HW_SPI0_MISO (pin_A24) // (Arduino D12) +#define MICROPY_HW_SPI0_SCK (pin_P0_25) // (Arduino D13) +#define MICROPY_HW_SPI0_MOSI (pin_P0_23) // (Arduino D11) +#define MICROPY_HW_SPI0_MISO (pin_P0_24) // (Arduino D12) #define MICROPY_HW_PWM0_NAME "PWM0" #define MICROPY_HW_PWM1_NAME "PWM1" diff --git a/ports/nrf/boards/pca10040/pins.c b/ports/nrf/boards/pca10040/pins.c deleted file mode 100644 index f34f7ec8af..0000000000 --- a/ports/nrf/boards/pca10040/pins.c +++ /dev/null @@ -1,143 +0,0 @@ -// This file was automatically generated by make-pins.py -// -// --af nrf52_af.csv -// --board boards/pca10056/pins.csv -// --prefix boards/nrf52_prefix.c - -// nrf52_prefix.c becomes the initial portion of the generated pins file. - -#include - -#include "py/obj.h" -#include "py/mphal.h" -#include "pin.h" - -#define AF(af_idx, af_fn, af_unit, af_type, af_ptr) \ -{ \ - { &pin_af_type }, \ - .name = MP_QSTR_AF ## af_idx ## _ ## af_fn ## af_unit, \ - .idx = (af_idx), \ - .fn = AF_FN_ ## af_fn, \ - .unit = (af_unit), \ - .type = AF_PIN_TYPE_ ## af_fn ## _ ## af_type, \ - .af_fn = (af_ptr) \ -} - -#define PIN(p_port, p_pin, p_af, p_adc_channel) \ -{ \ - { &mcu_pin_type }, \ - .name = MP_QSTR_ ## p_port ## p_pin, \ - .port = PORT_ ## p_port, \ - .pin = (p_pin), \ - .num_af = (sizeof(p_af) / sizeof(pin_af_obj_t)), \ - /*.pin_mask = (1 << p_pin), */\ - .af = p_af, \ - .adc_channel = p_adc_channel,\ -} - -#define NO_ADC 0 - -const pin_obj_t pin_A0 = PIN(A, 0, NULL, 0); -const pin_obj_t pin_A1 = PIN(A, 1, NULL, 0); -const pin_obj_t pin_A2 = PIN(A, 2, NULL, SAADC_CH_PSELP_PSELP_AnalogInput0); -const pin_obj_t pin_A3 = PIN(A, 3, NULL, SAADC_CH_PSELP_PSELP_AnalogInput1); -const pin_obj_t pin_A4 = PIN(A, 4, NULL, SAADC_CH_PSELP_PSELP_AnalogInput2); -const pin_obj_t pin_A5 = PIN(A, 5, NULL, SAADC_CH_PSELP_PSELP_AnalogInput3); -const pin_obj_t pin_A6 = PIN(A, 6, NULL, 0); -const pin_obj_t pin_A7 = PIN(A, 7, NULL, 0); -const pin_obj_t pin_A8 = PIN(A, 8, NULL, 0); -const pin_obj_t pin_A9 = PIN(A, 9, NULL, 0); -const pin_obj_t pin_A10 = PIN(A, 10, NULL, 0); -const pin_obj_t pin_A11 = PIN(A, 11, NULL, 0); -const pin_obj_t pin_A12 = PIN(A, 12, NULL, 0); -const pin_obj_t pin_A13 = PIN(A, 13, NULL, 0); -const pin_obj_t pin_A14 = PIN(A, 14, NULL, 0); -const pin_obj_t pin_A15 = PIN(A, 15, NULL, 0); -const pin_obj_t pin_A16 = PIN(A, 16, NULL, 0); -const pin_obj_t pin_A17 = PIN(A, 17, NULL, 0); -const pin_obj_t pin_A18 = PIN(A, 18, NULL, 0); -const pin_obj_t pin_A19 = PIN(A, 19, NULL, 0); -const pin_obj_t pin_A20 = PIN(A, 20, NULL, 0); -const pin_obj_t pin_A21 = PIN(A, 21, NULL, 0); -const pin_obj_t pin_A22 = PIN(A, 22, NULL, 0); -const pin_obj_t pin_A23 = PIN(A, 23, NULL, 0); -const pin_obj_t pin_A24 = PIN(A, 24, NULL, 0); -const pin_obj_t pin_A25 = PIN(A, 25, NULL, 0); -const pin_obj_t pin_A26 = PIN(A, 26, NULL, 0); -const pin_obj_t pin_A27 = PIN(A, 27, NULL, 0); -const pin_obj_t pin_A28 = PIN(A, 28, NULL, SAADC_CH_PSELP_PSELP_AnalogInput4); -const pin_obj_t pin_A29 = PIN(A, 29, NULL, SAADC_CH_PSELP_PSELP_AnalogInput5); -const pin_obj_t pin_A30 = PIN(A, 30, NULL, SAADC_CH_PSELP_PSELP_AnalogInput6); -const pin_obj_t pin_A31 = PIN(A, 31, NULL, SAADC_CH_PSELP_PSELP_AnalogInput7); - -STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_A0) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_A1) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_A2) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_A3) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_A4) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_A5) }, - { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_A6) }, - { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_A7) }, - { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_A8) }, - { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_A9) }, - { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_A10) }, - { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_A11) }, - { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_A12) }, - { MP_ROM_QSTR(MP_QSTR_A13), MP_ROM_PTR(&pin_A13) }, - { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_PTR(&pin_A14) }, - { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_A15) }, - { MP_ROM_QSTR(MP_QSTR_A16), MP_ROM_PTR(&pin_A16) }, - { MP_ROM_QSTR(MP_QSTR_A17), MP_ROM_PTR(&pin_A17) }, - { MP_ROM_QSTR(MP_QSTR_A18), MP_ROM_PTR(&pin_A18) }, - { MP_ROM_QSTR(MP_QSTR_A19), MP_ROM_PTR(&pin_A19) }, - { MP_ROM_QSTR(MP_QSTR_A20), MP_ROM_PTR(&pin_A20) }, - { MP_ROM_QSTR(MP_QSTR_A21), MP_ROM_PTR(&pin_A21) }, - { MP_ROM_QSTR(MP_QSTR_A22), MP_ROM_PTR(&pin_A22) }, - { MP_ROM_QSTR(MP_QSTR_A23), MP_ROM_PTR(&pin_A23) }, - { MP_ROM_QSTR(MP_QSTR_A24), MP_ROM_PTR(&pin_A24) }, - { MP_ROM_QSTR(MP_QSTR_A25), MP_ROM_PTR(&pin_A25) }, - { MP_ROM_QSTR(MP_QSTR_A26), MP_ROM_PTR(&pin_A26) }, - { MP_ROM_QSTR(MP_QSTR_A27), MP_ROM_PTR(&pin_A27) }, - { MP_ROM_QSTR(MP_QSTR_A28), MP_ROM_PTR(&pin_A28) }, - { MP_ROM_QSTR(MP_QSTR_A29), MP_ROM_PTR(&pin_A29) }, - { MP_ROM_QSTR(MP_QSTR_A30), MP_ROM_PTR(&pin_A30) }, - { MP_ROM_QSTR(MP_QSTR_A31), MP_ROM_PTR(&pin_A31) }, -}; -MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table); - -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR_PA0), MP_ROM_PTR(&pin_A0) }, - { MP_ROM_QSTR(MP_QSTR_PA1), MP_ROM_PTR(&pin_A1) }, - { MP_ROM_QSTR(MP_QSTR_PA2), MP_ROM_PTR(&pin_A2) }, - { MP_ROM_QSTR(MP_QSTR_PA3), MP_ROM_PTR(&pin_A3) }, - { MP_ROM_QSTR(MP_QSTR_PA4), MP_ROM_PTR(&pin_A4) }, - { MP_ROM_QSTR(MP_QSTR_PA5), MP_ROM_PTR(&pin_A5) }, - { MP_ROM_QSTR(MP_QSTR_PA6), MP_ROM_PTR(&pin_A6) }, - { MP_ROM_QSTR(MP_QSTR_PA7), MP_ROM_PTR(&pin_A7) }, - { MP_ROM_QSTR(MP_QSTR_PA8), MP_ROM_PTR(&pin_A8) }, - { MP_ROM_QSTR(MP_QSTR_PA9), MP_ROM_PTR(&pin_A9) }, - { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_A10) }, - { MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_A11) }, - { MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_A12) }, - { MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_A13) }, - { MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_A14) }, - { MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_A15) }, - { MP_ROM_QSTR(MP_QSTR_PA16), MP_ROM_PTR(&pin_A16) }, - { MP_ROM_QSTR(MP_QSTR_PA17), MP_ROM_PTR(&pin_A17) }, - { MP_ROM_QSTR(MP_QSTR_PA18), MP_ROM_PTR(&pin_A18) }, - { MP_ROM_QSTR(MP_QSTR_PA19), MP_ROM_PTR(&pin_A19) }, - { MP_ROM_QSTR(MP_QSTR_PA20), MP_ROM_PTR(&pin_A20) }, - { MP_ROM_QSTR(MP_QSTR_PA21), MP_ROM_PTR(&pin_A21) }, - { MP_ROM_QSTR(MP_QSTR_PA22), MP_ROM_PTR(&pin_A22) }, - { MP_ROM_QSTR(MP_QSTR_PA23), MP_ROM_PTR(&pin_A23) }, - { MP_ROM_QSTR(MP_QSTR_PA24), MP_ROM_PTR(&pin_A24) }, - { MP_ROM_QSTR(MP_QSTR_PA25), MP_ROM_PTR(&pin_A25) }, - { MP_ROM_QSTR(MP_QSTR_PA26), MP_ROM_PTR(&pin_A26) }, - { MP_ROM_QSTR(MP_QSTR_PA27), MP_ROM_PTR(&pin_A27) }, - { MP_ROM_QSTR(MP_QSTR_PA28), MP_ROM_PTR(&pin_A28) }, - { MP_ROM_QSTR(MP_QSTR_PA29), MP_ROM_PTR(&pin_A29) }, - { MP_ROM_QSTR(MP_QSTR_PA30), MP_ROM_PTR(&pin_A30) }, - { MP_ROM_QSTR(MP_QSTR_PA31), MP_ROM_PTR(&pin_A31) }, -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/nrf/boards/pca10040/pins.csv b/ports/nrf/boards/pca10040/pins.csv index c177133983..2202224461 100644 --- a/ports/nrf/boards/pca10040/pins.csv +++ b/ports/nrf/boards/pca10040/pins.csv @@ -1,30 +1,31 @@ -PA2,PA2 -PA3,PA3 -PA4,PA4 -PA5,PA5 -PA6,PA6 -PA7,PA7 -PA8,PA8 -PA9,PA9 -PA10,PA10 -PA11,PA11 -PA12,PA12 -PA13,PA13 -PA14,PA14 -PA15,PA15 -PA16,PA16 -PA17,PA17 -PA18,PA18 -PA19,PA19 -PA20,PA20 -PA21,PA21 -PA22,PA22 -PA23,PA23 -PA24,PA24 -PA25,PA25 -PA26,PA26 -PA27,PA27 -PA28,PA28 -PA29,PA29 -PA30,PA30 -PA31,PA31 \ No newline at end of file +P0_01,P0_01 +P0_02,P0_02 +P0_03,P0_03 +P0_04,P0_04 +P0_05,P0_05 +P0_06,P0_06 +P0_07,P0_07 +P0_08,P0_08 +P0_09,P0_09 +P0_10,P0_10 +P0_11,P0_11 +P0_12,P0_12 +P0_13,P0_13 +P0_14,P0_14 +P0_15,P0_15 +P0_16,P0_16 +P0_17,P0_17 +P0_18,P0_18 +P0_19,P0_19 +P0_20,P0_20 +P0_21,P0_21 +P0_22,P0_22 +P0_23,P0_23 +P0_24,P0_24 +P0_25,P0_25 +P0_26,P0_26 +P0_27,P0_27 +P0_28,P0_28 +P0_29,P0_29 +P0_30,P0_30 +P0_31,P0_31 diff --git a/ports/nrf/boards/pca10040/pins.h b/ports/nrf/boards/pca10040/pins.h deleted file mode 100644 index 4b66c41527..0000000000 --- a/ports/nrf/boards/pca10040/pins.h +++ /dev/null @@ -1,35 +0,0 @@ -extern const pin_obj_t pin_A0; -extern const pin_obj_t pin_A1; -extern const pin_obj_t pin_A2; -extern const pin_obj_t pin_A3; -extern const pin_obj_t pin_A4; -extern const pin_obj_t pin_A5; -extern const pin_obj_t pin_A6; -extern const pin_obj_t pin_A7; -extern const pin_obj_t pin_A8; -extern const pin_obj_t pin_A9; -extern const pin_obj_t pin_A10; -extern const pin_obj_t pin_A11; -extern const pin_obj_t pin_A12; -extern const pin_obj_t pin_A13; -extern const pin_obj_t pin_A14; -extern const pin_obj_t pin_A15; -extern const pin_obj_t pin_A16; -extern const pin_obj_t pin_A17; -extern const pin_obj_t pin_A18; -extern const pin_obj_t pin_A19; -extern const pin_obj_t pin_A20; -extern const pin_obj_t pin_A21; -extern const pin_obj_t pin_A22; -extern const pin_obj_t pin_A23; -extern const pin_obj_t pin_A24; -extern const pin_obj_t pin_A25; -extern const pin_obj_t pin_A26; -extern const pin_obj_t pin_A27; -extern const pin_obj_t pin_A28; -extern const pin_obj_t pin_A29; -extern const pin_obj_t pin_A30; -extern const pin_obj_t pin_A31; -extern const pin_obj_t * const pin_adc1[]; -extern const pin_obj_t * const pin_adc2[]; -extern const pin_obj_t * const pin_adc3[]; diff --git a/ports/nrf/boards/pca10056/mpconfigboard.h b/ports/nrf/boards/pca10056/mpconfigboard.h index 3d3cf5fbd5..c22347749e 100644 --- a/ports/nrf/boards/pca10056/mpconfigboard.h +++ b/ports/nrf/boards/pca10056/mpconfigboard.h @@ -61,18 +61,18 @@ #define MICROPY_HW_LED4 (16) // LED4 // UART config -#define MICROPY_HW_UART1_RX (pin_A8) -#define MICROPY_HW_UART1_TX (pin_A6) -#define MICROPY_HW_UART1_CTS (pin_A7) -#define MICROPY_HW_UART1_RTS (pin_A5) +#define MICROPY_HW_UART1_RX (pin_P0_08) +#define MICROPY_HW_UART1_TX (pin_P0_06) +#define MICROPY_HW_UART1_CTS (pin_P0_07) +#define MICROPY_HW_UART1_RTS (pin_P0_05) #define MICROPY_HW_UART1_HWFC (1) // SPI0 config #define MICROPY_HW_SPI0_NAME "SPI0" -#define MICROPY_HW_SPI0_SCK (pin_B15) -#define MICROPY_HW_SPI0_MOSI (pin_B13) -#define MICROPY_HW_SPI0_MISO (pin_B14) +#define MICROPY_HW_SPI0_SCK (pin_P1_15) +#define MICROPY_HW_SPI0_MOSI (pin_P1_13) +#define MICROPY_HW_SPI0_MISO (pin_P1_14) #define MICROPY_HW_PWM0_NAME "PWM0" #define MICROPY_HW_PWM1_NAME "PWM1" diff --git a/ports/nrf/boards/pca10056/pins.c b/ports/nrf/boards/pca10056/pins.c deleted file mode 100644 index 30e9a365c8..0000000000 --- a/ports/nrf/boards/pca10056/pins.c +++ /dev/null @@ -1,191 +0,0 @@ -// This file was automatically generated by make-pins.py -// -// --af nrf52_af.csv -// --board boards/pca10056/pins.csv -// --prefix boards/nrf52_prefix.c - -// nrf52_prefix.c becomes the initial portion of the generated pins file. - -#include - -#include "py/obj.h" -#include "py/mphal.h" -#include "pin.h" - -#define AF(af_idx, af_fn, af_unit, af_type, af_ptr) \ -{ \ - { &pin_af_type }, \ - .name = MP_QSTR_AF ## af_idx ## _ ## af_fn ## af_unit, \ - .idx = (af_idx), \ - .fn = AF_FN_ ## af_fn, \ - .unit = (af_unit), \ - .type = AF_PIN_TYPE_ ## af_fn ## _ ## af_type, \ - .af_fn = (af_ptr) \ -} - -#define PIN(p_port, p_pin, p_af, p_adc_channel) \ -{ \ - { &mcu_pin_type }, \ - .name = MP_QSTR_ ## p_port ## p_pin, \ - .port = PORT_ ## p_port, \ - .pin = (p_pin), \ - .num_af = (sizeof(p_af) / sizeof(pin_af_obj_t)), \ - /*.pin_mask = (1 << p_pin), */\ - .af = p_af, \ - .adc_channel = p_adc_channel,\ -} - -#define NO_ADC 0 - -const pin_obj_t pin_A0 = PIN(A, 0, NULL, 0); -const pin_obj_t pin_A1 = PIN(A, 1, NULL, 0); -const pin_obj_t pin_A2 = PIN(A, 2, NULL, SAADC_CH_PSELP_PSELP_AnalogInput0); -const pin_obj_t pin_A3 = PIN(A, 3, NULL, SAADC_CH_PSELP_PSELP_AnalogInput1); -const pin_obj_t pin_A4 = PIN(A, 4, NULL, SAADC_CH_PSELP_PSELP_AnalogInput2); -const pin_obj_t pin_A5 = PIN(A, 5, NULL, SAADC_CH_PSELP_PSELP_AnalogInput3); -const pin_obj_t pin_A6 = PIN(A, 6, NULL, 0); -const pin_obj_t pin_A7 = PIN(A, 7, NULL, 0); -const pin_obj_t pin_A8 = PIN(A, 8, NULL, 0); -const pin_obj_t pin_A9 = PIN(A, 9, NULL, 0); -const pin_obj_t pin_A10 = PIN(A, 10, NULL, 0); -const pin_obj_t pin_A11 = PIN(A, 11, NULL, 0); -const pin_obj_t pin_A12 = PIN(A, 12, NULL, 0); -const pin_obj_t pin_A13 = PIN(A, 13, NULL, 0); -const pin_obj_t pin_A14 = PIN(A, 14, NULL, 0); -const pin_obj_t pin_A15 = PIN(A, 15, NULL, 0); -const pin_obj_t pin_A16 = PIN(A, 16, NULL, 0); -const pin_obj_t pin_A17 = PIN(A, 17, NULL, 0); -const pin_obj_t pin_A18 = PIN(A, 18, NULL, 0); -const pin_obj_t pin_A19 = PIN(A, 19, NULL, 0); -const pin_obj_t pin_A20 = PIN(A, 20, NULL, 0); -const pin_obj_t pin_A21 = PIN(A, 21, NULL, 0); -const pin_obj_t pin_A22 = PIN(A, 22, NULL, 0); -const pin_obj_t pin_A23 = PIN(A, 23, NULL, 0); -const pin_obj_t pin_A24 = PIN(A, 24, NULL, 0); -const pin_obj_t pin_A25 = PIN(A, 25, NULL, 0); -const pin_obj_t pin_A26 = PIN(A, 26, NULL, 0); -const pin_obj_t pin_A27 = PIN(A, 27, NULL, 0); -const pin_obj_t pin_A28 = PIN(A, 28, NULL, SAADC_CH_PSELP_PSELP_AnalogInput4); -const pin_obj_t pin_A29 = PIN(A, 29, NULL, SAADC_CH_PSELP_PSELP_AnalogInput5); -const pin_obj_t pin_A30 = PIN(A, 30, NULL, SAADC_CH_PSELP_PSELP_AnalogInput6); -const pin_obj_t pin_A31 = PIN(A, 31, NULL, SAADC_CH_PSELP_PSELP_AnalogInput7); -const pin_obj_t pin_B0 = PIN(B, 0, NULL, 0); -const pin_obj_t pin_B1 = PIN(B, 1, NULL, 0); -const pin_obj_t pin_B2 = PIN(B, 2, NULL, 0); -const pin_obj_t pin_B3 = PIN(B, 3, NULL, 0); -const pin_obj_t pin_B4 = PIN(B, 4, NULL, 0); -const pin_obj_t pin_B5 = PIN(B, 5, NULL, 0); -const pin_obj_t pin_B6 = PIN(B, 6, NULL, 0); -const pin_obj_t pin_B7 = PIN(B, 7, NULL, 0); -const pin_obj_t pin_B8 = PIN(B, 8, NULL, 0); -const pin_obj_t pin_B9 = PIN(B, 9, NULL, 0); -const pin_obj_t pin_B10 = PIN(B, 10, NULL, 0); -const pin_obj_t pin_B11 = PIN(B, 11, NULL, 0); -const pin_obj_t pin_B12 = PIN(B, 12, NULL, 0); -const pin_obj_t pin_B13 = PIN(B, 13, NULL, 0); -const pin_obj_t pin_B14 = PIN(B, 14, NULL, 0); -const pin_obj_t pin_B15 = PIN(B, 15, NULL, 0); - -STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_A0) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_A1) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_A2) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_A3) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_A4) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_A5) }, - { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_A6) }, - { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_A7) }, - { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_A8) }, - { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_A9) }, - { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_A10) }, - { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_A11) }, - { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_A12) }, - { MP_ROM_QSTR(MP_QSTR_A13), MP_ROM_PTR(&pin_A13) }, - { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_PTR(&pin_A14) }, - { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_A15) }, - { MP_ROM_QSTR(MP_QSTR_A16), MP_ROM_PTR(&pin_A16) }, - { MP_ROM_QSTR(MP_QSTR_A17), MP_ROM_PTR(&pin_A17) }, - { MP_ROM_QSTR(MP_QSTR_A18), MP_ROM_PTR(&pin_A18) }, - { MP_ROM_QSTR(MP_QSTR_A19), MP_ROM_PTR(&pin_A19) }, - { MP_ROM_QSTR(MP_QSTR_A20), MP_ROM_PTR(&pin_A20) }, - { MP_ROM_QSTR(MP_QSTR_A21), MP_ROM_PTR(&pin_A21) }, - { MP_ROM_QSTR(MP_QSTR_A22), MP_ROM_PTR(&pin_A22) }, - { MP_ROM_QSTR(MP_QSTR_A23), MP_ROM_PTR(&pin_A23) }, - { MP_ROM_QSTR(MP_QSTR_A24), MP_ROM_PTR(&pin_A24) }, - { MP_ROM_QSTR(MP_QSTR_A25), MP_ROM_PTR(&pin_A25) }, - { MP_ROM_QSTR(MP_QSTR_A26), MP_ROM_PTR(&pin_A26) }, - { MP_ROM_QSTR(MP_QSTR_A27), MP_ROM_PTR(&pin_A27) }, - { MP_ROM_QSTR(MP_QSTR_A28), MP_ROM_PTR(&pin_A28) }, - { MP_ROM_QSTR(MP_QSTR_A29), MP_ROM_PTR(&pin_A29) }, - { MP_ROM_QSTR(MP_QSTR_A30), MP_ROM_PTR(&pin_A30) }, - { MP_ROM_QSTR(MP_QSTR_A31), MP_ROM_PTR(&pin_A31) }, - { MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_PTR(&pin_B0) }, - { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_B1) }, - { MP_ROM_QSTR(MP_QSTR_B2), MP_ROM_PTR(&pin_B2) }, - { MP_ROM_QSTR(MP_QSTR_B3), MP_ROM_PTR(&pin_B3) }, - { MP_ROM_QSTR(MP_QSTR_B4), MP_ROM_PTR(&pin_B4) }, - { MP_ROM_QSTR(MP_QSTR_B5), MP_ROM_PTR(&pin_B5) }, - { MP_ROM_QSTR(MP_QSTR_B6), MP_ROM_PTR(&pin_B6) }, - { MP_ROM_QSTR(MP_QSTR_B7), MP_ROM_PTR(&pin_B7) }, - { MP_ROM_QSTR(MP_QSTR_B8), MP_ROM_PTR(&pin_B8) }, - { MP_ROM_QSTR(MP_QSTR_B9), MP_ROM_PTR(&pin_B9) }, - { MP_ROM_QSTR(MP_QSTR_B10), MP_ROM_PTR(&pin_B10) }, - { MP_ROM_QSTR(MP_QSTR_B11), MP_ROM_PTR(&pin_B11) }, - { MP_ROM_QSTR(MP_QSTR_B12), MP_ROM_PTR(&pin_B12) }, - { MP_ROM_QSTR(MP_QSTR_B13), MP_ROM_PTR(&pin_B13) }, - { MP_ROM_QSTR(MP_QSTR_B14), MP_ROM_PTR(&pin_B14) }, - { MP_ROM_QSTR(MP_QSTR_B15), MP_ROM_PTR(&pin_B15) }, -}; -MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table); - -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR_PA0), MP_ROM_PTR(&pin_A0) }, - { MP_ROM_QSTR(MP_QSTR_PA1), MP_ROM_PTR(&pin_A1) }, - { MP_ROM_QSTR(MP_QSTR_PA2), MP_ROM_PTR(&pin_A2) }, - { MP_ROM_QSTR(MP_QSTR_PA3), MP_ROM_PTR(&pin_A3) }, - { MP_ROM_QSTR(MP_QSTR_PA4), MP_ROM_PTR(&pin_A4) }, - { MP_ROM_QSTR(MP_QSTR_PA5), MP_ROM_PTR(&pin_A5) }, - { MP_ROM_QSTR(MP_QSTR_PA6), MP_ROM_PTR(&pin_A6) }, - { MP_ROM_QSTR(MP_QSTR_PA7), MP_ROM_PTR(&pin_A7) }, - { MP_ROM_QSTR(MP_QSTR_PA8), MP_ROM_PTR(&pin_A8) }, - { MP_ROM_QSTR(MP_QSTR_PA9), MP_ROM_PTR(&pin_A9) }, - { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_A10) }, - { MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_A11) }, - { MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_A12) }, - { MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_A13) }, - { MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_A14) }, - { MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_A15) }, - { MP_ROM_QSTR(MP_QSTR_PA16), MP_ROM_PTR(&pin_A16) }, - { MP_ROM_QSTR(MP_QSTR_PA17), MP_ROM_PTR(&pin_A17) }, - { MP_ROM_QSTR(MP_QSTR_PA18), MP_ROM_PTR(&pin_A18) }, - { MP_ROM_QSTR(MP_QSTR_PA19), MP_ROM_PTR(&pin_A19) }, - { MP_ROM_QSTR(MP_QSTR_PA20), MP_ROM_PTR(&pin_A20) }, - { MP_ROM_QSTR(MP_QSTR_PA21), MP_ROM_PTR(&pin_A21) }, - { MP_ROM_QSTR(MP_QSTR_PA22), MP_ROM_PTR(&pin_A22) }, - { MP_ROM_QSTR(MP_QSTR_PA23), MP_ROM_PTR(&pin_A23) }, - { MP_ROM_QSTR(MP_QSTR_PA24), MP_ROM_PTR(&pin_A24) }, - { MP_ROM_QSTR(MP_QSTR_PA25), MP_ROM_PTR(&pin_A25) }, - { MP_ROM_QSTR(MP_QSTR_PA26), MP_ROM_PTR(&pin_A26) }, - { MP_ROM_QSTR(MP_QSTR_PA27), MP_ROM_PTR(&pin_A27) }, - { MP_ROM_QSTR(MP_QSTR_PA28), MP_ROM_PTR(&pin_A28) }, - { MP_ROM_QSTR(MP_QSTR_PA29), MP_ROM_PTR(&pin_A29) }, - { MP_ROM_QSTR(MP_QSTR_PA30), MP_ROM_PTR(&pin_A30) }, - { MP_ROM_QSTR(MP_QSTR_PA31), MP_ROM_PTR(&pin_A31) }, - { MP_ROM_QSTR(MP_QSTR_PB0), MP_ROM_PTR(&pin_B0) }, - { MP_ROM_QSTR(MP_QSTR_PB1), MP_ROM_PTR(&pin_B1) }, - { MP_ROM_QSTR(MP_QSTR_PB2), MP_ROM_PTR(&pin_B2) }, - { MP_ROM_QSTR(MP_QSTR_PB3), MP_ROM_PTR(&pin_B3) }, - { MP_ROM_QSTR(MP_QSTR_PB4), MP_ROM_PTR(&pin_B4) }, - { MP_ROM_QSTR(MP_QSTR_PB5), MP_ROM_PTR(&pin_B5) }, - { MP_ROM_QSTR(MP_QSTR_PB6), MP_ROM_PTR(&pin_B6) }, - { MP_ROM_QSTR(MP_QSTR_PB7), MP_ROM_PTR(&pin_B7) }, - { MP_ROM_QSTR(MP_QSTR_PB8), MP_ROM_PTR(&pin_B8) }, - { MP_ROM_QSTR(MP_QSTR_PB9), MP_ROM_PTR(&pin_B9) }, - { MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_B10) }, - { MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_B11) }, - { MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_B12) }, - { MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_B13) }, - { MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_B14) }, - { MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_B15) }, -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/nrf/boards/pca10056/pins.csv b/ports/nrf/boards/pca10056/pins.csv index f2f7f19672..a4e4e8d5d1 100644 --- a/ports/nrf/boards/pca10056/pins.csv +++ b/ports/nrf/boards/pca10056/pins.csv @@ -1,48 +1,48 @@ -PA0,PA0 -PA1,PA1 -PA2,PA2,ADC0_IN0 -PA3,PA3,ADC0_IN1 -PA4,PA4,ADC0_IN2 -PA5,PA5,ADC0_IN3 -PA6,PA6 -PA7,PA7 -PA8,PA8 -PA9,PA9 -PA10,PA10 -PA11,PA11 -PA12,PA12 -PA13,PA13 -PA14,PA14 -PA15,PA15 -PA16,PA16 -PA17,PA17 -PA18,PA18 -PA19,PA19 -PA20,PA20 -PA21,PA21 -PA22,PA22 -PA23,PA23 -PA24,PA24 -PA25,PA25 -PA26,PA26 -PA27,PA27 -PA28,PA28,ADC0_IN4 -PA29,PA29,ADC0_IN5 -PA30,PA30,ADC0_IN6 -PA31,PA31,ADC0_IN7 -PB0,PB0 -PB1,PB1 -PB2,PB2 -PB3,PB3 -PB4,PB4 -PB5,PB5 -PB6,PB6 -PB7,PB7 -PB8,PB8 -PB9,PB9 -PB10,PB10 -PB11,PB11 -PB12,PB12 -PB13,PB13 -PB14,PB14 -PB15,PB15 +P0_00,PA0 +P0_01,P0_01 +P0_02,P0_02,ADC0_IN0 +P0_03,P0_03,ADC0_IN1 +P0_04,P0_04,ADC0_IN2 +P0_05,P0_05,ADC0_IN3 +P0_06,P0_06 +P0_07,P0_07 +P0_08,P0_08 +P0_09,P0_09 +P0_10,P0_10 +P0_11,P0_11 +P0_12,P0_12 +P0_13,P0_13 +P0_14,P0_14 +P0_15,P0_15 +P0_16,P0_16 +P0_17,P0_17 +P0_18,P0_18 +P0_19,P0_19 +P0_20,P0_20 +P0_21,P0_21 +P0_22,P0_22 +P0_23,P0_23 +P0_24,P0_24 +P0_25,P0_25 +P0_26,P0_26 +P0_27,P0_27 +P0_28,P0_28,ADC0_IN4 +P0_29,P0_29,ADC0_IN5 +P0_30,P0_30,ADC0_IN6 +P0_31,P0_31,ADC0_IN7 +P1_00,P1_00 +P1_01,P1_01 +P1_02,P1_02 +P1_03,P1_03 +P1_04,P1_04 +P1_05,P1_05 +P1_06,P1_06 +P1_07,P1_07 +P1_08,P1_08 +P1_09,P1_09 +P1_10,P1_10 +P1_11,P1_11 +P1_12,P1_12 +P1_13,P1_13 +P1_14,P1_14 +P1_15,P1_15 diff --git a/ports/nrf/boards/pca10056/pins.h b/ports/nrf/boards/pca10056/pins.h deleted file mode 100644 index 0ea1f0450a..0000000000 --- a/ports/nrf/boards/pca10056/pins.h +++ /dev/null @@ -1,51 +0,0 @@ -extern const pin_obj_t pin_A0; -extern const pin_obj_t pin_A1; -extern const pin_obj_t pin_A2; -extern const pin_obj_t pin_A3; -extern const pin_obj_t pin_A4; -extern const pin_obj_t pin_A5; -extern const pin_obj_t pin_A6; -extern const pin_obj_t pin_A7; -extern const pin_obj_t pin_A8; -extern const pin_obj_t pin_A9; -extern const pin_obj_t pin_A10; -extern const pin_obj_t pin_A11; -extern const pin_obj_t pin_A12; -extern const pin_obj_t pin_A13; -extern const pin_obj_t pin_A14; -extern const pin_obj_t pin_A15; -extern const pin_obj_t pin_A16; -extern const pin_obj_t pin_A17; -extern const pin_obj_t pin_A18; -extern const pin_obj_t pin_A19; -extern const pin_obj_t pin_A20; -extern const pin_obj_t pin_A21; -extern const pin_obj_t pin_A22; -extern const pin_obj_t pin_A23; -extern const pin_obj_t pin_A24; -extern const pin_obj_t pin_A25; -extern const pin_obj_t pin_A26; -extern const pin_obj_t pin_A27; -extern const pin_obj_t pin_A28; -extern const pin_obj_t pin_A29; -extern const pin_obj_t pin_A30; -extern const pin_obj_t pin_A31; -extern const pin_obj_t pin_B0; -extern const pin_obj_t pin_B1; -extern const pin_obj_t pin_B2; -extern const pin_obj_t pin_B3; -extern const pin_obj_t pin_B4; -extern const pin_obj_t pin_B5; -extern const pin_obj_t pin_B6; -extern const pin_obj_t pin_B7; -extern const pin_obj_t pin_B8; -extern const pin_obj_t pin_B9; -extern const pin_obj_t pin_B10; -extern const pin_obj_t pin_B11; -extern const pin_obj_t pin_B12; -extern const pin_obj_t pin_B13; -extern const pin_obj_t pin_B14; -extern const pin_obj_t pin_B15; -extern const pin_obj_t * const pin_adc1[]; -extern const pin_obj_t * const pin_adc2[]; -extern const pin_obj_t * const pin_adc3[]; diff --git a/ports/nrf/modules/machine/pin.h b/ports/nrf/modules/machine/pin.h index 117fb72896..c34726174c 100644 --- a/ports/nrf/modules/machine/pin.h +++ b/ports/nrf/modules/machine/pin.h @@ -43,8 +43,6 @@ typedef struct { union { void *reg; - - PIN_DEFS_PORT_AF_UNION }; } pin_af_obj_t; diff --git a/ports/nrf/nrf52_af.csv b/ports/nrf/nrf52_af.csv index 44a7d8144f..284370d060 100644 --- a/ports/nrf/nrf52_af.csv +++ b/ports/nrf/nrf52_af.csv @@ -1,48 +1,48 @@ -PA0,PA0 -PA1,PA1 -PA2,PA2 -PA3,PA3 -PA4,PA4 -PA5,PA5 -PA6,PA6 -PA7,PA7 -PA8,PA8 -PA9,PA9 -PA10,PA10 -PA11,PA11 -PA12,PA12 -PA13,PA13 -PA14,PA14 -PA15,PA15 -PA16,PA16 -PA17,PA17 -PA18,PA18 -PA19,PA19 -PA20,PA20 -PA21,PA21 -PA22,PA22 -PA23,PA23 -PA24,PA24 -PA25,PA25 -PA26,PA26 -PA27,PA27 -PA28,PA28 -PA29,PA29 -PA30,PA30 -PA31,PA31 -PB0,PB0 -PB1,PB1 -PB2,PB2 -PB3,PB3 -PB4,PB4 -PB5,PB5 -PB6,PB6 -PB7,PB7 -PB8,PB8 -PB9,PB9 -PB10,PB10 -PB11,PB11 -PB12,PB12 -PB13,PB13 -PB14,PB14 -PB15,PB15 \ No newline at end of file +P0_00,P0_00 +P0_01,P0_01 +P0_02,P0_02 +P0_03,P0_03 +P0_04,P0_04 +P0_05,P0_05 +P0_06,P0_06 +P0_07,P0_07 +P0_08,P0_08 +P0_09,P0_09 +P0_10,P0_10 +P0_11,P0_11 +P0_12,P0_12 +P0_13,P0_13 +P0_14,P0_14 +P0_15,P0_15 +P0_16,P0_16 +P0_17,P0_17 +P0_18,P0_18 +P0_19,P0_19 +P0_20,P0_20 +P0_21,P0_21 +P0_22,P0_22 +P0_23,P0_23 +P0_24,P0_24 +P0_25,P0_25 +P0_26,P0_26 +P0_27,P0_27 +P0_28,P0_28 +P0_29,P0_29 +P0_30,P0_30 +P0_31,P0_31 +P1_00,P1_00 +P1_01,P1_01 +P1_02,P1_02 +P1_03,P1_03 +P1_04,P1_04 +P1_05,P1_05 +P1_06,P1_06 +P1_07,P1_07 +P1_08,P1_08 +P1_09,P1_09 +P1_10,P1_10 +P1_11,P1_11 +P1_12,P1_12 +P1_13,P1_13 +P1_14,P1_14 +P1_15,P1_15 diff --git a/ports/nrf/pin_defs_nrf5.h b/ports/nrf/pin_defs_nrf5.h index 94f8f3c9c1..2c12045c10 100644 --- a/ports/nrf/pin_defs_nrf5.h +++ b/ports/nrf/pin_defs_nrf5.h @@ -29,31 +29,8 @@ // This file should only ever be #included by pin.h and not directly. enum { - PORT_A, - PORT_B, + PORT_0, + PORT_1, }; -enum { - AF_FN_UART, - AF_FN_SPI, -}; - -enum { - AF_PIN_TYPE_UART_TX = 0, - AF_PIN_TYPE_UART_RX, - AF_PIN_TYPE_UART_CTS, - AF_PIN_TYPE_UART_RTS, - - AF_PIN_TYPE_SPI_MOSI = 0, - AF_PIN_TYPE_SPI_MISO, - AF_PIN_TYPE_SPI_SCK, - AF_PIN_TYPE_SPI_NSS, -}; - -#define PIN_DEFS_PORT_AF_UNION \ - NRF_UART_Type *UART; -// NRF_SPI_Type *SPIM; -// NRF_SPIS_Type *SPIS; - - typedef NRF_GPIO_Type pin_gpio_t;