Control drones with a proper joystick
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.

joystick_events.h 912B

12345678910111213141516171819202122232425262728293031
  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 __JOYSTICK_EVENTS_H__
  13. #define __JOYSTICK_EVENTS_H__
  14. struct GamePadEventData {
  15. uint16_t X, Y, Rz; // 11bit, 11bit, 10bit
  16. uint8_t Z, Rx, Ry, Slider;
  17. };
  18. class JoystickEvents {
  19. public:
  20. virtual void OnGamePadChanged(const GamePadEventData *evt);
  21. virtual void OnHatSwitch(uint8_t hat);
  22. virtual void OnButtonUp(uint8_t but_id);
  23. virtual void OnButtonDn(uint8_t but_id);
  24. virtual void OnMouseMoved(uint8_t x, uint8_t y);
  25. };
  26. #endif // __JOYSTICK_EVENTS_H__