@@ -201,30 +201,73 @@ typedef struct TU_ATTR_PACKED
201201 int8_t rx ; ///< Delta Rx movement of analog left trigger
202202 int8_t ry ; ///< Delta Ry movement of analog right trigger
203203 uint8_t hat ; ///< Buttons mask for currently pressed buttons in the DPad/hat
204- uint16_t buttons ; ///< Buttons mask for currently pressed buttons
204+ uint32_t buttons ; ///< Buttons mask for currently pressed buttons
205205}hid_gamepad_report_t ;
206206
207- /// Standard Gamepad Buttons Bitmap (from Linux input event codes)
207+ /// Standard Gamepad Buttons Bitmap
208208typedef enum
209209{
210- GAMEPAD_BUTTON_A = TU_BIT (0 ), ///< A/South button
211- GAMEPAD_BUTTON_B = TU_BIT (1 ), ///< B/East button
212- GAMEPAD_BUTTON_C = TU_BIT (2 ), ///< C button
213- GAMEPAD_BUTTON_X = TU_BIT (3 ), ///< X/North button
214- GAMEPAD_BUTTON_Y = TU_BIT (4 ), ///< Y/West button
215- GAMEPAD_BUTTON_Z = TU_BIT (5 ), ///< Z button
216- GAMEPAD_BUTTON_TL = TU_BIT (6 ), ///< L1 button
217- GAMEPAD_BUTTON_TR = TU_BIT (7 ), ///< R1 button
218- GAMEPAD_BUTTON_TL2 = TU_BIT (8 ), ///< L2 button
219- GAMEPAD_BUTTON_TR2 = TU_BIT (9 ), ///< R2 button
220- GAMEPAD_BUTTON_SELECT = TU_BIT (10 ), ///< Select button
221- GAMEPAD_BUTTON_START = TU_BIT (11 ), ///< Start button
222- GAMEPAD_BUTTON_MODE = TU_BIT (12 ), ///< Mode button
223- GAMEPAD_BUTTON_THUMBL = TU_BIT (13 ), ///< L3 button
224- GAMEPAD_BUTTON_THUMBR = TU_BIT (14 ), ///< R3 button
225- //GAMEPAD_BUTTON_ = TU_BIT(15), ///< Undefined button
210+ GAMEPAD_BUTTON_0 = TU_BIT (0 ),
211+ GAMEPAD_BUTTON_1 = TU_BIT (1 ),
212+ GAMEPAD_BUTTON_2 = TU_BIT (2 ),
213+ GAMEPAD_BUTTON_3 = TU_BIT (3 ),
214+ GAMEPAD_BUTTON_4 = TU_BIT (4 ),
215+ GAMEPAD_BUTTON_5 = TU_BIT (5 ),
216+ GAMEPAD_BUTTON_6 = TU_BIT (6 ),
217+ GAMEPAD_BUTTON_7 = TU_BIT (7 ),
218+ GAMEPAD_BUTTON_8 = TU_BIT (8 ),
219+ GAMEPAD_BUTTON_9 = TU_BIT (9 ),
220+ GAMEPAD_BUTTON_10 = TU_BIT (10 ),
221+ GAMEPAD_BUTTON_11 = TU_BIT (11 ),
222+ GAMEPAD_BUTTON_12 = TU_BIT (12 ),
223+ GAMEPAD_BUTTON_13 = TU_BIT (13 ),
224+ GAMEPAD_BUTTON_14 = TU_BIT (14 ),
225+ GAMEPAD_BUTTON_15 = TU_BIT (15 ),
226+ GAMEPAD_BUTTON_16 = TU_BIT (16 ),
227+ GAMEPAD_BUTTON_17 = TU_BIT (17 ),
228+ GAMEPAD_BUTTON_18 = TU_BIT (18 ),
229+ GAMEPAD_BUTTON_19 = TU_BIT (19 ),
230+ GAMEPAD_BUTTON_20 = TU_BIT (20 ),
231+ GAMEPAD_BUTTON_21 = TU_BIT (21 ),
232+ GAMEPAD_BUTTON_22 = TU_BIT (22 ),
233+ GAMEPAD_BUTTON_23 = TU_BIT (23 ),
234+ GAMEPAD_BUTTON_24 = TU_BIT (24 ),
235+ GAMEPAD_BUTTON_25 = TU_BIT (25 ),
236+ GAMEPAD_BUTTON_26 = TU_BIT (26 ),
237+ GAMEPAD_BUTTON_27 = TU_BIT (27 ),
238+ GAMEPAD_BUTTON_28 = TU_BIT (28 ),
239+ GAMEPAD_BUTTON_29 = TU_BIT (29 ),
240+ GAMEPAD_BUTTON_30 = TU_BIT (30 ),
241+ GAMEPAD_BUTTON_31 = TU_BIT (31 ),
226242}hid_gamepad_button_bm_t ;
227243
244+ /// Standard Gamepad Buttons Naming from Linux input event codes
245+ /// https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h
246+ #define GAMEPAD_BUTTON_A GAMEPAD_BUTTON_0
247+ #define GAMEPAD_BUTTON_SOUTH GAMEPAD_BUTTON_0
248+
249+ #define GAMEPAD_BUTTON_B GAMEPAD_BUTTON_1
250+ #define GAMEPAD_BUTTON_EAST GAMEPAD_BUTTON_1
251+
252+ #define GAMEPAD_BUTTON_C GAMEPAD_BUTTON_2
253+
254+ #define GAMEPAD_BUTTON_X GAMEPAD_BUTTON_3
255+ #define GAMEPAD_BUTTON_NORTH GAMEPAD_BUTTON_3
256+
257+ #define GAMEPAD_BUTTON_Y GAMEPAD_BUTTON_4
258+ #define GAMEPAD_BUTTON_WEST GAMEPAD_BUTTON_4
259+
260+ #define GAMEPAD_BUTTON_Z GAMEPAD_BUTTON_5
261+ #define GAMEPAD_BUTTON_TL GAMEPAD_BUTTON_6
262+ #define GAMEPAD_BUTTON_TR GAMEPAD_BUTTON_7
263+ #define GAMEPAD_BUTTON_TL2 GAMEPAD_BUTTON_8
264+ #define GAMEPAD_BUTTON_TR2 GAMEPAD_BUTTON_9
265+ #define GAMEPAD_BUTTON_SELECT GAMEPAD_BUTTON_10
266+ #define GAMEPAD_BUTTON_START GAMEPAD_BUTTON_11
267+ #define GAMEPAD_BUTTON_MODE GAMEPAD_BUTTON_12
268+ #define GAMEPAD_BUTTON_THUMBL GAMEPAD_BUTTON_13
269+ #define GAMEPAD_BUTTON_THUMBR GAMEPAD_BUTTON_14
270+
228271/// Standard Gamepad HAT/DPAD Buttons (from Linux input event codes)
229272typedef enum
230273{
0 commit comments