[M2351] Add gpio_is_connected

pull/7302/head
cyliangtw 2018-02-07 09:58:47 +08:00 committed by ccli8
parent ef7f04808d
commit 2b44eeaef5
1 changed files with 6 additions and 1 deletions

View File

@ -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
#endif