Skip to content

Commit 443d18a

Browse files
committed
[NANO130] Move target configuration from mbed_lib.json to targets.json
1 parent d4af4ba commit 443d18a

File tree

3 files changed

+30
-34
lines changed

3 files changed

+30
-34
lines changed

targets/TARGET_NUVOTON/TARGET_NANO100/gpio_irq_api.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,23 @@ static struct nu_gpio_irq_var gpio_irq_var_arr[] = {
4949

5050
#define NU_MAX_PORT (sizeof (gpio_irq_var_arr) / sizeof (gpio_irq_var_arr[0]))
5151

52-
#ifndef MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_ENABLE
53-
#define MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_ENABLE 0
52+
#ifndef MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_ENABLE
53+
#define MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_ENABLE 0
5454
#endif
5555

56-
#ifndef MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_ENABLE_LIST
57-
#define MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_ENABLE_LIST NC
56+
#ifndef MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_ENABLE_LIST
57+
#define MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_ENABLE_LIST NC
5858
#endif
5959
static PinName gpio_irq_debounce_arr[] = {
60-
MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_ENABLE_LIST
60+
MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_ENABLE_LIST
6161
};
6262

63-
#ifndef MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_CLOCK_SOURCE
64-
#define MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_CLOCK_SOURCE GPIO_DBCLKSRC_IRC10K
63+
#ifndef MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_CLOCK_SOURCE
64+
#define MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_CLOCK_SOURCE GPIO_DBCLKSRC_IRC10K
6565
#endif
6666

67-
#ifndef MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_SAMPLE_RATE
68-
#define MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_SAMPLE_RATE GPIO_DBCLKSEL_16
67+
#ifndef MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_SAMPLE_RATE
68+
#define MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_SAMPLE_RATE GPIO_DBCLKSEL_16
6969
#endif
7070

7171
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id)
@@ -90,12 +90,12 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32
9090
// There is no need to call gpio_set() redundantly.
9191

9292
{
93-
#if MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_ENABLE
93+
#if MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_ENABLE
9494
// Suppress compiler warning
9595
(void) gpio_irq_debounce_arr;
9696

9797
// Configure de-bounce clock source and sampling cycle time
98-
GPIO_SET_DEBOUNCE_TIME(MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_CLOCK_SOURCE, MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_SAMPLE_RATE);
98+
GPIO_SET_DEBOUNCE_TIME(MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_CLOCK_SOURCE, MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_SAMPLE_RATE);
9999
GPIO_ENABLE_DEBOUNCE(gpio_base, 1 << pin_index);
100100
#else
101101
// Enable de-bounce if the pin is in the de-bounce enable list
@@ -112,7 +112,7 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32
112112
if (pin_index == pin_index_debunce &&
113113
port_index == port_index_debounce) {
114114
// Configure de-bounce clock source and sampling cycle time
115-
GPIO_SET_DEBOUNCE_TIME(MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_CLOCK_SOURCE, MBED_CONF_NANO100_GPIO_IRQ_DEBOUNCE_SAMPLE_RATE);
115+
GPIO_SET_DEBOUNCE_TIME(MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_CLOCK_SOURCE, MBED_CONF_TARGET_GPIO_IRQ_DEBOUNCE_SAMPLE_RATE);
116116
GPIO_ENABLE_DEBOUNCE(gpio_base, 1 << pin_index);
117117
break;
118118
}

targets/TARGET_NUVOTON/TARGET_NANO100/mbed_lib.json

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

targets/targets.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3237,6 +3237,24 @@
32373237
"extra_labels": ["NUVOTON", "NANO100", "NANO130KE3BN"],
32383238
"is_disk_virtual": true,
32393239
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
3240+
"config": {
3241+
"gpio-irq-debounce-enable": {
3242+
"help": "Enable GPIO IRQ debounce",
3243+
"value": 0
3244+
},
3245+
"gpio-irq-debounce-enable-list": {
3246+
"help": "Comma separated pin list to enable GPIO IRQ debounce",
3247+
"value": "NC"
3248+
},
3249+
"gpio-irq-debounce-clock-source": {
3250+
"help": "Select GPIO IRQ debounce clock source: GPIO_DBCLKSRC_HCLK or GPIO_DBCLKSRC_IRC10K",
3251+
"value": "GPIO_DBCLKSRC_IRC10K"
3252+
},
3253+
"gpio-irq-debounce-sample-rate": {
3254+
"help": "Select GPIO IRQ debounce sample rate: GPIO_DBCLKSEL_1, GPIO_DBCLKSEL_2, GPIO_DBCLKSEL_4, ..., or GPIO_DBCLKSEL_32768",
3255+
"value": "GPIO_DBCLKSEL_16"
3256+
}
3257+
},
32403258
"inherits": ["Target"],
32413259
"macros": ["CMSIS_VECTAB_VIRTUAL", "CMSIS_VECTAB_VIRTUAL_HEADER_FILE=\"cmsis_nvic.h\""],
32423260
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "STDIO_MESSAGES", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH"],

0 commit comments

Comments
 (0)