Control drones with a proper joystick
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031323334353637383940
  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 __PARSER_H__
  13. #define __PARSER_H__
  14. #include <usbhid.h>
  15. #include "data.h"
  16. #define RPT_GEMEPAD_LEN 8
  17. #define BUFFER_SIZE 16
  18. class JoystickEvents;
  19. class JoystickReportParser : public HIDReportParser {
  20. public:
  21. JoystickReportParser(JoystickEvents* evt);
  22. virtual void Parse(USBHID* hid, bool is_rpt_id, uint8_t len, uint8_t* bufPart);
  23. private:
  24. uint8_t buf[BUFFER_SIZE];
  25. uint8_t oldPad[RPT_GEMEPAD_LEN];
  26. uint8_t oldHat;
  27. uint64_t oldButtons;
  28. uint8_t oldMouse;
  29. GamePadEventData buffer;
  30. JoystickEvents* joyEvents;
  31. };
  32. #endif // __PARSER_H__