Control drones with a proper joystick
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

data.h 947B

123456789101112131415161718192021222324252627282930
  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 __GAMEPAD_EVENT_DATA_H__
  13. #define __GAMEPAD_EVENT_DATA_H__
  14. #include <stdint.h>
  15. class GamePadEventData {
  16. public:
  17. GamePadEventData(uint16_t v) : X(v), Y(v), Z(v), Rx(v), Ry(v), Rz(v), Slider(v) { }
  18. GamePadEventData(uint16_t x, uint16_t y, uint8_t z, uint8_t rx, uint8_t ry,
  19. uint16_t rz, uint8_t slider)
  20. : X(x), Y(y), Z(z), Rx(rx), Ry(ry), Rz(rz), Slider(slider) { }
  21. uint16_t X, Y, Rz; // 11bit, 11bit, 10bit
  22. uint8_t Z, Rx, Ry, Slider;
  23. };
  24. #endif // __GAMEPAD_EVENT_DATA_H__