wii_ec_nunchuck.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef WII_EC_NUNCHUCK_H_
  2. #define WII_EC_NUNCHUCK_H_
  3. #include <stdint.h>
  4. #include <stdbool.h>
  5. //-----------------------------------------------------------------------------
  6. // Controllers which have calibration must have their calibratable controls here
  7. //! Is there a better way to get the start of the decode struct to match the calibration struct ?
  8. #define NUNCHUCK_ANALOGUE \
  9. uint8_t joyX, joyY; \
  10. uint16_t accX, accY, accZ;
  11. //-----------------------------------------------------------------------------
  12. // Calibratable controls
  13. //
  14. typedef
  15. struct ecCalNunchuck {
  16. NUNCHUCK_ANALOGUE
  17. }
  18. ecCalNunchuck_t;
  19. //-----------------------------------------------------------------------------
  20. // All controls
  21. //
  22. typedef
  23. struct ecDecNunchuck {
  24. NUNCHUCK_ANALOGUE // MUST be first
  25. // Digital controls
  26. bool btnC, btnZ; // BTN{c, z}
  27. }
  28. ecDecNunchuck_t;
  29. #undef NUNCHUCK_ANALOGUE
  30. //=============================================================================
  31. // Function prototypes
  32. //
  33. #include <gui/gui.h> // Canvas
  34. typedef struct wiiEC wiiEC_t ;
  35. typedef enum ecCalib ecCalib_t ;
  36. typedef struct state state_t ;
  37. typedef struct eventMsg eventMsg_t ;
  38. void nunchuck_decode (wiiEC_t* const pec) ;
  39. void nunchuck_msg (wiiEC_t* const pec, FuriMessageQueue* const queue) ;
  40. void nunchuck_calib (wiiEC_t* const pec, ecCalib_t c) ;
  41. void nunchuck_show (Canvas* const canvas, state_t* const state) ;
  42. bool nunchuck_key (const eventMsg_t* const msg, state_t* const state) ;
  43. #endif //WII_EC_NUNCHUCK_H_