Dead by Daylight

Dependencies:   mbed Servo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers XBee.h Source File

XBee.h

00001 #ifndef XBEE_H_
00002 #define XBEE_H_
00003 
00004 #include <stdint.h>
00005 
00006 namespace XBEE
00007 {
00008     #define CTR_DATA_LENGTH 4
00009     #define CTR_DEFAULT_DATA {0x00, 0x00, 0x77, 0x77}
00010 
00011     #define XBEE_TX D1
00012     #define XBEE_RX D0
00013 
00014     #define LED_OFF 0
00015     #define LED_ON  1
00016 
00017     typedef union 
00018     {
00019         struct {
00020             struct {
00021                 unsigned int X:1;
00022                 unsigned int A:1;
00023                 unsigned int B:1;
00024                 unsigned int Y:1;
00025                 unsigned int UP:1;
00026                 unsigned int RIGHT:1;
00027                 unsigned int DOWN:1;
00028                 unsigned int LEFT:1;
00029                 unsigned int SELECT:1;
00030                 unsigned int HOME:1;
00031                 unsigned int START:1;
00032                 unsigned int ZL:1;
00033                 unsigned int ZR:1;
00034                 unsigned int L:1;
00035                 unsigned int R:1;
00036                 unsigned int :1;
00037             } __attribute__ ((packed)) Button;
00038             struct {
00039                 unsigned int Y:4;
00040                 unsigned int X:4;
00041             } __attribute__ ((packed)) AnalogL;
00042             struct {
00043                 unsigned int Y:4;
00044                 unsigned int X:4;
00045             } __attribute__ ((packed)) AnalogR;
00046         } __attribute__ ((packed)) ;
00047         uint8_t buf[CTR_DATA_LENGTH];       
00048     }ControllerData;
00049     
00050     class Controller
00051     {
00052         public:
00053             static void Initialize(void);
00054             static ControllerData* GetData(void);
00055             static void DataReset(void);
00056             static bool CheckControllerLost(void);
00057     };
00058 }
00059 
00060 #endif
00061