Demo program for LSM303 based boards
Dependencies: mbed AES BLE_API nRF51822 smallAES
Diff: main.cpp
- Revision:
- 3:b9783107a8c4
- Parent:
- 2:4871b5ad7938
- Child:
- 4:4d468d58fc51
--- a/main.cpp Mon Sep 30 10:38:33 2019 +0000 +++ b/main.cpp Mon Sep 30 11:59:42 2019 +0000 @@ -19,6 +19,7 @@ #include "LEDService.h" #include "ButtonAService.h" #include "accelService.h" +#include "magservice.h" /* * All the LEDs on the micro:bit are part of the LED Matrix, @@ -32,12 +33,12 @@ const static char DEVICE_NAME[] = "front1"; //static const uint16_t uuid16_list[] = {LEDService::LED_SERVICE_UUID,ACCELService::ACCEL_SERVICE_UUID,ButtonAService::BUTTONA_SERVICE_UUID}; -static const uint16_t uuid16_list[] = {ACCELService::ACCEL_SERVICE_UUID}; +static const uint16_t uuid16_list[] = {0xA012,0xFFF3}; LEDService *ledServicePtr; ButtonAService * btnAServicePtr; ACCELService *AccelServicePtr; - +MAGService * MagServicePtr; Ticker ticker; void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params) @@ -50,6 +51,7 @@ btnAServicePtr->poll(); AccelServicePtr->poll(); + MagServicePtr->poll(); if (btnAServicePtr->GetButtonAState()) alivenessLED = 1; else @@ -109,6 +111,7 @@ btnAServicePtr = new ButtonAService(ble); int16_t Tst=0; AccelServicePtr = new ACCELService(ble,Tst); + MagServicePtr = new MAGService(ble,Tst); /* setup advertising */ ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list));