From 2b44eeaef5392a286c28e88d8564685f04854e4c Mon Sep 17 00:00:00 2001 From: cyliangtw Date: Wed, 7 Feb 2018 09:58:47 +0800 Subject: [PATCH] [M2351] Add gpio_is_connected --- targets/TARGET_NUVOTON/TARGET_M2351/gpio_api.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/gpio_api.c b/targets/TARGET_NUVOTON/TARGET_M2351/gpio_api.c index 5197234eaa..84e77e5fca 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/gpio_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M2351/gpio_api.c @@ -37,6 +37,11 @@ uint32_t gpio_set(PinName pin) return (uint32_t)(1 << pin_index); // Return the pin mask } +int gpio_is_connected(const gpio_t *obj) +{ + return (obj->pin != (PinName) NC); +} + void gpio_init(gpio_t *obj, PinName pin) { obj->pin = pin; @@ -86,4 +91,4 @@ void gpio_dir(gpio_t *obj, PinDirection direction) GPIO_SetMode(gpio_base, 1 << pin_index, mode_intern); } -#endif \ No newline at end of file +#endif