Skip to content

Commit a3bccfd

Browse files
gpio is connected API
1 parent b026524 commit a3bccfd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

targets/TARGET_ONSEMI/TARGET_NCS36510/gpio_api.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,16 @@ int gpio_read(gpio_t *obj)
192192

193193
return ret;
194194
}
195+
196+
/* Checks if gpio object is connected (pin was not initialized with NC)
197+
* @param pin The pin to be set as GPIO
198+
* @return 0 if port is initialized with NC
199+
**/
200+
int gpio_is_connected(const gpio_t *obj)
201+
{
202+
if(obj->gpioPin != (PinName)NC) {
203+
return 1;
204+
} else {
205+
return 0;
206+
}
207+
}

0 commit comments

Comments
 (0)