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.
This commit is contained in:
arturo182 2018-02-12 22:33:01 +01:00
parent 0388a57f77
commit 9962ea6449
18 changed files with 203 additions and 977 deletions

View File

@ -31,7 +31,7 @@ endif
# qstr definitions (must come before including py.mk) # qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h
FROZEN_MPY_DIR = freeze FROZEN_MPY_DIR = freeze
@ -49,6 +49,7 @@ MCU_VARIANT_UPPER = $(shell echo $(MCU_VARIANT) | tr '[:lower:]' '[:upper:]')
INC += -I. INC += -I.
INC += -I../.. INC += -I../..
INC += -I$(BUILD) INC += -I$(BUILD)
INC += -I$(BUILD)/genhdr
INC += -I./../../lib/cmsis/inc INC += -I./../../lib/cmsis/inc
INC += -I./device INC += -I./device
INC += -I./device/$(MCU_VARIANT) INC += -I./device/$(MCU_VARIANT)
@ -142,7 +143,6 @@ SRC_C += \
drivers/bluetooth/ble_drv.c \ drivers/bluetooth/ble_drv.c \
drivers/bluetooth/ble_uart.c \ drivers/bluetooth/ble_uart.c \
boards/$(BOARD)/board.c \ boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \
device/$(MCU_VARIANT)/system_$(MCU_SUB_VARIANT).c \ device/$(MCU_VARIANT)/system_$(MCU_SUB_VARIANT).c \
device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \ device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \
lib/oofatfs/ff.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)) FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) 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)/, $(SRC_HAL:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.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 # 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 # case when pins.h is modified. But when it doesn't exist, we don't know
# which source files might need it. # 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 # Use a pattern rule here so that make will only call make-pins.py once to make
# both pins_$(BOARD).c and pins.h # 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) $(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 $@" $(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) $(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 $(BUILD)/pins_gen.o: $(BUILD)/pins_gen.c
# $(call compile_c) $(call compile_c)
MAKE_PINS = boards/make-pins.py MAKE_PINS = boards/make-pins.py
BOARD_PINS = boards/$(BOARD)/pins.csv BOARD_PINS = boards/$(BOARD)/pins.csv

View File

@ -57,15 +57,15 @@
#define MICROPY_HW_LED2 (19) // LED2 #define MICROPY_HW_LED2 (19) // LED2
// UART config // UART config
#define MICROPY_HW_UART1_RX (pin_PA08) #define MICROPY_HW_UART1_RX (pin_P0_08)
#define MICROPY_HW_UART1_TX (pin_PA06) #define MICROPY_HW_UART1_TX (pin_P0_06)
#define MICROPY_HW_UART1_HWFC (0) #define MICROPY_HW_UART1_HWFC (0)
// SPI0 config // SPI0 config
#define MICROPY_HW_SPI0_NAME "SPI0" #define MICROPY_HW_SPI0_NAME "SPI0"
#define MICROPY_HW_SPI0_SCK (pin_PA12) // (Arduino D13) #define MICROPY_HW_SPI0_SCK (pin_P0_12) // (Arduino D13)
#define MICROPY_HW_SPI0_MOSI (pin_PA13) // (Arduino D11) #define MICROPY_HW_SPI0_MOSI (pin_P0_13) // (Arduino D11)
#define MICROPY_HW_SPI0_MISO (pin_PA14) // (Arduino D12) #define MICROPY_HW_SPI0_MISO (pin_P0_14) // (Arduino D12)
#define MICROPY_HW_PWM0_NAME "PWM0" #define MICROPY_HW_PWM0_NAME "PWM0"
#define MICROPY_HW_PWM1_NAME "PWM1" #define MICROPY_HW_PWM1_NAME "PWM1"

View File

@ -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 <stdio.h>
#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);

View File

@ -1,25 +1,24 @@
A0,PA2,ADC0_IN0 A0,P0_02,ADC0_IN0
A1,PA3,ADC0_IN1 A1,P0_03,ADC0_IN1
A2,PA4,ADC0_IN2 A2,P0_04,ADC0_IN2
A3,PA5,ADC0_IN3 A3,P0_05,ADC0_IN3
TX,PA6 TX,P0_06
PA7,PA7 RX,P0_08
RX,PA8 NFC1,P0_09
NFC1,PA9 NFC2,P0_10
NFC2,PA10 D11,P0_11
D11,PA11 SCK,P0_12
SCK,PA12 MOSI,P0_13
MOSI,PA13 MISO,P0_14
MISO,PA14 D15,P0_15
D15,PA15 D16,P0_16
D16,PA16 LED1,P0_17
LED1,PA17 LED2,P0_19
LED2,PA19 DFU,P0_20
DFU,PA20 SDA,P0_25
SDA,PA25 SCL,P0_26
SCL,PA26 D27,P0_27
D27,PA27 A4,P0_28,ADC0_IN4
A4,PA28,ADC0_IN4 A5,P0_29,ADC0_IN5
A5,PA29,ADC0_IN5 A6,P0_30,ADC0_IN6
A6,PA30,ADC0_IN6 A7,P0_31,ADC0_IN7
A7,PA31,ADC0_IN7

1 A0,PA2,ADC0_IN0 A0,P0_02,ADC0_IN0
2 A1,PA3,ADC0_IN1 A1,P0_03,ADC0_IN1
3 A2,PA4,ADC0_IN2 A2,P0_04,ADC0_IN2
4 A3,PA5,ADC0_IN3 A3,P0_05,ADC0_IN3
5 TX,PA6 TX,P0_06
6 PA7,PA7 RX,P0_08
7 RX,PA8 NFC1,P0_09
8 NFC1,PA9 NFC2,P0_10
9 NFC2,PA10 D11,P0_11
10 D11,PA11 SCK,P0_12
11 SCK,PA12 MOSI,P0_13
12 MOSI,PA13 MISO,P0_14
13 MISO,PA14 D15,P0_15
14 D15,PA15 D16,P0_16
15 D16,PA16 LED1,P0_17
16 LED1,PA17 LED2,P0_19
17 LED2,PA19 DFU,P0_20
18 DFU,PA20 SDA,P0_25
19 SDA,PA25 SCL,P0_26
20 SCL,PA26 D27,P0_27
21 D27,PA27 A4,P0_28,ADC0_IN4
22 A4,PA28,ADC0_IN4 A5,P0_29,ADC0_IN5
23 A5,PA29,ADC0_IN5 A6,P0_30,ADC0_IN6
24 A6,PA30,ADC0_IN6 A7,P0_31,ADC0_IN7
A7,PA31,ADC0_IN7

View File

@ -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[];

View File

@ -7,24 +7,22 @@ import argparse
import sys import sys
import csv import csv
SUPPORTED_FN = {
'UART' : ['RX', 'TX', 'CTS', 'RTS']
}
def parse_port_pin(name_str): def parse_port_pin(name_str):
"""Parses a string and returns a (port-num, pin-num) tuple.""" """Parses a string and returns a (port-num, pin-num) tuple."""
if len(name_str) < 3: if len(name_str) < 4:
raise ValueError("Expecting pin name to be at least 4 charcters.") raise ValueError("Expecting pin name to be at least 5 charcters.")
if name_str[0] != 'P': if name_str[0] != 'P':
raise ValueError("Expecting pin name to start with P") raise ValueError("Expecting pin name to start with P")
if name_str[1] not in ('A', 'B'): if name_str[1] not in ('0', '1'):
raise ValueError("Expecting pin port to be in A or B") raise ValueError("Expecting pin port to be in 0 or 1")
port = ord(name_str[1]) - ord('A') port = ord(name_str[1]) - ord('0')
pin_str = name_str[2:].split('/')[0] pin_str = name_str[3:]
if not pin_str.isdigit(): if not pin_str.isdigit():
raise ValueError("Expecting numeric pin number.") raise ValueError("Expecting numeric pin number.")
return (port, int(pin_str)) return (port, int(pin_str))
def split_name_num(name_num): def split_name_num(name_num):
num = None num = None
for num_idx in range(len(name_num) - 1, -1, -1): for num_idx in range(len(name_num) - 1, -1, -1):
@ -37,72 +35,17 @@ def split_name_num(name_num):
return 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): class Pin(object):
"""Holds the information associated with a pin.""" """Holds the information associated with a pin."""
def __init__(self, port, pin): def __init__(self, port, pin):
self.port = port self.port = port
self.pin = pin self.pin = pin
self.alt_fn = [] self.adc_channel = '0'
self.alt_fn_count = 0
self.adc_num = 0
self.adc_channel = 0
self.board_pin = False self.board_pin = False
def port_letter(self):
return chr(self.port + ord('A'))
def cpu_pin_name(self): 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): def is_board_pin(self):
return self.board_pin return self.board_pin
@ -113,69 +56,17 @@ class Pin(object):
def parse_adc(self, adc_str): def parse_adc(self, adc_str):
if (adc_str[:3] != 'ADC'): if (adc_str[:3] != 'ADC'):
return return
(adc,channel) = adc_str.split('_') (adc, channel) = adc_str.split('_IN')
for idx in range(3, len(adc)): self.adc_channel = 'SAADC_CH_PSELP_PSELP_AnalogInput%d' % int(channel)
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
def print(self): def print(self):
if self.alt_fn_count == 0: print('const pin_obj_t pin_{:s} = PIN({:s}, {:d}, {:d}, {:s});'.format(
print("// ", end='') self.cpu_pin_name(), self.cpu_pin_name(),
print('const pin_af_obj_t {:s}[] = {{'.format(self.alt_fn_name())) self.port, self.pin, self.adc_channel))
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('')
def print_header(self, hdr_file): def print_header(self, hdr_file):
hdr_file.write('extern const pin_obj_t pin_{:s};\n'. hdr_file.write('extern const pin_obj_t pin_{:s};\n'.
format(self.cpu_pin_name())) 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): class NamedPin(object):
@ -230,16 +121,19 @@ class Pins(object):
pin = self.find_pin(port_num, pin_num) pin = self.find_pin(port_num, pin_num)
if pin: if pin:
pin.set_is_board_pin() pin.set_is_board_pin()
if len(row) == 3:
pin.parse_adc(row[2])
self.board_pins.append(NamedPin(row[0], pin)) self.board_pins.append(NamedPin(row[0], pin))
def print_named(self, label, named_pins): def print_named(self, label, named_pins):
print('')
print('STATIC const mp_rom_map_elem_t {:s}_table[] = {{'.format(label)) print('STATIC const mp_rom_map_elem_t {:s}_table[] = {{'.format(label))
for named_pin in named_pins: for named_pin in named_pins:
pin = named_pin.pin() pin = named_pin.pin()
if pin.is_board_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(' {{ MP_ROM_QSTR(MP_QSTR_{:s}), MP_ROM_PTR(&pin_{:s}) }},'.format(named_pin.name(), pin.cpu_pin_name()))
print('};') 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): def print(self):
for named_pin in self.cpu_pins: for named_pin in self.cpu_pins:
@ -247,35 +141,14 @@ class Pins(object):
if pin.is_board_pin(): if pin.is_board_pin():
pin.print() pin.print()
self.print_named('mcu_pin_globals', self.cpu_pins) self.print_named('mcu_pin_globals', self.cpu_pins)
print('')
self.print_named('board_module_globals', self.board_pins) 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): def print_header(self, hdr_filename):
with open(hdr_filename, 'wt') as hdr_file: with open(hdr_filename, 'wt') as hdr_file:
for named_pin in self.cpu_pins: for named_pin in self.cpu_pins:
pin = named_pin.pin() pin = named_pin.pin()
if pin.is_board_pin(): if pin.is_board_pin():
pin.print_header(hdr_file) 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): def print_qstr(self, qstr_filename):
with open(qstr_filename, 'wt') as qstr_file: with open(qstr_filename, 'wt') as qstr_file:
@ -283,7 +156,6 @@ class Pins(object):
for named_pin in self.cpu_pins: for named_pin in self.cpu_pins:
pin = named_pin.pin() pin = named_pin.pin()
if pin.is_board_pin(): if pin.is_board_pin():
qstr_set |= set(pin.qstr_list())
qstr_set |= set([named_pin.name()]) qstr_set |= set([named_pin.name()])
for named_pin in self.board_pins: for named_pin in self.board_pins:
qstr_set |= set([named_pin.name()]) qstr_set |= set([named_pin.name()])
@ -291,37 +163,6 @@ class Pins(object):
print('Q({})'.format(qstr), file=qstr_file) 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(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog="make-pins.py", prog="make-pins.py",
@ -391,8 +232,6 @@ def main():
pins.print() pins.print()
pins.print_header(args.hdr_filename) pins.print_header(args.hdr_filename)
pins.print_qstr(args.qstr_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__": if __name__ == "__main__":

View File

@ -6,26 +6,11 @@
#include "py/mphal.h" #include "py/mphal.h"
#include "pin.h" #include "pin.h"
#define AF(af_idx, af_fn, af_unit, af_type, af_ptr) \ #define PIN(p_name, p_port, p_pin, p_adc_channel) \
{ \
{ &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) \
{ \ { \
{ &mcu_pin_type }, \ { &mcu_pin_type }, \
.name = MP_QSTR_ ## p_port ## p_pin, \ .name = MP_QSTR_ ## p_name, \
.port = PORT_ ## p_port, \ .port = PORT_ ## p_port, \
.pin = (p_pin), \ .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, \ .adc_channel = p_adc_channel, \
} }

View File

@ -61,17 +61,17 @@
#define MICROPY_HW_LED4 (20) // LED4 #define MICROPY_HW_LED4 (20) // LED4
// UART config // UART config
#define MICROPY_HW_UART1_RX (pin_A8) #define MICROPY_HW_UART1_RX (pin_P0_08)
#define MICROPY_HW_UART1_TX (pin_A6) #define MICROPY_HW_UART1_TX (pin_P0_06)
#define MICROPY_HW_UART1_CTS (pin_A7) #define MICROPY_HW_UART1_CTS (pin_P0_07)
#define MICROPY_HW_UART1_RTS (pin_A5) #define MICROPY_HW_UART1_RTS (pin_P0_05)
#define MICROPY_HW_UART1_HWFC (1) #define MICROPY_HW_UART1_HWFC (1)
// SPI0 config // SPI0 config
#define MICROPY_HW_SPI0_NAME "SPI0" #define MICROPY_HW_SPI0_NAME "SPI0"
#define MICROPY_HW_SPI0_SCK (pin_A25) // (Arduino D13) #define MICROPY_HW_SPI0_SCK (pin_P0_25) // (Arduino D13)
#define MICROPY_HW_SPI0_MOSI (pin_A23) // (Arduino D11) #define MICROPY_HW_SPI0_MOSI (pin_P0_23) // (Arduino D11)
#define MICROPY_HW_SPI0_MISO (pin_A24) // (Arduino D12) #define MICROPY_HW_SPI0_MISO (pin_P0_24) // (Arduino D12)
#define MICROPY_HW_PWM0_NAME "PWM0" #define MICROPY_HW_PWM0_NAME "PWM0"
#define MICROPY_HW_PWM1_NAME "PWM1" #define MICROPY_HW_PWM1_NAME "PWM1"

View File

@ -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 <stdio.h>
#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);

View File

@ -1,30 +1,31 @@
PA2,PA2 P0_01,P0_01
PA3,PA3 P0_02,P0_02
PA4,PA4 P0_03,P0_03
PA5,PA5 P0_04,P0_04
PA6,PA6 P0_05,P0_05
PA7,PA7 P0_06,P0_06
PA8,PA8 P0_07,P0_07
PA9,PA9 P0_08,P0_08
PA10,PA10 P0_09,P0_09
PA11,PA11 P0_10,P0_10
PA12,PA12 P0_11,P0_11
PA13,PA13 P0_12,P0_12
PA14,PA14 P0_13,P0_13
PA15,PA15 P0_14,P0_14
PA16,PA16 P0_15,P0_15
PA17,PA17 P0_16,P0_16
PA18,PA18 P0_17,P0_17
PA19,PA19 P0_18,P0_18
PA20,PA20 P0_19,P0_19
PA21,PA21 P0_20,P0_20
PA22,PA22 P0_21,P0_21
PA23,PA23 P0_22,P0_22
PA24,PA24 P0_23,P0_23
PA25,PA25 P0_24,P0_24
PA26,PA26 P0_25,P0_25
PA27,PA27 P0_26,P0_26
PA28,PA28 P0_27,P0_27
PA29,PA29 P0_28,P0_28
PA30,PA30 P0_29,P0_29
PA31,PA31 P0_30,P0_30
P0_31,P0_31

1 PA2 P0_01 PA2 P0_01
2 PA3 P0_02 PA3 P0_02
3 PA4 P0_03 PA4 P0_03
4 PA5 P0_04 PA5 P0_04
5 PA6 P0_05 PA6 P0_05
6 PA7 P0_06 PA7 P0_06
7 PA8 P0_07 PA8 P0_07
8 PA9 P0_08 PA9 P0_08
9 PA10 P0_09 PA10 P0_09
10 PA11 P0_10 PA11 P0_10
11 PA12 P0_11 PA12 P0_11
12 PA13 P0_12 PA13 P0_12
13 PA14 P0_13 PA14 P0_13
14 PA15 P0_14 PA15 P0_14
15 PA16 P0_15 PA16 P0_15
16 PA17 P0_16 PA17 P0_16
17 PA18 P0_17 PA18 P0_17
18 PA19 P0_18 PA19 P0_18
19 PA20 P0_19 PA20 P0_19
20 PA21 P0_20 PA21 P0_20
21 PA22 P0_21 PA22 P0_21
22 PA23 P0_22 PA23 P0_22
23 PA24 P0_23 PA24 P0_23
24 PA25 P0_24 PA25 P0_24
25 PA26 P0_25 PA26 P0_25
26 PA27 P0_26 PA27 P0_26
27 PA28 P0_27 PA28 P0_27
28 PA29 P0_28 PA29 P0_28
29 PA30 P0_29 PA30 P0_29
30 PA31 P0_30 PA31 P0_30
31 P0_31 P0_31

View File

@ -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[];

View File

@ -61,18 +61,18 @@
#define MICROPY_HW_LED4 (16) // LED4 #define MICROPY_HW_LED4 (16) // LED4
// UART config // UART config
#define MICROPY_HW_UART1_RX (pin_A8) #define MICROPY_HW_UART1_RX (pin_P0_08)
#define MICROPY_HW_UART1_TX (pin_A6) #define MICROPY_HW_UART1_TX (pin_P0_06)
#define MICROPY_HW_UART1_CTS (pin_A7) #define MICROPY_HW_UART1_CTS (pin_P0_07)
#define MICROPY_HW_UART1_RTS (pin_A5) #define MICROPY_HW_UART1_RTS (pin_P0_05)
#define MICROPY_HW_UART1_HWFC (1) #define MICROPY_HW_UART1_HWFC (1)
// SPI0 config // SPI0 config
#define MICROPY_HW_SPI0_NAME "SPI0" #define MICROPY_HW_SPI0_NAME "SPI0"
#define MICROPY_HW_SPI0_SCK (pin_B15) #define MICROPY_HW_SPI0_SCK (pin_P1_15)
#define MICROPY_HW_SPI0_MOSI (pin_B13) #define MICROPY_HW_SPI0_MOSI (pin_P1_13)
#define MICROPY_HW_SPI0_MISO (pin_B14) #define MICROPY_HW_SPI0_MISO (pin_P1_14)
#define MICROPY_HW_PWM0_NAME "PWM0" #define MICROPY_HW_PWM0_NAME "PWM0"
#define MICROPY_HW_PWM1_NAME "PWM1" #define MICROPY_HW_PWM1_NAME "PWM1"

View File

@ -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 <stdio.h>
#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);

View File

@ -1,48 +1,48 @@
PA0,PA0 P0_00,PA0
PA1,PA1 P0_01,P0_01
PA2,PA2,ADC0_IN0 P0_02,P0_02,ADC0_IN0
PA3,PA3,ADC0_IN1 P0_03,P0_03,ADC0_IN1
PA4,PA4,ADC0_IN2 P0_04,P0_04,ADC0_IN2
PA5,PA5,ADC0_IN3 P0_05,P0_05,ADC0_IN3
PA6,PA6 P0_06,P0_06
PA7,PA7 P0_07,P0_07
PA8,PA8 P0_08,P0_08
PA9,PA9 P0_09,P0_09
PA10,PA10 P0_10,P0_10
PA11,PA11 P0_11,P0_11
PA12,PA12 P0_12,P0_12
PA13,PA13 P0_13,P0_13
PA14,PA14 P0_14,P0_14
PA15,PA15 P0_15,P0_15
PA16,PA16 P0_16,P0_16
PA17,PA17 P0_17,P0_17
PA18,PA18 P0_18,P0_18
PA19,PA19 P0_19,P0_19
PA20,PA20 P0_20,P0_20
PA21,PA21 P0_21,P0_21
PA22,PA22 P0_22,P0_22
PA23,PA23 P0_23,P0_23
PA24,PA24 P0_24,P0_24
PA25,PA25 P0_25,P0_25
PA26,PA26 P0_26,P0_26
PA27,PA27 P0_27,P0_27
PA28,PA28,ADC0_IN4 P0_28,P0_28,ADC0_IN4
PA29,PA29,ADC0_IN5 P0_29,P0_29,ADC0_IN5
PA30,PA30,ADC0_IN6 P0_30,P0_30,ADC0_IN6
PA31,PA31,ADC0_IN7 P0_31,P0_31,ADC0_IN7
PB0,PB0 P1_00,P1_00
PB1,PB1 P1_01,P1_01
PB2,PB2 P1_02,P1_02
PB3,PB3 P1_03,P1_03
PB4,PB4 P1_04,P1_04
PB5,PB5 P1_05,P1_05
PB6,PB6 P1_06,P1_06
PB7,PB7 P1_07,P1_07
PB8,PB8 P1_08,P1_08
PB9,PB9 P1_09,P1_09
PB10,PB10 P1_10,P1_10
PB11,PB11 P1_11,P1_11
PB12,PB12 P1_12,P1_12
PB13,PB13 P1_13,P1_13
PB14,PB14 P1_14,P1_14
PB15,PB15 P1_15,P1_15

1 PA0,PA0 P0_00,PA0
2 PA1,PA1 P0_01,P0_01
3 PA2,PA2,ADC0_IN0 P0_02,P0_02,ADC0_IN0
4 PA3,PA3,ADC0_IN1 P0_03,P0_03,ADC0_IN1
5 PA4,PA4,ADC0_IN2 P0_04,P0_04,ADC0_IN2
6 PA5,PA5,ADC0_IN3 P0_05,P0_05,ADC0_IN3
7 PA6,PA6 P0_06,P0_06
8 PA7,PA7 P0_07,P0_07
9 PA8,PA8 P0_08,P0_08
10 PA9,PA9 P0_09,P0_09
11 PA10,PA10 P0_10,P0_10
12 PA11,PA11 P0_11,P0_11
13 PA12,PA12 P0_12,P0_12
14 PA13,PA13 P0_13,P0_13
15 PA14,PA14 P0_14,P0_14
16 PA15,PA15 P0_15,P0_15
17 PA16,PA16 P0_16,P0_16
18 PA17,PA17 P0_17,P0_17
19 PA18,PA18 P0_18,P0_18
20 PA19,PA19 P0_19,P0_19
21 PA20,PA20 P0_20,P0_20
22 PA21,PA21 P0_21,P0_21
23 PA22,PA22 P0_22,P0_22
24 PA23,PA23 P0_23,P0_23
25 PA24,PA24 P0_24,P0_24
26 PA25,PA25 P0_25,P0_25
27 PA26,PA26 P0_26,P0_26
28 PA27,PA27 P0_27,P0_27
29 PA28,PA28,ADC0_IN4 P0_28,P0_28,ADC0_IN4
30 PA29,PA29,ADC0_IN5 P0_29,P0_29,ADC0_IN5
31 PA30,PA30,ADC0_IN6 P0_30,P0_30,ADC0_IN6
32 PA31,PA31,ADC0_IN7 P0_31,P0_31,ADC0_IN7
33 PB0,PB0 P1_00,P1_00
34 PB1,PB1 P1_01,P1_01
35 PB2,PB2 P1_02,P1_02
36 PB3,PB3 P1_03,P1_03
37 PB4,PB4 P1_04,P1_04
38 PB5,PB5 P1_05,P1_05
39 PB6,PB6 P1_06,P1_06
40 PB7,PB7 P1_07,P1_07
41 PB8,PB8 P1_08,P1_08
42 PB9,PB9 P1_09,P1_09
43 PB10,PB10 P1_10,P1_10
44 PB11,PB11 P1_11,P1_11
45 PB12,PB12 P1_12,P1_12
46 PB13,PB13 P1_13,P1_13
47 PB14,PB14 P1_14,P1_14
48 PB15,PB15 P1_15,P1_15

View File

@ -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[];

View File

@ -43,8 +43,6 @@ typedef struct {
union { union {
void *reg; void *reg;
PIN_DEFS_PORT_AF_UNION
}; };
} pin_af_obj_t; } pin_af_obj_t;

View File

@ -1,48 +1,48 @@
PA0,PA0 P0_00,P0_00
PA1,PA1 P0_01,P0_01
PA2,PA2 P0_02,P0_02
PA3,PA3 P0_03,P0_03
PA4,PA4 P0_04,P0_04
PA5,PA5 P0_05,P0_05
PA6,PA6 P0_06,P0_06
PA7,PA7 P0_07,P0_07
PA8,PA8 P0_08,P0_08
PA9,PA9 P0_09,P0_09
PA10,PA10 P0_10,P0_10
PA11,PA11 P0_11,P0_11
PA12,PA12 P0_12,P0_12
PA13,PA13 P0_13,P0_13
PA14,PA14 P0_14,P0_14
PA15,PA15 P0_15,P0_15
PA16,PA16 P0_16,P0_16
PA17,PA17 P0_17,P0_17
PA18,PA18 P0_18,P0_18
PA19,PA19 P0_19,P0_19
PA20,PA20 P0_20,P0_20
PA21,PA21 P0_21,P0_21
PA22,PA22 P0_22,P0_22
PA23,PA23 P0_23,P0_23
PA24,PA24 P0_24,P0_24
PA25,PA25 P0_25,P0_25
PA26,PA26 P0_26,P0_26
PA27,PA27 P0_27,P0_27
PA28,PA28 P0_28,P0_28
PA29,PA29 P0_29,P0_29
PA30,PA30 P0_30,P0_30
PA31,PA31 P0_31,P0_31
PB0,PB0 P1_00,P1_00
PB1,PB1 P1_01,P1_01
PB2,PB2 P1_02,P1_02
PB3,PB3 P1_03,P1_03
PB4,PB4 P1_04,P1_04
PB5,PB5 P1_05,P1_05
PB6,PB6 P1_06,P1_06
PB7,PB7 P1_07,P1_07
PB8,PB8 P1_08,P1_08
PB9,PB9 P1_09,P1_09
PB10,PB10 P1_10,P1_10
PB11,PB11 P1_11,P1_11
PB12,PB12 P1_12,P1_12
PB13,PB13 P1_13,P1_13
PB14,PB14 P1_14,P1_14
PB15,PB15 P1_15,P1_15

1 PA0 P0_00 PA0 P0_00
2 PA1 P0_01 PA1 P0_01
3 PA2 P0_02 PA2 P0_02
4 PA3 P0_03 PA3 P0_03
5 PA4 P0_04 PA4 P0_04
6 PA5 P0_05 PA5 P0_05
7 PA6 P0_06 PA6 P0_06
8 PA7 P0_07 PA7 P0_07
9 PA8 P0_08 PA8 P0_08
10 PA9 P0_09 PA9 P0_09
11 PA10 P0_10 PA10 P0_10
12 PA11 P0_11 PA11 P0_11
13 PA12 P0_12 PA12 P0_12
14 PA13 P0_13 PA13 P0_13
15 PA14 P0_14 PA14 P0_14
16 PA15 P0_15 PA15 P0_15
17 PA16 P0_16 PA16 P0_16
18 PA17 P0_17 PA17 P0_17
19 PA18 P0_18 PA18 P0_18
20 PA19 P0_19 PA19 P0_19
21 PA20 P0_20 PA20 P0_20
22 PA21 P0_21 PA21 P0_21
23 PA22 P0_22 PA22 P0_22
24 PA23 P0_23 PA23 P0_23
25 PA24 P0_24 PA24 P0_24
26 PA25 P0_25 PA25 P0_25
27 PA26 P0_26 PA26 P0_26
28 PA27 P0_27 PA27 P0_27
29 PA28 P0_28 PA28 P0_28
30 PA29 P0_29 PA29 P0_29
31 PA30 P0_30 PA30 P0_30
32 PA31 P0_31 PA31 P0_31
33 PB0 P1_00 PB0 P1_00
34 PB1 P1_01 PB1 P1_01
35 PB2 P1_02 PB2 P1_02
36 PB3 P1_03 PB3 P1_03
37 PB4 P1_04 PB4 P1_04
38 PB5 P1_05 PB5 P1_05
39 PB6 P1_06 PB6 P1_06
40 PB7 P1_07 PB7 P1_07
41 PB8 P1_08 PB8 P1_08
42 PB9 P1_09 PB9 P1_09
43 PB10 P1_10 PB10 P1_10
44 PB11 P1_11 PB11 P1_11
45 PB12 P1_12 PB12 P1_12
46 PB13 P1_13 PB13 P1_13
47 PB14 P1_14 PB14 P1_14
48 PB15 P1_15 PB15 P1_15

View File

@ -29,31 +29,8 @@
// This file should only ever be #included by pin.h and not directly. // This file should only ever be #included by pin.h and not directly.
enum { enum {
PORT_A, PORT_0,
PORT_B, 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; typedef NRF_GPIO_Type pin_gpio_t;