Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef __GPIO_SYSFS_H
- #define __GPIO_SYSFS_H
- typedef enum bool_enum { false, true } bool;
- #include <stdint.h>
- #define IN false
- #define OUT true
- #define GPIO_FILENAME_CHAR_SIZE 7
- #define GPIODIR "/sys/class/gpio/"
- #define EXPORTFILE GPIODIR"export"
- #define UNEXPORTFILE GPIODIR"unexport"
- #define GPIO_OUT "out"
- #define GPIO_IN "in"
- #define FILE_ERROR 2
- #define GPIO_WRONG_DIRECTION_ERROR 3
- #define GPIO_NOT_EXPORTED_ERROR 4
- #define GPIO_ALREADY_EXPORTED_ERROR 5
- bool is_gpio_exported(uint8_t gpio);
- uint8_t gpio_export(uint8_t gpio);
- uint8_t gpio_unexport(uint8_t gpio);
- uint8_t gpio_change_direction(uint8_t gpio, char *direction);
- uint8_t gpio_read_direction(uint8_t gpio, char *d);
- uint8_t gpio_write(uint8_t gpio, bool value);
- uint8_t gpio_read(uint8_t gpio, uint8_t *v);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement