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:
@@ -33,8 +33,16 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
static int
|
||||||
gpio_get_valfp(gpio_t *gpio);
|
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
|
void
|
||||||
gpio_init(gpio_t *gpio, int pin) {
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user