wii_ec_classic.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef WII_EC_CLASSIC_H_
  2. #define WII_EC_CLASSIC_H_
  3. #include <stdint.h>
  4. #include <stdbool.h>
  5. //----------------------------------------------------------------------------- ----------------------------------------
  6. // Classic Controller ... Classic Controller Pro is electronically the same
  7. //
  8. // ANA{l} ANA{r}
  9. // BTN{l} BTN{L} BTN{R} BTN{r}
  10. // ,--------. ,-, ,-, .--------,
  11. // .----------------------------------------------------------.
  12. // | |
  13. // | BTN{W} BTN{x} |
  14. // | BTN{A} BTN{D} BTN{-} BTN{h} BTN{+} BTN{y} BTN{a} |
  15. // | BTN{S} BTN{b} |
  16. // | |
  17. // | ANA{y} ANA{Y} |
  18. // | ANA{x} ANA{X} |
  19. // | |
  20. // `----------------------------------------------------------'
  21. //
  22. //----------------------------------------------------------------------------- ----------------------------------------
  23. // Controllers which have calibration must have their calibratable controls here
  24. //! Is there a better way to get the start of the decode struct to match the calibration struct ?
  25. #define CLASSIC_ANALOGUE \
  26. uint8_t trgZL, trgZR; /* ANA{l, l} lowercase=trigger 5bit values {5} */ \
  27. uint8_t joyLX, joyLY; /* ANA{x, y} left=lowercase 6bit values {6}<-- */ \
  28. uint8_t joyRX, joyRY; /* ANA{X, Y} 5bit values {5} */
  29. //-----------------------------------------------------------------------------
  30. // Calibratable controls
  31. //
  32. typedef struct ecCalClassic {
  33. CLASSIC_ANALOGUE
  34. } ecCalClassic_t;
  35. //-----------------------------------------------------------------------------
  36. // All controls
  37. //
  38. typedef struct ecDecClassic {
  39. CLASSIC_ANALOGUE // MUST be first
  40. // Digital controls
  41. bool btnZL,
  42. btnZR; // BTN{l, l}
  43. bool btnL, btnR; // BTN{L, R} upperrcase=shoulder
  44. bool padU, padL, padD, padR; // BTN{W, A, S, D}
  45. bool btnM, btnH, btnP; // BTN{-, h, +}
  46. bool btnX, btnY; // BTN{x, y}
  47. bool btnA, btnB; // BTN{a, b}
  48. } ecDecClassic_t;
  49. #undef CLASSIC_ANALOGUE
  50. //============================================================================= ========================================
  51. // Function prototypes
  52. //
  53. #include <gui/gui.h> // Canvas
  54. typedef struct wiiEC wiiEC_t;
  55. typedef enum ecCalib ecCalib_t;
  56. typedef struct state state_t;
  57. typedef struct eventMsg eventMsg_t;
  58. void classic_decode(wiiEC_t* const pec);
  59. void classic_msg(wiiEC_t* const pec, FuriMessageQueue* const queue);
  60. void classic_calib(wiiEC_t* const pec, ecCalib_t c);
  61. void classic_show(Canvas* const canvas, state_t* const state);
  62. bool classic_key(const eventMsg_t* const msg, state_t* const state);
  63. #endif //WII_EC_CLASSIC_H_