Private
Public Access
2
0

gpio.c: simplify gpio_get_valfp and make static

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-04-23 09:28:04 +01:00
parent f5c1a39530
commit 173b81c206

View File

@@ -33,8 +33,16 @@
extern "C" {
#endif
int
gpio_get_valfp(gpio_t *gpio);
static int
gpio_get_valfp(gpio_t *gpio) {
char bu[64];
sprintf(bu, "/sys/class/gpio/gpio%d/value", gpio->pin);
if((gpio->value_fp = fopen(bu, "r+b")) == NULL) {
return 1;
}
return 0;
}
void
gpio_init(gpio_t *gpio, int pin) {
@@ -113,19 +121,6 @@ gpio_close(gpio_t *gpio) {
}
}
int
gpio_get_valfp(gpio_t *gpio) {
char bu[64];
sprintf(bu, "/sys/class/gpio/gpio%d/value", gpio->pin);
if((gpio->value_fp = fopen(bu, "r+b")) == NULL) {
return 1;
} else {
return 0;
}
return 1;
}
#ifdef __cplusplus
}
#endif