I have some functional code working on an Adafruit nRF52 Feather board which I am trying to change over to run in embedded C on an nRF51 dongle. I am using Adafruit nRF52 feather library in the Arduino IDE. I have pulled out the below code from the Arduino IDE which I am having trouble understanding fully. I have been through a number of examples but can't work it out.
I have found some of the functions in the nRF5 SDK but am getting confused with the different formats used and was unsure as to the best approach. There are 5 other BLEcharacteristics for other functions such as "mute", so figured I should be creating a structure to hold all of the data for each characteristic?
The adafruit library for arduino is at : github.com/.../Adafruit_nRF52_Arduino
TIA
William
**********************************************************************************************************************
//Lock
uint8_t BLECharacteristic1[] =
{
0x00, 0x00, 0xaa, 0xa1, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
};
BLECharacteristic lockScreen = BLECharacteristic(BLECharacteristic1);
lockScreen.setProperties(CHR_PROPS_READ | CHR_PROPS_WRITE | CHR_PROPS_NOTIFY);
lockScreen.setPermission(SECMODE_OPEN, SECMODE_OPEN);
lockScreen.setMaxLen(5);
lockScreen.setStringDescriptor("");//lockscreen
lockScreen.begin();
lockScreen.write("none");
//Set Buffer, read characteristic value, output current value to serial monitor
char lockScreenBuffer[5] = { 0 };
//lock password initialization
char lockScreenPassword[5] = {"krs1"}; //lock
lockScreen.read(lockScreenBuffer, sizeof(lockScreenBuffer));
**************************************************************************************************************************