@@ -143,6 +143,45 @@ typedef enum
143
143
144
144
/** @} */
145
145
146
+ //--------------------------------------------------------------------+
147
+ // GAMEPAD
148
+ //--------------------------------------------------------------------+
149
+ /** \addtogroup ClassDriver_HID_Gamepad Gamepad
150
+ * @{ */
151
+
152
+ /// Standard HID Boot Protocol Gampad Report.
153
+ typedef struct TU_ATTR_PACKED
154
+ {
155
+ uint16_t buttons ; /**< buttons mask for currently pressed buttons in the gamepad. */
156
+ int8_t x ; /**< Current delta x movement of the gamepad joystick 1. */
157
+ int8_t y ; /**< Current delta y movement of the gamepad joystick 1. */
158
+ int8_t z ; /**< Current delta z movement of the gamepad joystick 2. */
159
+ int8_t r_z ; /**< Current delta r_z movement of the gamepad joystick 2. */
160
+ }hid_gamepad_report_t ;
161
+
162
+ /// Standard Gamepad Buttons Bitmap (from Linux input event codes)
163
+ typedef enum
164
+ {
165
+ GAMEPAD_BUTTON_A = TU_BIT (0 ), ///< A/South button
166
+ GAMEPAD_BUTTON_B = TU_BIT (1 ), ///< B/East button
167
+ GAMEPAD_BUTTON_C = TU_BIT (2 ), ///< C button
168
+ GAMEPAD_BUTTON_X = TU_BIT (3 ), ///< X/North button
169
+ GAMEPAD_BUTTON_Y = TU_BIT (4 ), ///< Y/West button
170
+ GAMEPAD_BUTTON_Z = TU_BIT (5 ), ///< Z button
171
+ GAMEPAD_BUTTON_TL = TU_BIT (6 ), ///< L1 button
172
+ GAMEPAD_BUTTON_TR = TU_BIT (7 ), ///< R1 button
173
+ GAMEPAD_BUTTON_TL2 = TU_BIT (8 ), ///< L2 button
174
+ GAMEPAD_BUTTON_TR2 = TU_BIT (9 ), ///< R2 button
175
+ GAMEPAD_BUTTON_SELECT = TU_BIT (10 ), ///< Select button
176
+ GAMEPAD_BUTTON_START = TU_BIT (11 ), ///< Start button
177
+ GAMEPAD_BUTTON_MODE = TU_BIT (12 ), ///< Mode button
178
+ GAMEPAD_BUTTON_THUMBL = TU_BIT (13 ), ///< L3 button
179
+ GAMEPAD_BUTTON_THUMBR = TU_BIT (14 ), ///< R3 button
180
+ GAMEPAD_BUTTON_ = TU_BIT (15 ), ///< Undefined button
181
+ }hid_gamepad_button_bm_t ;
182
+
183
+ /// @}
184
+
146
185
//--------------------------------------------------------------------+
147
186
// MOUSE
148
187
//--------------------------------------------------------------------+
0 commit comments