にいむら にいむら
/
mainboardnrp2018
unkounko
Diff: Communication/XBee/XBee.h
- Revision:
- 0:562021ed1ba9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Communication/XBee/XBee.h Sat Jan 13 13:33:09 2018 +0000 @@ -0,0 +1,61 @@ +#ifndef XBEE_H_ +#define XBEE_H_ + +#include <stdint.h> + +namespace XBEE +{ + #define CTR_DATA_LENGTH 4 + #define CTR_DEFAULT_DATA {0x00, 0x00, 0x77, 0x77} + + #define XBEE_TX D1 + #define XBEE_RX D0 + + #define LED_OFF 0 + #define LED_ON 1 + + typedef union + { + struct { + struct { + unsigned int X:1; + unsigned int A:1; + unsigned int B:1; + unsigned int Y:1; + unsigned int UP:1; + unsigned int RIGHT:1; + unsigned int DOWN:1; + unsigned int LEFT:1; + unsigned int SELECT:1; + unsigned int HOME:1; + unsigned int START:1; + unsigned int ZL:1; + unsigned int ZR:1; + unsigned int L:1; + unsigned int R:1; + unsigned int :1; + } __attribute__ ((packed)) Button; + struct { + unsigned int Y:4; + unsigned int X:4; + } __attribute__ ((packed)) AnalogL; + struct { + unsigned int Y:4; + unsigned int X:4; + } __attribute__ ((packed)) AnalogR; + } __attribute__ ((packed)) ; + uint8_t buf[CTR_DATA_LENGTH]; + }ControllerData; + + class Controller + { + public: + static void Initialize(void); + static ControllerData* GetData(void); + static void DataReset(void); + static bool CheckControllerLost(void); + }; +} + +#endif +