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

Original software by jksoft-san. -> /users/jksoft/code/BLE_RCBController2/

Additional functions by robo8080-san. -> /users/robo8080/code/BLE_RCBController2_Motor/

Small modification under latest lib's at this moment (Jan. 1st, 2016)

Hardware: RedBearLab nRF51822 -> /platforms/RedBearLab-nRF51822/

Committer:
kenjiArai
Date:
Wed Oct 11 21:32:18 2017 +0000
Revision:
8:7ab6a5b29812
Parent:
6:1aff9f05d487
changed comment

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kenjiArai 6:1aff9f05d487 1 /*
kenjiArai 6:1aff9f05d487 2 * Modifed by Kenji Arai on December 31st, 2015
kenjiArai 6:1aff9f05d487 3 */
jksoft 1:48f6e08a3ac2 4
jksoft 0:8c643bfe55b7 5 typedef union
jksoft 0:8c643bfe55b7 6 {
jksoft 0:8c643bfe55b7 7 struct {
jksoft 1:48f6e08a3ac2 8 /*
kenjiArai 6:1aff9f05d487 9 1st and 2nd byte: buttom
jksoft 1:48f6e08a3ac2 10  UP: 0x0001
jksoft 1:48f6e08a3ac2 11  DOWN: 0x0002
jksoft 1:48f6e08a3ac2 12  RIGHT: 0x0004
jksoft 1:48f6e08a3ac2 13  LEFT: 0x0008
jksoft 1:48f6e08a3ac2 14  Y button: 0x0010
jksoft 1:48f6e08a3ac2 15  A button: 0x0020
jksoft 1:48f6e08a3ac2 16  B button: 0x0040
jksoft 1:48f6e08a3ac2 17  X button: 0x0100
jksoft 1:48f6e08a3ac2 18  L1: 0x0200
jksoft 1:48f6e08a3ac2 19  L2: 0x0400
jksoft 1:48f6e08a3ac2 20  R1: 0x0800
jksoft 1:48f6e08a3ac2 21  R2: 0x1000
jksoft 1:48f6e08a3ac2 22  START: 0x0003
jksoft 1:48f6e08a3ac2 23  SELECT: 0x000C
jksoft 1:48f6e08a3ac2 24 */
jksoft 1:48f6e08a3ac2 25 unsigned X : 1;
jksoft 1:48f6e08a3ac2 26 unsigned L1 : 1;
jksoft 1:48f6e08a3ac2 27 unsigned L2 : 1;
jksoft 1:48f6e08a3ac2 28 unsigned R1 : 1;
jksoft 1:48f6e08a3ac2 29 unsigned R2 : 1;
jksoft 1:48f6e08a3ac2 30 unsigned space1 : 3;
jksoft 0:8c643bfe55b7 31 unsigned UP : 1;
jksoft 0:8c643bfe55b7 32 unsigned DOWN : 1;
jksoft 0:8c643bfe55b7 33 unsigned RIGHT : 1;
jksoft 0:8c643bfe55b7 34 unsigned LEFT : 1;
jksoft 0:8c643bfe55b7 35 unsigned Y : 1;
jksoft 0:8c643bfe55b7 36 unsigned A : 1;
jksoft 0:8c643bfe55b7 37 unsigned B : 1;
jksoft 1:48f6e08a3ac2 38 unsigned space2 : 1;
jksoft 1:48f6e08a3ac2 39 /*
kenjiArai 6:1aff9f05d487 40 3rd and 4th byte: Analog value (left side)
kenjiArai 6:1aff9f05d487 41  Left to Right: 1-255 (Neutral=128)
kenjiArai 6:1aff9f05d487 42  Down to UP : 1-255 (Neutral=128)
jksoft 1:48f6e08a3ac2 43 */
jksoft 0:8c643bfe55b7 44 unsigned LeftAnalogLR:8;
jksoft 0:8c643bfe55b7 45 unsigned LeftAnalogUD:8;
jksoft 1:48f6e08a3ac2 46 /*
kenjiArai 6:1aff9f05d487 47 5th to 6th byte: Analog value (Right side)
kenjiArai 6:1aff9f05d487 48  Left to Right: 1-255 (Neutral=128)
kenjiArai 6:1aff9f05d487 49  Down to UP : 1-255 (Neutral=128)
jksoft 1:48f6e08a3ac2 50 */
jksoft 0:8c643bfe55b7 51 unsigned RightAnalogLR:8;
jksoft 0:8c643bfe55b7 52 unsigned RightAnalogUD:8;
jksoft 1:48f6e08a3ac2 53 /*
kenjiArai 6:1aff9f05d487 54 7th to 9th byte: Accel
kenjiArai 6:1aff9f05d487 55  X-axis: 1-255 (Neutral=128)
kenjiArai 6:1aff9f05d487 56  Y-axis: 1-255 (Neutral=128)
kenjiArai 6:1aff9f05d487 57  Z-axis: 1-255 (Neutral=128)
jksoft 1:48f6e08a3ac2 58 */
jksoft 0:8c643bfe55b7 59 unsigned AcceleX:8;
jksoft 0:8c643bfe55b7 60 unsigned AcceleY:8;
jksoft 0:8c643bfe55b7 61 unsigned AcceleZ:8;
jksoft 1:48f6e08a3ac2 62 /*
kenjiArai 6:1aff9f05d487 63 10th byte : Setting parameter
kenjiArai 6:1aff9f05d487 64 7th and 6th bit: setting accel (0-3)
kenjiArai 6:1aff9f05d487 65 5th bit : Analog-Left (0 or 1)
kenjiArai 6:1aff9f05d487 66 4th bit : Analog-Right (0 or 1)
kenjiArai 6:1aff9f05d487 67 3th to 1st bit : iOS device direction (1-4)
jksoft 1:48f6e08a3ac2 68 */
jksoft 0:8c643bfe55b7 69 unsigned DEV_DIR:4;
jksoft 0:8c643bfe55b7 70 unsigned RIGHT_ANALOG:1;
jksoft 0:8c643bfe55b7 71 unsigned LEFT_ANALOG:1;
jksoft 0:8c643bfe55b7 72 unsigned ACCELE_SETTING:2;
jksoft 0:8c643bfe55b7 73 }status;
jksoft 0:8c643bfe55b7 74 unsigned char data[10];
kenjiArai 6:1aff9f05d487 75 }RCBController;