wii_ec_nunchuck.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 struct ecCalNunchuck {
  15. NUNCHUCK_ANALOGUE
  16. } ecCalNunchuck_t;
  17. //-----------------------------------------------------------------------------
  18. // All controls
  19. //
  20. typedef struct ecDecNunchuck {
  21. NUNCHUCK_ANALOGUE // MUST be first
  22. // Digital controls
  23. bool btnC,
  24. btnZ; // BTN{c, z}
  25. } ecDecNunchuck_t;
  26. #undef NUNCHUCK_ANALOGUE
  27. //=============================================================================
  28. // Function prototypes
  29. //
  30. #include <gui/gui.h> // Canvas
  31. typedef struct wiiEC wiiEC_t;
  32. typedef enum ecCalib ecCalib_t;
  33. typedef struct state state_t;
  34. typedef struct eventMsg eventMsg_t;
  35. void nunchuck_decode(wiiEC_t* const pec);
  36. void nunchuck_msg(wiiEC_t* const pec, FuriMessageQueue* const queue);
  37. void nunchuck_calib(wiiEC_t* const pec, ecCalib_t c);
  38. void nunchuck_show(Canvas* const canvas, state_t* const state);
  39. bool nunchuck_key(const eventMsg_t* const msg, state_t* const state);
  40. #endif //WII_EC_NUNCHUCK_H_