TYBLE16 on os5 sample programs
Dependencies: BME280 TextLCD nRF51_Vdd
Fork of TYBLE16_mbedlized_os5_BASE by
Please refer following notebook.
/users/kenjiArai/notebook/tyble16-module-as-mbed-os-5-board-mbedlization/
4_RCBController/RCBController.h@1:9011c83e4178, 2018-04-14 (annotated)
- Committer:
- kenjiArai
- Date:
- Sat Apr 14 04:56:34 2018 +0000
- Revision:
- 1:9011c83e4178
added samples
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kenjiArai | 1:9011c83e4178 | 1 | /* |
kenjiArai | 1:9011c83e4178 | 2 | * Modifed by Kenji Arai on December 31st, 2015 |
kenjiArai | 1:9011c83e4178 | 3 | */ |
kenjiArai | 1:9011c83e4178 | 4 | |
kenjiArai | 1:9011c83e4178 | 5 | typedef union { |
kenjiArai | 1:9011c83e4178 | 6 | struct { |
kenjiArai | 1:9011c83e4178 | 7 | /* |
kenjiArai | 1:9011c83e4178 | 8 | 1st and 2nd byte: buttom |
kenjiArai | 1:9011c83e4178 | 9 | UP: 0x0001 |
kenjiArai | 1:9011c83e4178 | 10 | DOWN: 0x0002 |
kenjiArai | 1:9011c83e4178 | 11 | RIGHT: 0x0004 |
kenjiArai | 1:9011c83e4178 | 12 | LEFT: 0x0008 |
kenjiArai | 1:9011c83e4178 | 13 | Y button: 0x0010 |
kenjiArai | 1:9011c83e4178 | 14 | A button: 0x0020 |
kenjiArai | 1:9011c83e4178 | 15 | B button: 0x0040 |
kenjiArai | 1:9011c83e4178 | 16 | X button: 0x0100 |
kenjiArai | 1:9011c83e4178 | 17 | L1: 0x0200 |
kenjiArai | 1:9011c83e4178 | 18 | L2: 0x0400 |
kenjiArai | 1:9011c83e4178 | 19 | R1: 0x0800 |
kenjiArai | 1:9011c83e4178 | 20 | R2: 0x1000 |
kenjiArai | 1:9011c83e4178 | 21 | START: 0x0003 |
kenjiArai | 1:9011c83e4178 | 22 | SELECT: 0x000C |
kenjiArai | 1:9011c83e4178 | 23 | */ |
kenjiArai | 1:9011c83e4178 | 24 | unsigned X : 1; |
kenjiArai | 1:9011c83e4178 | 25 | unsigned L1 : 1; |
kenjiArai | 1:9011c83e4178 | 26 | unsigned L2 : 1; |
kenjiArai | 1:9011c83e4178 | 27 | unsigned R1 : 1; |
kenjiArai | 1:9011c83e4178 | 28 | unsigned R2 : 1; |
kenjiArai | 1:9011c83e4178 | 29 | unsigned space1 : 3; |
kenjiArai | 1:9011c83e4178 | 30 | unsigned UP : 1; |
kenjiArai | 1:9011c83e4178 | 31 | unsigned DOWN : 1; |
kenjiArai | 1:9011c83e4178 | 32 | unsigned RIGHT : 1; |
kenjiArai | 1:9011c83e4178 | 33 | unsigned LEFT : 1; |
kenjiArai | 1:9011c83e4178 | 34 | unsigned Y : 1; |
kenjiArai | 1:9011c83e4178 | 35 | unsigned A : 1; |
kenjiArai | 1:9011c83e4178 | 36 | unsigned B : 1; |
kenjiArai | 1:9011c83e4178 | 37 | unsigned space2 : 1; |
kenjiArai | 1:9011c83e4178 | 38 | /* |
kenjiArai | 1:9011c83e4178 | 39 | 3rd and 4th byte: Analog value (left side) |
kenjiArai | 1:9011c83e4178 | 40 | Left to Right: 1-255 (Neutral=128) |
kenjiArai | 1:9011c83e4178 | 41 | Down to UP : 1-255 (Neutral=128) |
kenjiArai | 1:9011c83e4178 | 42 | */ |
kenjiArai | 1:9011c83e4178 | 43 | unsigned LeftAnalogLR:8; |
kenjiArai | 1:9011c83e4178 | 44 | unsigned LeftAnalogUD:8; |
kenjiArai | 1:9011c83e4178 | 45 | /* |
kenjiArai | 1:9011c83e4178 | 46 | 5th to 6th byte: Analog value (Right side) |
kenjiArai | 1:9011c83e4178 | 47 | Left to Right: 1-255 (Neutral=128) |
kenjiArai | 1:9011c83e4178 | 48 | Down to UP : 1-255 (Neutral=128) |
kenjiArai | 1:9011c83e4178 | 49 | */ |
kenjiArai | 1:9011c83e4178 | 50 | unsigned RightAnalogLR:8; |
kenjiArai | 1:9011c83e4178 | 51 | unsigned RightAnalogUD:8; |
kenjiArai | 1:9011c83e4178 | 52 | /* |
kenjiArai | 1:9011c83e4178 | 53 | 7th to 9th byte: Accel |
kenjiArai | 1:9011c83e4178 | 54 | X-axis: 1-255 (Neutral=128) |
kenjiArai | 1:9011c83e4178 | 55 | Y-axis: 1-255 (Neutral=128) |
kenjiArai | 1:9011c83e4178 | 56 | Z-axis: 1-255 (Neutral=128) |
kenjiArai | 1:9011c83e4178 | 57 | */ |
kenjiArai | 1:9011c83e4178 | 58 | unsigned AcceleX:8; |
kenjiArai | 1:9011c83e4178 | 59 | unsigned AcceleY:8; |
kenjiArai | 1:9011c83e4178 | 60 | unsigned AcceleZ:8; |
kenjiArai | 1:9011c83e4178 | 61 | /* |
kenjiArai | 1:9011c83e4178 | 62 | 10th byte : Setting parameter |
kenjiArai | 1:9011c83e4178 | 63 | 7th and 6th bit: setting accel (0-3) |
kenjiArai | 1:9011c83e4178 | 64 | 5th bit : Analog-Left (0 or 1) |
kenjiArai | 1:9011c83e4178 | 65 | 4th bit : Analog-Right (0 or 1) |
kenjiArai | 1:9011c83e4178 | 66 | 3th to 1st bit : iOS device direction (1-4) |
kenjiArai | 1:9011c83e4178 | 67 | */ |
kenjiArai | 1:9011c83e4178 | 68 | unsigned DEV_DIR:4; |
kenjiArai | 1:9011c83e4178 | 69 | unsigned RIGHT_ANALOG:1; |
kenjiArai | 1:9011c83e4178 | 70 | unsigned LEFT_ANALOG:1; |
kenjiArai | 1:9011c83e4178 | 71 | unsigned ACCELE_SETTING:2; |
kenjiArai | 1:9011c83e4178 | 72 | } status; |
kenjiArai | 1:9011c83e4178 | 73 | unsigned char data[10]; |
kenjiArai | 1:9011c83e4178 | 74 | } RCBController; |