gpio is connected API

pull/2938/head
Radhika 2016-10-17 14:18:38 +05:30
parent b0265244a4
commit a3bccfdda7
1 changed files with 13 additions and 0 deletions

View File

@ -192,3 +192,16 @@ int gpio_read(gpio_t *obj)
return ret;
}
/* Checks if gpio object is connected (pin was not initialized with NC)
* @param pin The pin to be set as GPIO
* @return 0 if port is initialized with NC
**/
int gpio_is_connected(const gpio_t *obj)
{
if(obj->gpioPin != (PinName)NC) {
return 1;
} else {
return 0;
}
}