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/

RCBController.h

Committer:
kenjiArai
Date:
2017-10-11
Revision:
8:7ab6a5b29812
Parent:
6:1aff9f05d487

File content as of revision 8:7ab6a5b29812:

/*
 *		Modifed by Kenji Arai on December 31st, 2015
 */

typedef union
{
	struct  {
/*
1st and 2nd byte: buttom
 UP: 0x0001
 DOWN: 0x0002
 RIGHT: 0x0004
 LEFT: 0x0008
 Y button: 0x0010
 A button: 0x0020
 B button: 0x0040
 X button: 0x0100
 L1: 0x0200
 L2: 0x0400
 R1: 0x0800
 R2: 0x1000
 START: 0x0003
 SELECT: 0x000C
*/
		unsigned X		: 1;
		unsigned L1		: 1;
		unsigned L2		: 1;
		unsigned R1		: 1;
		unsigned R2		: 1;
		unsigned space1	: 3;
		unsigned UP		: 1;
		unsigned DOWN	: 1;
		unsigned RIGHT	: 1;
		unsigned LEFT	: 1;
		unsigned Y		: 1;
		unsigned A		: 1;
		unsigned B		: 1;
		unsigned space2	: 1;
/*
3rd and 4th byte: Analog value (left side)
 Left to Right: 1-255 (Neutral=128) 
 Down to UP   : 1-255 (Neutral=128)
*/
		unsigned LeftAnalogLR:8;
		unsigned LeftAnalogUD:8;
/*
5th to 6th byte: Analog value (Right side)
 Left to Right: 1-255 (Neutral=128) 
 Down to UP   : 1-255 (Neutral=128)
*/
		unsigned RightAnalogLR:8;
		unsigned RightAnalogUD:8;
/*
7th to 9th byte: Accel
 X-axis: 1-255 (Neutral=128) 
 Y-axis: 1-255 (Neutral=128)
 Z-axis: 1-255 (Neutral=128)
*/
		unsigned AcceleX:8;
		unsigned AcceleY:8;
		unsigned AcceleZ:8;
/*
10th byte       : Setting parameter
 7th and 6th bit: setting accel (0-3)
 5th bit        : Analog-Left (0 or 1)
 4th bit        : Analog-Right (0 or 1)
 3th to 1st bit : iOS device direction (1-4)
*/
		unsigned DEV_DIR:4;
		unsigned RIGHT_ANALOG:1;
		unsigned LEFT_ANALOG:1;
		unsigned ACCELE_SETTING:2;
	}status;
	unsigned char data[10];
}RCBController;