wii_ec_classic.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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
  33. struct ecCalClassic
  34. {
  35. CLASSIC_ANALOGUE
  36. }
  37. ecCalClassic_t;
  38. //-----------------------------------------------------------------------------
  39. // All controls
  40. //
  41. typedef
  42. struct ecDecClassic
  43. {
  44. CLASSIC_ANALOGUE // MUST be first
  45. // Digital controls
  46. bool btnZL, btnZR; // BTN{l, l}
  47. bool btnL, btnR; // BTN{L, R} upperrcase=shoulder
  48. bool padU, padL, padD, padR; // BTN{W, A, S, D}
  49. bool btnM, btnH, btnP; // BTN{-, h, +}
  50. bool btnX, btnY; // BTN{x, y}
  51. bool btnA, btnB; // BTN{a, b}
  52. }
  53. ecDecClassic_t;
  54. #undef CLASSIC_ANALOGUE
  55. //============================================================================= ========================================
  56. // Function prototypes
  57. //
  58. #include <gui/gui.h> // Canvas
  59. typedef struct wiiEC wiiEC_t ;
  60. typedef enum ecCalib ecCalib_t ;
  61. typedef struct state state_t ;
  62. typedef struct eventMsg eventMsg_t ;
  63. void classic_decode (wiiEC_t* const pec) ;
  64. void classic_msg (wiiEC_t* const pec, FuriMessageQueue* const queue) ;
  65. void classic_calib (wiiEC_t* const pec, ecCalib_t c) ;
  66. void classic_show (Canvas* const canvas, state_t* const state) ;
  67. bool classic_key (const eventMsg_t* const msg, state_t* const state) ;
  68. #endif //WII_EC_CLASSIC_H_