![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
If you wont to knock me down, look this file...
Communication/XBee/XBee.h@0:4df75b08b14a, 2019-05-03 (annotated)
- Committer:
- Ryosei
- Date:
- Fri May 03 11:47:27 2019 +0000
- Revision:
- 0:4df75b08b14a
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ryosei | 0:4df75b08b14a | 1 | #ifndef XBEE_H_ |
Ryosei | 0:4df75b08b14a | 2 | #define XBEE_H_ |
Ryosei | 0:4df75b08b14a | 3 | |
Ryosei | 0:4df75b08b14a | 4 | #include <stdint.h> |
Ryosei | 0:4df75b08b14a | 5 | |
Ryosei | 0:4df75b08b14a | 6 | namespace XBEE |
Ryosei | 0:4df75b08b14a | 7 | { |
Ryosei | 0:4df75b08b14a | 8 | #define CTR_DATA_LENGTH 4 |
Ryosei | 0:4df75b08b14a | 9 | #define CTR_DEFAULT_DATA {0x00, 0x00, 0x77, 0x77} |
Ryosei | 0:4df75b08b14a | 10 | |
Ryosei | 0:4df75b08b14a | 11 | #define XBEE_TX D1 |
Ryosei | 0:4df75b08b14a | 12 | #define XBEE_RX D0 |
Ryosei | 0:4df75b08b14a | 13 | |
Ryosei | 0:4df75b08b14a | 14 | #define LED_OFF 0 |
Ryosei | 0:4df75b08b14a | 15 | #define LED_ON 1 |
Ryosei | 0:4df75b08b14a | 16 | |
Ryosei | 0:4df75b08b14a | 17 | typedef union |
Ryosei | 0:4df75b08b14a | 18 | { |
Ryosei | 0:4df75b08b14a | 19 | struct { |
Ryosei | 0:4df75b08b14a | 20 | struct { |
Ryosei | 0:4df75b08b14a | 21 | unsigned int X:1; |
Ryosei | 0:4df75b08b14a | 22 | unsigned int A:1; |
Ryosei | 0:4df75b08b14a | 23 | unsigned int B:1; |
Ryosei | 0:4df75b08b14a | 24 | unsigned int Y:1; |
Ryosei | 0:4df75b08b14a | 25 | unsigned int UP:1; |
Ryosei | 0:4df75b08b14a | 26 | unsigned int RIGHT:1; |
Ryosei | 0:4df75b08b14a | 27 | unsigned int DOWN:1; |
Ryosei | 0:4df75b08b14a | 28 | unsigned int LEFT:1; |
Ryosei | 0:4df75b08b14a | 29 | unsigned int SELECT:1; |
Ryosei | 0:4df75b08b14a | 30 | unsigned int HOME:1; |
Ryosei | 0:4df75b08b14a | 31 | unsigned int START:1; |
Ryosei | 0:4df75b08b14a | 32 | unsigned int ZL:1; |
Ryosei | 0:4df75b08b14a | 33 | unsigned int ZR:1; |
Ryosei | 0:4df75b08b14a | 34 | unsigned int L:1; |
Ryosei | 0:4df75b08b14a | 35 | unsigned int R:1; |
Ryosei | 0:4df75b08b14a | 36 | unsigned int :1; |
Ryosei | 0:4df75b08b14a | 37 | } __attribute__ ((packed)) Button; |
Ryosei | 0:4df75b08b14a | 38 | struct { |
Ryosei | 0:4df75b08b14a | 39 | unsigned int Y:4; |
Ryosei | 0:4df75b08b14a | 40 | unsigned int X:4; |
Ryosei | 0:4df75b08b14a | 41 | } __attribute__ ((packed)) AnalogL; |
Ryosei | 0:4df75b08b14a | 42 | struct { |
Ryosei | 0:4df75b08b14a | 43 | unsigned int Y:4; |
Ryosei | 0:4df75b08b14a | 44 | unsigned int X:4; |
Ryosei | 0:4df75b08b14a | 45 | } __attribute__ ((packed)) AnalogR; |
Ryosei | 0:4df75b08b14a | 46 | } __attribute__ ((packed)) ; |
Ryosei | 0:4df75b08b14a | 47 | uint8_t buf[CTR_DATA_LENGTH]; |
Ryosei | 0:4df75b08b14a | 48 | }ControllerData; |
Ryosei | 0:4df75b08b14a | 49 | |
Ryosei | 0:4df75b08b14a | 50 | class Controller |
Ryosei | 0:4df75b08b14a | 51 | { |
Ryosei | 0:4df75b08b14a | 52 | public: |
Ryosei | 0:4df75b08b14a | 53 | static void Initialize(void); |
Ryosei | 0:4df75b08b14a | 54 | static ControllerData* GetData(void); |
Ryosei | 0:4df75b08b14a | 55 | static void DataReset(void); |
Ryosei | 0:4df75b08b14a | 56 | static bool CheckControllerLost(void); |
Ryosei | 0:4df75b08b14a | 57 | }; |
Ryosei | 0:4df75b08b14a | 58 | } |
Ryosei | 0:4df75b08b14a | 59 | |
Ryosei | 0:4df75b08b14a | 60 | #endif |
Ryosei | 0:4df75b08b14a | 61 |