wii_anal.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef WII_ANAL_H_
  2. #define WII_ANAL_H_
  3. #include <furi.h> // Core API
  4. #include <input/input.h> // GUI Input extensions
  5. #include <notification/notification_messages.h>
  6. //----------------------------------------------------------------------------- ----------------------------------------
  7. // GUI scenes
  8. //
  9. typedef enum scene {
  10. SCENE_NONE = 0,
  11. SCENE_SPLASH = 1,
  12. SCENE_RIP = 2,
  13. SCENE_WAIT = 3,
  14. SCENE_DEBUG = 4,
  15. SCENE_DUMP = 5,
  16. SCENE_CLASSIC = 6,
  17. SCENE_CLASSIC_N = 7,
  18. SCENE_NUNCHUCK = 8,
  19. SCENE_NUNCHUCK_ACC = 9,
  20. } scene_t;
  21. //----------------------------------------------------------------------------- ----------------------------------------
  22. #include "wii_i2c.h"
  23. #include "wii_ec.h"
  24. //----------------------------------------------------------------------------- ----------------------------------------
  25. // A list of event IDs handled by this plugin
  26. //
  27. typedef enum eventID {
  28. EVID_NONE,
  29. EVID_UNKNOWN,
  30. // A full list of events can be found with: `grep -r --color "void.*set_.*_callback" applications/gui/*`
  31. // ...A free gift to you from the makers of well written code that conforms to a good coding standard
  32. EVID_KEY, // keypad
  33. EVID_TICK, // tick
  34. EVID_WIIEC, // wii extension controller
  35. } eventID_t;
  36. //----------------------------------------------------------------------------- ----------------------------------------
  37. // An item in the event message-queue
  38. //
  39. typedef struct eventMsg {
  40. eventID_t id;
  41. union {
  42. InputEvent input; // --> applications/input/input.h
  43. wiiEcEvent_t wiiEc; // --> local
  44. };
  45. } eventMsg_t;
  46. //----------------------------------------------------------------------------- ----------------------------------------
  47. // State variables for this plugin
  48. // An instance of this is allocated on the heap, and the pointer is passed back to the OS
  49. // Access to this memory is controlled by mutex
  50. //
  51. typedef struct state {
  52. FuriMutex* mutex; // mutex for using this struct
  53. bool run; // true : plugin is running
  54. bool timerEn; // controller scanning enabled
  55. FuriTimer* timer; // the timer
  56. uint32_t timerHz; // system ticks per second
  57. int fps; // poll/refresh [frames]-per-second
  58. int cnvW; // canvas width
  59. int cnvH; // canvas height
  60. scene_t scene; // current scene
  61. scene_t scenePrev; // previous scene
  62. scene_t scenePegg; // previous scene for easter eggs
  63. int flash; // flash counter (flashing icons)
  64. int hold; // hold type: {-1=tough-peak, 0=none, +1=peak-hold}
  65. ecCalib_t calib; // Software calibration mode
  66. bool pause; // Accelerometer animation pause
  67. bool apause; // Accelerometer animation auto-pause
  68. NotificationApp* notify; // OS nitifcation queue (for patting the backlight watchdog timer)
  69. wiiEC_t ec; // Extension Controller details
  70. } state_t;
  71. //============================================================================= ========================================
  72. // Function prototypes
  73. //
  74. void timerEn(state_t* state, bool on);
  75. #endif //WII_ANAL_H_