Skip to content

Commit be3ae5b

Browse files
committed
M487: Support PinName enum override
User can override PinName enum in PinNames.h for custom targets. E.g.: 1. Add into mbed_app.json: target.custom-pinname-file: "\"CustomPinName.h\"", 2. Implement PinName enum in CustomPinName.h
1 parent 71903ca commit be3ae5b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

targets/TARGET_NUVOTON/TARGET_M480/PinNames.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ typedef enum {
7070
PullDefault = PullUp
7171
} PinMode;
7272

73+
#if !defined(MBED_CONF_TARGET_CUSTOM_PINNAME_FILE)
74+
7375
typedef enum {
7476
// Not connected
7577
NC = (int)0xFFFFFFFF,
@@ -146,6 +148,12 @@ typedef enum {
146148

147149
} PinName;
148150

151+
#else
152+
153+
#include MBED_CONF_TARGET_CUSTOM_PINNAME_FILE
154+
155+
#endif
156+
149157
#ifdef __cplusplus
150158
}
151159
#endif

targets/targets.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12766,6 +12766,10 @@
1276612766
"help": "Enable SPIM CCM mode to spare 32KiB SRAM for normal use",
1276712767
"value": 0
1276812768
},
12769+
"custom-pinname-file": {
12770+
"help": "Header file to override PinName enum in PinNames.h",
12771+
"value": null
12772+
},
1276912773
"gpio-irq-debounce-enable": {
1277012774
"help": "Enable GPIO IRQ debounce",
1277112775
"value": 0

0 commit comments

Comments
 (0)