Beacon demo for the BLE API using the nRF51822 native mode drivers
Dependencies: BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1
Fork of BLE_iBeacon by
Diff: main.cpp
- Revision:
- 11:6774f4827024
- Parent:
- 10:391c1acf4b9d
- Child:
- 12:00545c957af4
--- a/main.cpp Thu May 22 10:30:37 2014 +0100 +++ b/main.cpp Thu May 22 11:09:28 2014 +0100 @@ -17,7 +17,7 @@ #include "mbed.h" #include "nRF51822n.h" -nRF51822n nrf; /* BLE radio driver */ +nRF51822n ble; /* BLE radio driver */ DigitalOut mainloopLED(LED1); DigitalOut tickerLED(LED2); @@ -61,8 +61,8 @@ /* Initialise the nRF51822 */ pc.printf("Initialising the nRF51822\n\r"); - nrf.init(); - nrf.reset(); + ble.init(); + ble.reset(); /* Setup advertising data. This includes AD structures in the payload of * advertising packets; and scan-response data. */ @@ -73,13 +73,13 @@ beaconPayload, sizeof(beaconPayload)); GapAdvertisingData scanResponse; - nrf.getGap().setAdvertisingData(advData, scanResponse); + ble.getGap().setAdvertisingData(advData, scanResponse); } /* Start advertising! */ GapAdvertisingParams advParams( GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED); - nrf.getGap().startAdvertising(advParams); + ble.getGap().startAdvertising(advParams); /* Do blinky on mainloopLED while we're waiting for BLE events */ for (;; ) {