GPIO_reader_item.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef GPIO_READER_ITEM
  2. #define GPIO_READER_ITEM
  3. #include <furi.h>
  4. #include <furi_hal_resources.h>
  5. #define GPIO_ITEM_COUNT 8
  6. #define GPIO_PULL_COUNT 3
  7. typedef struct {
  8. const char* name;
  9. const GpioPin* pin;
  10. } GpioItem;
  11. static const GpioItem gpio_item[GPIO_ITEM_COUNT] = {
  12. {"2: PA7", &gpio_ext_pa7},
  13. {"3: PA6", &gpio_ext_pa6},
  14. {"4: PA4", &gpio_ext_pa4},
  15. {"5: PB3", &gpio_ext_pb3},
  16. {"6: PB2", &gpio_ext_pb2},
  17. {"7: PC3", &gpio_ext_pc3},
  18. {"15: PC1", &gpio_ext_pc1},
  19. {"16: PC0", &gpio_ext_pc0},
  20. };
  21. typedef struct {
  22. const char* name;
  23. const GpioPull pull;
  24. } GpioPullMode;
  25. static const GpioPullMode gpio_pull_mode[3] = {
  26. {"high impedence", GpioPullNo},
  27. {"pull up", GpioPullUp},
  28. {"pull down", GpioPullDown},
  29. };
  30. const char* gpio_item_get_pin_name(uint8_t index);
  31. const char* gpio_item_get_pin_level(uint8_t index);
  32. void gpio_item_configure_pin(uint8_t index, uint8_t pullMode);
  33. const char* gpio_item_get_pull_mode(uint8_t pull_mode);
  34. #endif