nRF51822 BLE control program using RCBController(iOS9). Control one LED(on/off), one LED(duty/PWM) and Servo Motor. Compile with latest (as of today) Lib's.

Fork of BLE_RCBController2_Motor by robo 8080

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