Skip to content

Commit c99a347

Browse files
ccli8cmonr
authored andcommitted
Add gpio_is_connected
1 parent 48b774b commit c99a347

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

targets/TARGET_NUVOTON/TARGET_M451/gpio_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ uint32_t gpio_set(PinName pin)
3737
return (uint32_t)(1 << pin_index); // Return the pin mask
3838
}
3939

40+
int gpio_is_connected(const gpio_t *obj)
41+
{
42+
return (obj->pin != (PinName) NC);
43+
}
44+
4045
void gpio_init(gpio_t *obj, PinName pin)
4146
{
4247
obj->pin = pin;

targets/TARGET_NUVOTON/TARGET_M480/gpio_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ uint32_t gpio_set(PinName pin)
3737
return (uint32_t)(1 << pin_index); // Return the pin mask
3838
}
3939

40+
int gpio_is_connected(const gpio_t *obj)
41+
{
42+
return (obj->pin != (PinName) NC);
43+
}
44+
4045
void gpio_init(gpio_t *obj, PinName pin)
4146
{
4247
obj->pin = pin;

targets/TARGET_NUVOTON/TARGET_NANO100/gpio_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ uint32_t gpio_set(PinName pin)
3434
return (uint32_t)(1 << pin_index); // Return the pin mask
3535
}
3636

37+
int gpio_is_connected(const gpio_t *obj)
38+
{
39+
return (obj->pin != (PinName) NC);
40+
}
41+
3742
void gpio_init(gpio_t *obj, PinName pin)
3843
{
3944
obj->pin = pin;

targets/TARGET_NUVOTON/TARGET_NUC472/gpio_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ uint32_t gpio_set(PinName pin)
3737
return (uint32_t)(1 << pin_index); // Return the pin mask
3838
}
3939

40+
int gpio_is_connected(const gpio_t *obj)
41+
{
42+
return (obj->pin != (PinName) NC);
43+
}
44+
4045
void gpio_init(gpio_t *obj, PinName pin)
4146
{
4247
obj->pin = pin;

0 commit comments

Comments
 (0)