-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput.h
38 lines (33 loc) · 1003 Bytes
/
input.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef INPUT_H
#define INPUT_H
#include <sys/types.h>
#include <sys/stat.h>
#include <iostream>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <string>
#include "sensordata.h"
#include "udp.h"
class Input{
public:
Input(UDP *_udp);
bool setupInput();
bool readJoystick();
private:
#define JOYSTICK_EVENT_BUTTON 0x01 // button pressed/released
#define JOYSTICK_EVENT_AXIS 0x02 // joystick moved
#define JOYSTICK_EVENT_INIT 0x80 // initial state of device
struct joystickEvent {
unsigned int time; // event timestamp in milliseconds
short value; // value
unsigned char type; // event type
unsigned char number; // axis/button number
};
struct joystickEvent event;
SENSOR_DATA sensorData;
int inputDevice;
UDP *udp;
};
#endif // INPUT_H