29 lines
582 B
C++
29 lines
582 B
C++
#ifndef SDRPI_FPV_CONTROL_GROUND_JOYSTICK_READER_H
|
|
#define SDRPI_FPV_CONTROL_GROUND_JOYSTICK_READER_H
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
#ifdef _WIN32
|
|
#include <SDL.h>
|
|
#else
|
|
#include <SDL2/SDL.h>
|
|
#endif
|
|
|
|
class JoystickReader {
|
|
public:
|
|
JoystickReader(int frequency = 50);
|
|
~JoystickReader();
|
|
|
|
bool initialize();
|
|
bool readData(std::vector<uint16_t>& data);
|
|
std::string getJoystickName() const;
|
|
|
|
private:
|
|
SDL_Joystick* joystick;
|
|
int updateIntervalMs;
|
|
std::string joystickName;
|
|
};
|
|
|
|
#endif //SDRPI_FPV_CONTROL_GROUND_JOYSTICK_READER_H
|