i2ctools_i.h 814 B

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