i2ctools_i.h 800 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include <furi.h>
  2. #include <furi_hal.h>
  3. #include <gui/gui.h>
  4. #include <input/input.h>
  5. #include "i2csniffer.h"
  6. // Menu
  7. typedef enum {
  8. MAIN_VIEW,
  9. SCAN_VIEW,
  10. SNIFF_VIEW,
  11. SEND_VIEW,
  12. PLAY_VIEW,
  13. /* Know menu Size*/
  14. MENU_SIZE
  15. } i2cToolsMainMenu;
  16. // Bus scanner
  17. #define MAX_I2C_ADDR 0x7F
  18. typedef struct {
  19. uint8_t addresses[MAX_I2C_ADDR + 1];
  20. uint8_t found;
  21. uint8_t menu_index;
  22. bool scanned;
  23. } _scanner;
  24. // Sender
  25. typedef struct {
  26. uint8_t address_idx;
  27. uint8_t value;
  28. uint8_t recv[2];
  29. bool must_send;
  30. bool sended;
  31. bool error;
  32. } _sender;
  33. // App datas
  34. typedef struct {
  35. ViewPort* view_port;
  36. i2cToolsMainMenu current_menu;
  37. uint8_t main_menu_index;
  38. _scanner scanner;
  39. i2cSniffer* sniffer;
  40. _sender sender;
  41. } i2cTools;