Taiki Maruyama
/
MainBoard2018_Auto_Master_A_neww
aaaaaaaaa
Fork of MainBoard2018_Auto_Master_A_new by
Embed:
(wiki syntax)
Show/hide line numbers
Controller.h
00001 #ifndef CONTROLLER_H_ 00002 #define CONTROLLER_H_ 00003 00004 #include <stdint.h> 00005 00006 namespace CONTROLLER { 00007 #define MU_TX PC_6 00008 #define MU_RX PC_7 00009 00010 #define CTR_DATA_LENGTH 4 00011 #define CTR_DEFAULT_DATA {0x00, 0x00, 0x77, 0x77} 00012 00013 typedef union 00014 { 00015 struct { 00016 struct { 00017 unsigned int X:1; 00018 unsigned int A:1; 00019 unsigned int B:1; 00020 unsigned int Y:1; 00021 unsigned int UP:1; 00022 unsigned int RIGHT:1; 00023 unsigned int DOWN:1; 00024 unsigned int LEFT:1; 00025 unsigned int SELECT:1; 00026 unsigned int HOME:1; 00027 unsigned int START:1; 00028 unsigned int ZL:1; 00029 unsigned int ZR:1; 00030 unsigned int L:1; 00031 unsigned int R:1; 00032 unsigned int :1; 00033 } __attribute__ ((packed)) Button; 00034 struct { 00035 unsigned int Y:4; 00036 unsigned int X:4; 00037 } __attribute__ ((packed)) AnalogL; 00038 struct { 00039 unsigned int Y:4; 00040 unsigned int X:4; 00041 } __attribute__ ((packed)) AnalogR; 00042 } __attribute__ ((packed)) ; 00043 uint8_t buf[CTR_DATA_LENGTH]; 00044 }ControllerData; 00045 00046 class Controller 00047 { 00048 public: 00049 static void Initialize(void); 00050 static ControllerData* GetData(void); 00051 static void DataReset(void); 00052 static bool CheckControllerLost(void); 00053 }; 00054 } 00055 00056 #endif
Generated on Wed Jul 13 2022 01:10:06 by 1.7.2