You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

hidjoystickrptparser.h 802B

123456789101112131415161718192021222324252627282930313233
  1. #if !defined(__HIDJOYSTICKRPTPARSER_H__)
  2. #define __HIDJOYSTICKRPTPARSER_H__
  3. #include <hid.h>
  4. struct GamePadEventData {
  5. uint8_t X, Y, Z1, Z2, Rz;
  6. };
  7. class JoystickEvents {
  8. public:
  9. virtual void OnGamePadChanged(const GamePadEventData *evt);
  10. virtual void OnHatSwitch(uint8_t hat);
  11. virtual void OnButtonUp(uint8_t but_id);
  12. virtual void OnButtonDn(uint8_t but_id);
  13. };
  14. #define RPT_GEMEPAD_LEN 5
  15. class JoystickReportParser : public HIDReportParser {
  16. JoystickEvents *joyEvents;
  17. uint8_t oldPad[RPT_GEMEPAD_LEN];
  18. uint8_t oldHat;
  19. uint16_t oldButtons;
  20. public:
  21. JoystickReportParser(JoystickEvents *evt);
  22. virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
  23. };
  24. #endif // __HIDJOYSTICKRPTPARSER_H__