Control drones with a proper joystick
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

hid_parser.h 1000B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Saitek X52 Arduino USB Host Shield Library.
  3. * Copyright 2016 by Thomas Buck <xythobuz@xythobuz.de>
  4. *
  5. * Based on the USB Host Library HID Joystick example
  6. * https://www.circuitsathome.com/mcu/hid-joystick-code-sample
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation, version 2.
  11. */
  12. #ifndef __HID_PARSER_H__
  13. #define __HID_PARSER_H__
  14. #include <hid.h>
  15. #include "joystick_events.h"
  16. #define RPT_GEMEPAD_LEN 8
  17. #define BUFFER_SIZE 16
  18. class JoystickReportParser : public HIDReportParser {
  19. public:
  20. JoystickReportParser(JoystickEvents* evt);
  21. virtual void Parse(HID* hid, bool is_rpt_id, uint8_t len, uint8_t* bufPart);
  22. private:
  23. uint8_t buf[BUFFER_SIZE];
  24. uint8_t oldPad[RPT_GEMEPAD_LEN];
  25. uint8_t oldHat;
  26. uint64_t oldButtons;
  27. uint8_t oldMouse;
  28. GamePadEventData buffer;
  29. JoystickEvents* joyEvents;
  30. };
  31. #endif // __HID_PARSER_H__