commGPIO.h 711 B

123456789101112131415161718192021222324252627282930
  1. #ifndef _commGPIO_H_
  2. #define _commGPIO_H_
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <unistd.h>
  6. #include <sys/types.h>
  7. #include <sys/stat.h>
  8. #include <stdarg.h>
  9. #include <time.h>
  10. #include <assert.h>
  11. #include <errno.h>
  12. #include <stdlib.h>
  13. #include <fcntl.h>
  14. #include <poll.h>
  15. #include "commLOG.h"
  16. //#define MSG(args...) printf(args)
  17. #define MSG(fmt, args...) DBGLog(fmt, ##args)
  18. //函数声明
  19. int gpio_export(int pin);
  20. int gpio_unexport(int pin);
  21. int gpio_direction(int pin, int dir); //dir: 0-->IN, 1-->OUT
  22. int gpio_write(int pin, int value); //value: 0-->LOW, 1-->HIGH
  23. int gpio_read(int pin);
  24. int gpio_edge(int pin, int edge); //edge: 0-->none, 1-->rising, 2-->falling, 3-->both
  25. #endif