fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
818d962
gram
1#ifndef _CORE_STATE_HPP 2#define _CORE_STATE_HPP 3 4#include "stdlib.hpp" 5 6#include <config.pb.h> 7 8typedef struct _InputState { 9// Rectangle inputs. 10union { 11uint64_t buttons = 0 ; 12 13struct { 14bool lf1 :1 ; 15bool lf2 :1 ; 16bool lf3 :1 ; 17bool lf4 :1 ; 18bool lf5 :1 ; 19bool lf6 :1 ; 20bool lf7 :1 ; 21bool lf8 :1 ; 22bool lf9 :1 ; 23bool lf10 :1 ; 24bool lf11 :1 ; 25bool lf12 :1 ; 26bool lf13 :1 ; 27bool lf14 :1 ; 28bool lf15 :1 ; 29bool lf16 :1 ; 30bool rf1 :1 ; 31bool rf2 :1 ; 32bool rf3 :1 ; 33bool rf4 :1 ; 34bool rf5 :1 ; 35bool rf6 :1 ; 36bool rf7 :1 ; 37bool rf8 :1 ; 38bool rf9 :1 ; 39bool rf10 :1 ; 40bool rf11 :1 ; 41bool rf12 :1 ; 42bool rf13 :1 ; 43bool rf14 :1 ; 44bool rf15 :1 ; 45bool rf16 :1 ; 46bool lt1 :1 ; 47bool lt2 :1 ; 48bool lt3 :1 ; 49bool lt4 :1 ; 50bool lt5 :1 ; 51bool lt6 :1 ; 52bool lt7 :1 ; 53bool lt8 :1 ; 54bool rt1 :1 ; 55bool rt2 :1 ; 56bool rt3 :1 ; 57bool rt4 :1 ; 58bool rt5 :1 ; 59bool rt6 :1 ; 60bool rt7 :1 ; 61bool rt8 :1 ; 62bool mb1 :1 ; 63bool mb2 :1 ; 64bool mb3 :1 ; 65bool mb4 :1 ; 66bool mb5 :1 ; 67bool mb6 :1 ; 68bool mb7 :1 ; 69bool mb8 :1 ; 70bool mb9 :1 ; 71bool mb10 :1 ; 72bool mb11 :1 ; 73bool mb12 :1 ; 74 }; 75 }; 76 77// Nunchuk inputs. 78union { 79uint8_t nunchuk_buttons = 0 ; 80 81struct { 82bool nunchuk_connected :1 ; 83bool nunchuk_c :1 ; 84bool nunchuk_z :1 ; 85 }; 86 }; 87 88int8_t nunchuk_x = 0 ; 89int8_t nunchuk_y = 0 ; 90}InputState ; 91 92// State describing stick direction at the quadrant level. 93typedef struct { 94bool horizontal ; 95bool vertical ; 96bool diagonal ; 97int8_t x ; 98int8_t y ; 99int8_t cx ; 100int8_t cy ; 101}StickDirections ; 102 103// Output state. 104typedef struct _OutputState { 105// Digital outputs. 106union { 107uint32_t buttons = 0 ; 108 109struct { 110bool a :1 ; 111bool b :1 ; 112bool x :1 ; 113bool y :1 ; 114bool buttonL :1 ; 115bool buttonR :1 ; 116bool triggerLDigital :1 ; 117bool triggerRDigital :1 ; 118bool start :1 ; 119bool select :1 ; 120bool home :1 ; 121bool capture :1 ; 122bool dpadUp :1 ; 123bool dpadDown :1 ; 124bool dpadLeft :1 ; 125bool dpadRight :1 ; 126bool leftStickClick :1 ; 127bool rightStickClick :1 ; 128 }; 129 }; 130 131// Analog outputs. 132union { 133uint8_t analog_axes [6 ]= {128 ,128 ,128 ,128 ,0 ,0 }; 134 135struct { 136uint8_t leftStickX ; 137uint8_t leftStickY ; 138uint8_t rightStickX ; 139uint8_t rightStickY ; 140uint8_t triggerLAnalog ; 141uint8_t triggerRAnalog ; 142 }; 143 }; 144}OutputState ; 145 146#endif