wii_anal.h 3.2 KB

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