Skip to content

Commit 9962ea6

Browse files
committed
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.
1 parent 0388a57 commit 9962ea6

18 files changed

Lines changed: 203 additions & 977 deletions

File tree

ports/nrf/Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ endif
3131

3232

3333
# qstr definitions (must come before including py.mk)
34-
QSTR_DEFS = qstrdefsport.h
34+
QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h
3535

3636
FROZEN_MPY_DIR = freeze
3737

@@ -49,6 +49,7 @@ MCU_VARIANT_UPPER = $(shell echo $(MCU_VARIANT) | tr '[:lower:]' '[:upper:]')
4949
INC += -I.
5050
INC += -I../..
5151
INC += -I$(BUILD)
52+
INC += -I$(BUILD)/genhdr
5253
INC += -I./../../lib/cmsis/inc
5354
INC += -I./device
5455
INC += -I./device/$(MCU_VARIANT)
@@ -142,7 +143,6 @@ SRC_C += \
142143
drivers/bluetooth/ble_drv.c \
143144
drivers/bluetooth/ble_uart.c \
144145
boards/$(BOARD)/board.c \
145-
boards/$(BOARD)/pins.c \
146146
device/$(MCU_VARIANT)/system_$(MCU_SUB_VARIANT).c \
147147
device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \
148148
lib/oofatfs/ff.c \
@@ -257,6 +257,7 @@ FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
257257
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
258258

259259
OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
260+
OBJ += $(BUILD)/pins_gen.o
260261
OBJ += $(addprefix $(BUILD)/, $(SRC_HAL:.c=.o))
261262
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
262263
OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.c=.o))
@@ -326,16 +327,16 @@ SRC_QSTR_AUTO_DEPS +=
326327
# any of the objects. The normal dependency generation will deal with the
327328
# case when pins.h is modified. But when it doesn't exist, we don't know
328329
# which source files might need it.
329-
#$(OBJ): | $(HEADER_BUILD)/pins.h
330+
$(OBJ): | $(HEADER_BUILD)/pins.h
330331

331332
# Use a pattern rule here so that make will only call make-pins.py once to make
332333
# both pins_$(BOARD).c and pins.h
333-
#$(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)
334-
# $(ECHO) "Create $@"
335-
# $(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)
334+
$(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)
335+
$(ECHO) "Create $@"
336+
$(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)
336337

337-
#$(BUILD)/pins_gen.o: $(BUILD)/pins_gen.c
338-
# $(call compile_c)
338+
$(BUILD)/pins_gen.o: $(BUILD)/pins_gen.c
339+
$(call compile_c)
339340

340341
MAKE_PINS = boards/make-pins.py
341342
BOARD_PINS = boards/$(BOARD)/pins.csv

ports/nrf/boards/feather52/mpconfigboard.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@
5757
#define MICROPY_HW_LED2 (19) // LED2
5858

5959
// UART config
60-
#define MICROPY_HW_UART1_RX (pin_PA08)
61-
#define MICROPY_HW_UART1_TX (pin_PA06)
60+
#define MICROPY_HW_UART1_RX (pin_P0_08)
61+
#define MICROPY_HW_UART1_TX (pin_P0_06)
6262
#define MICROPY_HW_UART1_HWFC (0)
6363

6464
// SPI0 config
6565
#define MICROPY_HW_SPI0_NAME "SPI0"
66-
#define MICROPY_HW_SPI0_SCK (pin_PA12) // (Arduino D13)
67-
#define MICROPY_HW_SPI0_MOSI (pin_PA13) // (Arduino D11)
68-
#define MICROPY_HW_SPI0_MISO (pin_PA14) // (Arduino D12)
66+
#define MICROPY_HW_SPI0_SCK (pin_P0_12) // (Arduino D13)
67+
#define MICROPY_HW_SPI0_MOSI (pin_P0_13) // (Arduino D11)
68+
#define MICROPY_HW_SPI0_MISO (pin_P0_14) // (Arduino D12)
6969

7070
#define MICROPY_HW_PWM0_NAME "PWM0"
7171
#define MICROPY_HW_PWM1_NAME "PWM1"

ports/nrf/boards/feather52/pins.c

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

ports/nrf/boards/feather52/pins.h

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)