fork/GramFirmware

git clone https://git.julia.blue/fork/GramFirmware

Skywalker1127Added Up2 to State4f6dbb7

v0.1.2
1.8 KiB82 linesraw
1#ifndef _CORE_STATE_HPP
2#define _CORE_STATE_HPP
3
4#include "stdlib.hpp"
5
6// Button state.
7typedef struct inputstate {
8    // Rectangle inputs.
9    bool left = false;
10    bool right = false;
11    bool down = false;
12    bool up = false;
13    bool up2 = false;
14    bool c_left = false;
15    bool c_right = false;
16    bool c_down = false;
17    bool c_up = false;
18    bool a = false;
19    bool b = false;
20    bool x = false;
21    bool y = false;
22    bool l = false;
23    bool r = false;
24    bool z = false;
25    bool lightshield = false;
26    bool midshield = false;
27    bool select = false;
28    bool start = false;
29    bool home = false;
30    bool mod_x = false;
31    bool mod_y = false;
32
33    // Nunchuk inputs.
34    bool nunchuk_connected = false;
35    int8_t nunchuk_x = 0;
36    int8_t nunchuk_y = 0;
37    bool nunchuk_c = false;
38    bool nunchuk_z = false;
39} InputState;
40
41// State describing stick direction at the quadrant level.
42typedef struct {
43    bool horizontal;
44    bool vertical;
45    bool diagonal;
46    int8_t x;
47    int8_t y;
48    int8_t cx;
49    int8_t cy;
50} StickDirections;
51
52// Output state.
53typedef struct outputstate {
54    // Digital outputs.
55    bool a = false;
56    bool b = false;
57    bool x = false;
58    bool y = false;
59    bool buttonL = false;
60    bool buttonR = false;
61    bool triggerLDigital = false;
62    bool triggerRDigital = false;
63    bool start = false;
64    bool select = false;
65    bool home = false;
66    bool dpadUp = false;
67    bool dpadDown = false;
68    bool dpadLeft = false;
69    bool dpadRight = false;
70    bool leftStickClick = false;
71    bool rightStickClick = false;
72
73    // Analog outputs.
74    uint8_t leftStickX = 128;
75    uint8_t leftStickY = 128;
76    uint8_t rightStickX = 128;
77    uint8_t rightStickY = 128;
78    uint8_t triggerRAnalog = 0;
79    uint8_t triggerLAnalog = 0;
80} OutputState;
81
82#endif