Application running on nRF51822 PCA10001

Dependencies:   BLE_API MMA8652 nRF51822 mbed-src

Committer:
rosterloh84
Date:
Fri Jul 25 14:57:16 2014 +0000
Revision:
1:1c52fb502f6b
Parent:
0:90c13be263a0
Child:
2:2ddac99c3bde
Adding support for LED on PCA10000

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rosterloh84 0:90c13be263a0 1 /*******************************************************************************
rosterloh84 1:1c52fb502f6b 2 * Title : System Initialisation
rosterloh84 0:90c13be263a0 3 * Filename : main.cpp
rosterloh84 0:90c13be263a0 4 * Author : Richard Osterloh
rosterloh84 0:90c13be263a0 5 * Origin Date : 22/07/2014
rosterloh84 0:90c13be263a0 6 * Version : 1.0.0
rosterloh84 0:90c13be263a0 7 * Compiler : mbed compiler
rosterloh84 0:90c13be263a0 8 * Target : Nordic nRF51822
rosterloh84 0:90c13be263a0 9 * Notes : None
rosterloh84 0:90c13be263a0 10 *******************************************************************************/
rosterloh84 0:90c13be263a0 11 /*************** MODULE REVISION LOG ******************************************
rosterloh84 0:90c13be263a0 12 *
rosterloh84 0:90c13be263a0 13 * Date Software Version Initials Description
rosterloh84 0:90c13be263a0 14 * 22/07/2014 1.0.0 RO Module Created.
rosterloh84 0:90c13be263a0 15 *
rosterloh84 0:90c13be263a0 16 *******************************************************************************/
rosterloh84 0:90c13be263a0 17 /** \file main.cpp
rosterloh84 0:90c13be263a0 18 * \brief This module contains the
rosterloh84 0:90c13be263a0 19 */
rosterloh84 0:90c13be263a0 20 /******************************************************************************
rosterloh84 0:90c13be263a0 21 * Includes
rosterloh84 0:90c13be263a0 22 *******************************************************************************/
rosterloh84 0:90c13be263a0 23 #include "mbed.h"
rosterloh84 0:90c13be263a0 24 #include "BLEDevice.h"
rosterloh84 0:90c13be263a0 25 #include "nRF51822n.h"
rosterloh84 0:90c13be263a0 26 //#include "MMA8652.h"
rosterloh84 0:90c13be263a0 27
rosterloh84 0:90c13be263a0 28 /******************************************************************************
rosterloh84 0:90c13be263a0 29 * Module Preprocessor Constants
rosterloh84 0:90c13be263a0 30 *******************************************************************************/
rosterloh84 0:90c13be263a0 31 #define NEED_CONSOLE_OUTPUT 0 /* Set this if you need debug messages on the console;
rosterloh84 0:90c13be263a0 32 * it will have an impact on code-size and power consumption. */
rosterloh84 0:90c13be263a0 33 #if NEED_CONSOLE_OUTPUT
rosterloh84 0:90c13be263a0 34 Serial pc(USBTX, USBRX);
rosterloh84 0:90c13be263a0 35 #define DEBUG(...) { pc.printf(__VA_ARGS__); }
rosterloh84 0:90c13be263a0 36 #else
rosterloh84 0:90c13be263a0 37 #define DEBUG(...) /* nothing */
rosterloh84 0:90c13be263a0 38 #endif /* #if NEED_CONSOLE_OUTPUT */
rosterloh84 0:90c13be263a0 39
rosterloh84 0:90c13be263a0 40 /******************************************************************************
rosterloh84 0:90c13be263a0 41 * Module Preprocessor Macros
rosterloh84 0:90c13be263a0 42 *******************************************************************************/
rosterloh84 0:90c13be263a0 43
rosterloh84 0:90c13be263a0 44 /******************************************************************************
rosterloh84 0:90c13be263a0 45 * Module Typedefs
rosterloh84 0:90c13be263a0 46 *******************************************************************************/
rosterloh84 0:90c13be263a0 47
rosterloh84 0:90c13be263a0 48 /******************************************************************************
rosterloh84 0:90c13be263a0 49 * Module Variable Definitions
rosterloh84 0:90c13be263a0 50 *******************************************************************************/
rosterloh84 1:1c52fb502f6b 51 nRF51822n nrf;
rosterloh84 1:1c52fb502f6b 52 BLEDevice ble;
rosterloh84 1:1c52fb502f6b 53 DigitalOut oneSecondLed(LED1); /* LED1 is toggled every second. */
rosterloh84 1:1c52fb502f6b 54 DigitalOut advertisingStateLed(LED2); /* LED2 is on when we are advertising, otherwise off. */
rosterloh84 1:1c52fb502f6b 55 //AnalogIn adc1(p0_0);
rosterloh84 0:90c13be263a0 56 //MMA8652 acc1(I2C_SDA0, I2C_SCL0);
rosterloh84 1:1c52fb502f6b 57 PwmOut ledr(p21);
rosterloh84 1:1c52fb502f6b 58 PwmOut ledg(p22);
rosterloh84 1:1c52fb502f6b 59 PwmOut ledb(p23);
rosterloh84 0:90c13be263a0 60
rosterloh84 0:90c13be263a0 61 const static char DEVICE_NAME[] = "Buddi Blueband";
rosterloh84 0:90c13be263a0 62
rosterloh84 0:90c13be263a0 63 // https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.device_information.xml
rosterloh84 0:90c13be263a0 64 // Manufacturer Name String
rosterloh84 0:90c13be263a0 65 static char vendor[] = "Buddi Ltd.";
rosterloh84 0:90c13be263a0 66 GattCharacteristic vendorChar(GattCharacteristic::UUID_MANUFACTURER_NAME_STRING_CHAR, (uint8_t *)vendor, sizeof(vendor), sizeof(vendor),
rosterloh84 0:90c13be263a0 67 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
rosterloh84 0:90c13be263a0 68 // Model Number String
rosterloh84 0:90c13be263a0 69 static char model[] = "BlueBand";
rosterloh84 0:90c13be263a0 70 GattCharacteristic modelChar(GattCharacteristic::UUID_MODEL_NUMBER_STRING_CHAR, (uint8_t *)model, sizeof(model), sizeof(model),
rosterloh84 0:90c13be263a0 71 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
rosterloh84 0:90c13be263a0 72 // Serial Number String
rosterloh84 0:90c13be263a0 73 static char serial[] = "1234567890";
rosterloh84 0:90c13be263a0 74 GattCharacteristic serialChar(GattCharacteristic::UUID_SERIAL_NUMBER_STRING_CHAR, (uint8_t *)serial, sizeof(serial), sizeof(serial),
rosterloh84 0:90c13be263a0 75 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
rosterloh84 0:90c13be263a0 76 // Hardware Revision String
rosterloh84 0:90c13be263a0 77 static char hwversion[] = "Hardware: 0";
rosterloh84 0:90c13be263a0 78 GattCharacteristic hwChar(GattCharacteristic::UUID_HARDWARE_REVISION_STRING_CHAR, (uint8_t *)hwversion, sizeof(hwversion), sizeof(hwversion),
rosterloh84 0:90c13be263a0 79 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
rosterloh84 0:90c13be263a0 80 // Firmware Revision String
rosterloh84 0:90c13be263a0 81 static char fwversion[] = "Firmware: 0001";
rosterloh84 0:90c13be263a0 82 GattCharacteristic fwChar(GattCharacteristic::UUID_FIRMWARE_REVISION_STRING_CHAR, (uint8_t *)fwversion, sizeof(fwversion), sizeof(fwversion),
rosterloh84 0:90c13be263a0 83 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
rosterloh84 0:90c13be263a0 84 // Software Revision String
rosterloh84 0:90c13be263a0 85 static char swversion[] = "Build: 0001";
rosterloh84 0:90c13be263a0 86 GattCharacteristic swChar(GattCharacteristic::UUID_SOFTWARE_REVISION_STRING_CHAR, (uint8_t *)swversion, sizeof(swversion), sizeof(swversion),
rosterloh84 0:90c13be263a0 87 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
rosterloh84 0:90c13be263a0 88 // System ID
rosterloh84 0:90c13be263a0 89 static char systemId = 'A';
rosterloh84 0:90c13be263a0 90 GattCharacteristic systemID(GattCharacteristic::UUID_SYSTEM_ID_CHAR, (uint8_t *)systemId, sizeof(systemId), sizeof(systemId),
rosterloh84 0:90c13be263a0 91 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ);
rosterloh84 0:90c13be263a0 92 GattCharacteristic *devInfoChars[] = {&vendorChar, &modelChar, &serialChar, &hwChar, &fwChar, &swChar, &systemID };
rosterloh84 0:90c13be263a0 93 GattService devInfoService(GattService::UUID_DEVICE_INFORMATION_SERVICE, devInfoChars, sizeof(devInfoChars) / sizeof(GattCharacteristic *));
rosterloh84 0:90c13be263a0 94
rosterloh84 0:90c13be263a0 95 // https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml
rosterloh84 0:90c13be263a0 96 static uint8_t batteryLevel = 100;
rosterloh84 0:90c13be263a0 97 GattCharacteristic batteryPercentage(GattCharacteristic::UUID_BATTERY_LEVEL_CHAR, (uint8_t *)batteryLevel, sizeof(batteryLevel), sizeof(batteryLevel),
rosterloh84 0:90c13be263a0 98 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY);
rosterloh84 0:90c13be263a0 99 GattCharacteristic *batteryChars[] = {&batteryPercentage };
rosterloh84 0:90c13be263a0 100 GattService batteryService(GattService::UUID_BATTERY_SERVICE, batteryChars, sizeof(batteryChars) / sizeof(GattCharacteristic *));
rosterloh84 0:90c13be263a0 101
rosterloh84 1:1c52fb502f6b 102 // Custom Buddi Service 0x92d7dc20-ba55-4df8-84b1-ad8af6e1ea4a
rosterloh84 1:1c52fb502f6b 103 static const uint8_t buddi_service_uuid[] = {0x92, 0xd7, 0xdc, 0x20, 0xba, 0x55, 0x4d, 0xf8, 0x84, 0xb1, 0xad, 0x8a, 0xf6, 0xe1, 0xea, 0x4a};
rosterloh84 1:1c52fb502f6b 104 // Command Characteristic
rosterloh84 1:1c52fb502f6b 105 static const uint8_t command_uuid[] = {0x92, 0xd7, 0xdc, 0x20, 0xbb, 0x01, 0x4d, 0xf8, 0x84, 0xb1, 0xad, 0x8a, 0xf6, 0xe1, 0xea, 0x4a};
rosterloh84 1:1c52fb502f6b 106 uint8_t commandPayload[8] = {0,};
rosterloh84 1:1c52fb502f6b 107 GattCharacteristic commandCharacteristic (command_uuid, commandPayload, 1, 8,
rosterloh84 1:1c52fb502f6b 108 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE);
rosterloh84 1:1c52fb502f6b 109 // Notification Characteristic
rosterloh84 1:1c52fb502f6b 110 static const uint8_t notification_uuid[] = {0x92, 0xd7, 0xdc, 0x20, 0xbb, 0x02, 0x4d, 0xf8, 0x84, 0xb1, 0xad, 0x8a, 0xf6, 0xe1, 0xea, 0x4a};
rosterloh84 1:1c52fb502f6b 111 uint8_t notificationPayload[8] = {0,};
rosterloh84 1:1c52fb502f6b 112 GattCharacteristic notificationCharacteristic (notification_uuid, notificationPayload, 1, 8,
rosterloh84 1:1c52fb502f6b 113 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY);
rosterloh84 1:1c52fb502f6b 114 GattCharacteristic *buddiChars[] = {&commandCharacteristic, &notificationCharacteristic};
rosterloh84 1:1c52fb502f6b 115 GattService buddiService(buddi_service_uuid, buddiChars, sizeof(buddiChars) / sizeof(GattCharacteristic *));
rosterloh84 1:1c52fb502f6b 116
rosterloh84 1:1c52fb502f6b 117 //static const uint8_t dev_info_uuid_rev[] = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x0a, 0x18, 0x00, 0x00}; // 0000180a-0000-1000-8000-00805f9b34fb
rosterloh84 1:1c52fb502f6b 118 //static const uint8_t battery_uuid_rev[] = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x0f, 0x18, 0x00, 0x00}; // 0000180f-0000-1000-8000-00805f9b34fb
rosterloh84 1:1c52fb502f6b 119 //static const uint8_t buddi_service_uuid_rev[] = {0x4a, 0xea, 0xe1, 0xf6, 0x8a, 0xad, 0xb1, 0x84, 0xf8, 0x4d, 0x55, 0xba, 0x20, 0xdc, 0xd7, 0x92}; // 92d7dc20-ba55-4df8-84b1-ad8af6e1ea4a
rosterloh84 1:1c52fb502f6b 120
rosterloh84 0:90c13be263a0 121 static const uint16_t uuid16_list[] = {GattService::UUID_DEVICE_INFORMATION_SERVICE,
rosterloh84 0:90c13be263a0 122 GattService::UUID_BATTERY_SERVICE};
rosterloh84 1:1c52fb502f6b 123 //static const unit8_t uuid128_list[] = {(const uint8_t *)buddi_service_uuid_rev,
rosterloh84 1:1c52fb502f6b 124 // (const uint8_t *)buddi_service_uuid_rev,
rosterloh84 1:1c52fb502f6b 125 // (const uint8_t *)buddi_service_uuid_rev};
rosterloh84 0:90c13be263a0 126
rosterloh84 1:1c52fb502f6b 127 float r = 0.0f;
rosterloh84 1:1c52fb502f6b 128 float g = 0.0f;
rosterloh84 1:1c52fb502f6b 129 float b = 0.0f;
rosterloh84 1:1c52fb502f6b 130
rosterloh84 0:90c13be263a0 131 /******************************************************************************
rosterloh84 0:90c13be263a0 132 * Function Prototypes
rosterloh84 0:90c13be263a0 133 *******************************************************************************/
rosterloh84 0:90c13be263a0 134
rosterloh84 0:90c13be263a0 135 /******************************************************************************
rosterloh84 0:90c13be263a0 136 * Function Definitions
rosterloh84 0:90c13be263a0 137 *******************************************************************************/
rosterloh84 0:90c13be263a0 138 void timeoutCallback(void)
rosterloh84 0:90c13be263a0 139 {
rosterloh84 0:90c13be263a0 140 DEBUG("Timeout!\r\n");
rosterloh84 0:90c13be263a0 141 }
rosterloh84 0:90c13be263a0 142
rosterloh84 0:90c13be263a0 143 void connectionCallback(void)
rosterloh84 0:90c13be263a0 144 {
rosterloh84 0:90c13be263a0 145 DEBUG("Connection\n\r");
rosterloh84 0:90c13be263a0 146 advertisingStateLed = 0;
rosterloh84 0:90c13be263a0 147 }
rosterloh84 0:90c13be263a0 148
rosterloh84 0:90c13be263a0 149 void disconnectionCallback(void)
rosterloh84 0:90c13be263a0 150 {
rosterloh84 0:90c13be263a0 151 DEBUG("Disconnected!\r\n");
rosterloh84 0:90c13be263a0 152 DEBUG("Restarting the advertising process\r\n");
rosterloh84 0:90c13be263a0 153 ble.startAdvertising();
rosterloh84 0:90c13be263a0 154 advertisingStateLed = 1;
rosterloh84 0:90c13be263a0 155 }
rosterloh84 0:90c13be263a0 156
rosterloh84 1:1c52fb502f6b 157 void onDataWritten(uint16_t charHandle)
rosterloh84 1:1c52fb502f6b 158 {
rosterloh84 1:1c52fb502f6b 159 if (charHandle == commandCharacteristic.getHandle()) {
rosterloh84 1:1c52fb502f6b 160 DEBUG("onDataWritten()\n\r");
rosterloh84 1:1c52fb502f6b 161 uint16_t bytesRead;
rosterloh84 1:1c52fb502f6b 162 ble.readCharacteristicValue(commandCharacteristic.getHandle(), commandPayload, &bytesRead);
rosterloh84 1:1c52fb502f6b 163 DEBUG("ECHO: %s\n\r", (char *)commandPayload);
rosterloh84 1:1c52fb502f6b 164 ble.updateCharacteristicValue(notificationCharacteristic.getHandle(), commandPayload, bytesRead);
rosterloh84 1:1c52fb502f6b 165 }
rosterloh84 1:1c52fb502f6b 166 }
rosterloh84 1:1c52fb502f6b 167
rosterloh84 0:90c13be263a0 168 /**
rosterloh84 0:90c13be263a0 169 * Triggered periodically by the 'ticker' interrupt
rosterloh84 0:90c13be263a0 170 */
rosterloh84 0:90c13be263a0 171 void periodicCallback(void)
rosterloh84 0:90c13be263a0 172 {
rosterloh84 0:90c13be263a0 173 oneSecondLed = !oneSecondLed; /* Do blinky on LED1 while we're waiting for BLE events */
rosterloh84 0:90c13be263a0 174
rosterloh84 0:90c13be263a0 175 if (ble.getGapState().connected) {
rosterloh84 0:90c13be263a0 176 /* Update the battery measurement */
rosterloh84 1:1c52fb502f6b 177 //batteryLevel = adc1.read_u16()&0x0FFF) * 3.3/4096;
rosterloh84 0:90c13be263a0 178 batteryLevel--;
rosterloh84 0:90c13be263a0 179 if (batteryLevel == 1) {
rosterloh84 0:90c13be263a0 180 batteryLevel = 100;
rosterloh84 0:90c13be263a0 181 }
rosterloh84 1:1c52fb502f6b 182 //ble.updateCharacteristicValue(batteryPercentage.getHandle(), &batteryLevel, sizeof(batteryLevel));
rosterloh84 1:1c52fb502f6b 183 }
rosterloh84 1:1c52fb502f6b 184
rosterloh84 1:1c52fb502f6b 185 if(r <= 1.0f) {
rosterloh84 1:1c52fb502f6b 186 r += 0.1f;
rosterloh84 1:1c52fb502f6b 187 } else {
rosterloh84 1:1c52fb502f6b 188 r = 0.0f;
rosterloh84 0:90c13be263a0 189 }
rosterloh84 1:1c52fb502f6b 190 ledr = r;
rosterloh84 1:1c52fb502f6b 191
rosterloh84 1:1c52fb502f6b 192 if(g <= 1.0f) {
rosterloh84 1:1c52fb502f6b 193 g += 0.2f;
rosterloh84 1:1c52fb502f6b 194 } else {
rosterloh84 1:1c52fb502f6b 195 g = 0.0f;
rosterloh84 1:1c52fb502f6b 196 }
rosterloh84 1:1c52fb502f6b 197 ledg = g;
rosterloh84 1:1c52fb502f6b 198
rosterloh84 1:1c52fb502f6b 199 if(b <= 1.0f) {
rosterloh84 1:1c52fb502f6b 200 b += 0.3f;
rosterloh84 1:1c52fb502f6b 201 } else {
rosterloh84 1:1c52fb502f6b 202 b = 0.0f;
rosterloh84 1:1c52fb502f6b 203 }
rosterloh84 1:1c52fb502f6b 204 ledb = b;
rosterloh84 0:90c13be263a0 205 }
rosterloh84 0:90c13be263a0 206
rosterloh84 0:90c13be263a0 207 int main(void)
rosterloh84 0:90c13be263a0 208 {
rosterloh84 0:90c13be263a0 209 //float acc_data[3];
rosterloh84 0:90c13be263a0 210 //int16_t acc_raw[3];
rosterloh84 0:90c13be263a0 211
rosterloh84 0:90c13be263a0 212 oneSecondLed = 1;
rosterloh84 0:90c13be263a0 213 Ticker ticker;
rosterloh84 0:90c13be263a0 214 ticker.attach(periodicCallback, 1);
rosterloh84 0:90c13be263a0 215 /*
rosterloh84 0:90c13be263a0 216 DEBUG("MMA8652 Acc = %X\r\n", acc1.getWhoAmI());
rosterloh84 0:90c13be263a0 217 acc1.ReadXYZ(acc_data);
rosterloh84 0:90c13be263a0 218 acc1.ReadXYZraw(acc_raw);
rosterloh84 0:90c13be263a0 219 DEBUG("MMA8652 Acc: X:%1.3f Y:%1.3f Z:%1.3f (Raw X:%3d Y:%3d Z:%3d)\r\n", acc_data[0], acc_data[1], acc_data[2], acc_raw[0], acc_raw[1], acc_raw[2]);
rosterloh84 0:90c13be263a0 220 */
rosterloh84 0:90c13be263a0 221 DEBUG("Initialising the nRF51822\r\n");
rosterloh84 0:90c13be263a0 222 ble.init(); /* Initialise the nRF51822 */
rosterloh84 0:90c13be263a0 223 //ble.onTimeout(timeoutCallback);
rosterloh84 0:90c13be263a0 224 ble.onConnection(connectionCallback);
rosterloh84 0:90c13be263a0 225 ble.onDisconnection(disconnectionCallback);
rosterloh84 1:1c52fb502f6b 226 //ble.onDataSent(onDataSent);
rosterloh84 1:1c52fb502f6b 227 ble.onDataWritten(onDataWritten);
rosterloh84 1:1c52fb502f6b 228 //ble.onUpdatesEnabled(onUpdatesEnabled);
rosterloh84 1:1c52fb502f6b 229 //ble.onUpdatesDisabled(onUpdatesDisabled);
rosterloh84 1:1c52fb502f6b 230 //ble.onConfirmationReceived(onConfirmationReceived);
rosterloh84 0:90c13be263a0 231
rosterloh84 0:90c13be263a0 232 /* setup advertising */
rosterloh84 0:90c13be263a0 233 ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
rosterloh84 1:1c52fb502f6b 234 ble.accumulateAdvertisingPayload(GapAdvertisingData::INCOMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t*)uuid16_list, sizeof(uuid16_list));
rosterloh84 0:90c13be263a0 235 ble.accumulateAdvertisingPayload(GapAdvertisingData::GENERIC_WATCH);
rosterloh84 0:90c13be263a0 236 ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
rosterloh84 0:90c13be263a0 237 //ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
rosterloh84 1:1c52fb502f6b 238 //ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS, (uint8_t*)uuid128_list, sizeof(uuid128_list));
rosterloh84 0:90c13be263a0 239
rosterloh84 0:90c13be263a0 240 ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
rosterloh84 0:90c13be263a0 241 ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */
rosterloh84 0:90c13be263a0 242 ble.startAdvertising();
rosterloh84 0:90c13be263a0 243 advertisingStateLed = 1;
rosterloh84 0:90c13be263a0 244
rosterloh84 0:90c13be263a0 245 ble.addService(devInfoService);
rosterloh84 0:90c13be263a0 246 ble.addService(batteryService);
rosterloh84 1:1c52fb502f6b 247 ble.addService(buddiService);
rosterloh84 0:90c13be263a0 248
rosterloh84 0:90c13be263a0 249 while (true) {
rosterloh84 0:90c13be263a0 250 ble.waitForEvent();
rosterloh84 0:90c13be263a0 251 }
rosterloh84 0:90c13be263a0 252 }