Kenji Arai / TYBLE16_mbedlized_os5_several_examples_1st

Dependencies:   nRF51_Vdd TextLCD BME280

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RCBController.h Source File

RCBController.h

00001 /*
00002  *      Modifed by Kenji Arai on December 31st, 2015
00003  */
00004 
00005 typedef union {
00006     struct  {
00007         /*
00008         1st and 2nd byte: buttom
00009          UP: 0x0001
00010          DOWN: 0x0002
00011          RIGHT: 0x0004
00012          LEFT: 0x0008
00013          Y button: 0x0010
00014          A button: 0x0020
00015          B button: 0x0040
00016          X button: 0x0100
00017          L1: 0x0200
00018          L2: 0x0400
00019          R1: 0x0800
00020          R2: 0x1000
00021          START: 0x0003
00022          SELECT: 0x000C
00023         */
00024         unsigned X      : 1;
00025         unsigned L1     : 1;
00026         unsigned L2     : 1;
00027         unsigned R1     : 1;
00028         unsigned R2     : 1;
00029         unsigned space1 : 3;
00030         unsigned UP     : 1;
00031         unsigned DOWN   : 1;
00032         unsigned RIGHT  : 1;
00033         unsigned LEFT   : 1;
00034         unsigned Y      : 1;
00035         unsigned A      : 1;
00036         unsigned B      : 1;
00037         unsigned space2 : 1;
00038         /*
00039         3rd and 4th byte: Analog value (left side)
00040          Left to Right: 1-255 (Neutral=128)
00041          Down to UP   : 1-255 (Neutral=128)
00042         */
00043         unsigned LeftAnalogLR:8;
00044         unsigned LeftAnalogUD:8;
00045         /*
00046         5th to 6th byte: Analog value (Right side)
00047          Left to Right: 1-255 (Neutral=128)
00048          Down to UP   : 1-255 (Neutral=128)
00049         */
00050         unsigned RightAnalogLR:8;
00051         unsigned RightAnalogUD:8;
00052         /*
00053         7th to 9th byte: Accel
00054          X-axis: 1-255 (Neutral=128)
00055          Y-axis: 1-255 (Neutral=128)
00056          Z-axis: 1-255 (Neutral=128)
00057         */
00058         unsigned AcceleX:8;
00059         unsigned AcceleY:8;
00060         unsigned AcceleZ:8;
00061         /*
00062         10th byte       : Setting parameter
00063          7th and 6th bit: setting accel (0-3)
00064          5th bit        : Analog-Left (0 or 1)
00065          4th bit        : Analog-Right (0 or 1)
00066          3th to 1st bit : iOS device direction (1-4)
00067         */
00068         unsigned DEV_DIR:4;
00069         unsigned RIGHT_ANALOG:1;
00070         unsigned LEFT_ANALOG:1;
00071         unsigned ACCELE_SETTING:2;
00072     } status;
00073     unsigned char data[10];
00074 } RCBController;