forked from pimoroni/picade-max-input
-
Notifications
You must be signed in to change notification settings - Fork 0
/
picade.hpp
37 lines (30 loc) · 961 Bytes
/
picade.hpp
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
#include "pico/stdlib.h"
const int16_t JOYSTICK_LEFT = 0b1000000000000000;
const int16_t JOYSTICK_RIGHT = 0b0100000000000000;
const int16_t JOYSTICK_DOWN = 0b0010000000000000;
const int16_t JOYSTICK_UP = 0b0001000000000000;
const int16_t BUTTON_MASK = 0b0000111111111111;
const uint8_t UTIL_P1_HOTKEY = 0b000001;
const uint8_t UTIL_P2_HOTKEY = 0b000010;
// Deprecated
const uint8_t UTIL_ENTER = 0b000001;
const uint8_t UTIL_ESCAPE = 0b000010;
const uint8_t UTIL_HOTKEY = 0b000100;
const uint8_t UTIL_A = 0b001000;
const uint8_t UTIL_B = 0b010000;
const uint8_t UTIL_C = 0b100000;
struct input_t {
uint16_t p1;
uint16_t p2;
uint8_t util;
int8_t p1_x;
int8_t p1_y;
int8_t p2_x;
int8_t p2_y;
bool changed;
};
bool operator==(const input_t& lhs, const input_t& rhs);
bool operator!=(const input_t& lhs, const input_t& rhs);
void picade_init();
input_t picade_get_input();
extern uint8_t input_debug[8];