-
Notifications
You must be signed in to change notification settings - Fork 16
/
Wiimote.h
38 lines (31 loc) · 956 Bytes
/
Wiimote.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 _WIIMOTE_H_
#define _WIIMOTE_H_
#include <cstdint>
enum wiimote_event_type_t {
WIIMOTE_EVENT_INITIALIZE,
WIIMOTE_EVENT_SCAN_START,
WIIMOTE_EVENT_SCAN_STOP,
WIIMOTE_EVENT_CONNECT,
WIIMOTE_EVENT_DISCONNECT,
WIIMOTE_EVENT_DATA
};
enum balance_position_type_t {
BALANCE_POSITION_TOP_RIGHT,
BALANCE_POSITION_BOTTOM_RIGHT,
BALANCE_POSITION_TOP_LEFT,
BALANCE_POSITION_BOTTOM_LEFT,
};
typedef void (* wiimote_callback_t)(wiimote_event_type_t event_type, uint16_t handle, uint8_t *data, size_t len);
class Wiimote {
public:
void init(wiimote_callback_t cb);
void handle();
void scan(bool enable);
void _callback(wiimote_event_type_t event_type, uint16_t handle, uint8_t *data, size_t len);
void set_led(uint16_t handle, uint8_t leds);
void set_rumble(uint16_t handle, bool rumble);
void get_balance_weight(uint8_t *data, float *weight);
private:
wiimote_callback_t _wiimote_callback;
};
#endif