#include #include #include "gpio.h" #include "log.h" int gpio_init(int gpio, int io, int hl) { if(io==GPIO_IN) { rt_pin_mode(gpio, PIN_MODE_INPUT); } else { rt_pin_mode(gpio, PIN_MODE_OUTPUT); rt_pin_write(gpio, (hl>0)?PIN_HIGH:PIN_LOW); } return 0; } int gpio_deinit(int fd) { return 0; } int gpio_set(int gpio, int hl) { rt_pin_write(gpio, (hl>0)?PIN_HIGH:PIN_LOW); return 0; } int gpio_get(int gpio) { rt_ssize_t r = rt_pin_read(gpio); return (r==PIN_HIGH)?1:0; }