Algoritmo funcionando com a biblioteca de inatividade utilizando dos dados do acelerômetro e a biblioteca de PeakSearch se utilizando dos dados filtrados pelo filtro Kalman.

Dependencies:   mbed MatrixMath Matrix nrf51_rtc BMP180 MPU9250

Committer:
Rogercl
Date:
Sun Aug 04 11:38:08 2019 +0000
Revision:
6:e9a2bc040ada
Parent:
0:095b19b8fb7e
Algoritmo funcionando com a biblioteca de inatividade utilizando dos dados do acelerometro e a biblioteca de PeakSearch se utilizando dos dados filtrados pelo filtro Kalman.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rogercl 0:095b19b8fb7e 1 #ifndef BLECONFIG_H
Rogercl 0:095b19b8fb7e 2 #define BLECONFIG_H
Rogercl 0:095b19b8fb7e 3
Rogercl 0:095b19b8fb7e 4 #include "mbed.h"
Rogercl 0:095b19b8fb7e 5
Rogercl 0:095b19b8fb7e 6
Rogercl 0:095b19b8fb7e 7
Rogercl 0:095b19b8fb7e 8 static EventQueue eventQueue(
Rogercl 0:095b19b8fb7e 9 /* event count */ 16 * /* event size */ 32
Rogercl 0:095b19b8fb7e 10 );
Rogercl 0:095b19b8fb7e 11
Rogercl 0:095b19b8fb7e 12 void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params)
Rogercl 0:095b19b8fb7e 13 {
Rogercl 0:095b19b8fb7e 14 BLE::Instance().gap().startAdvertising();
Rogercl 0:095b19b8fb7e 15 }
Rogercl 0:095b19b8fb7e 16 /**
Rogercl 0:095b19b8fb7e 17 * Callback triggered when the ble initialization process has finished
Rogercl 0:095b19b8fb7e 18 */
Rogercl 0:095b19b8fb7e 19 void bleInitComplete(BLE::InitializationCompleteCallbackContext *params)
Rogercl 0:095b19b8fb7e 20 {
Rogercl 0:095b19b8fb7e 21 BLE& ble = params->ble;
Rogercl 0:095b19b8fb7e 22
Rogercl 0:095b19b8fb7e 23
Rogercl 0:095b19b8fb7e 24 /* Ensure that it is the default instance of BLE */
Rogercl 0:095b19b8fb7e 25 if(ble.getInstanceID() != BLE::DEFAULT_INSTANCE) {
Rogercl 0:095b19b8fb7e 26 return;
Rogercl 0:095b19b8fb7e 27 }
Rogercl 0:095b19b8fb7e 28 ble.gap().onDisconnection(disconnectionCallback);
Rogercl 0:095b19b8fb7e 29
Rogercl 0:095b19b8fb7e 30 /* Setup primary service */
Rogercl 0:095b19b8fb7e 31 uart = new UARTService(ble);
Rogercl 0:095b19b8fb7e 32
Rogercl 0:095b19b8fb7e 33 /* Setup advertising */
Rogercl 0:095b19b8fb7e 34 ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS,(const uint8_t *)UARTServiceUUID_reversed, sizeof(UARTServiceUUID_reversed));
Rogercl 0:095b19b8fb7e 35 ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME,(const uint8_t *)"MARe", sizeof("MARe") - 1);
Rogercl 0:095b19b8fb7e 36 ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
Rogercl 0:095b19b8fb7e 37 ble.gap().setAdvertisingInterval(100);
Rogercl 0:095b19b8fb7e 38 ble.gap().startAdvertising();
Rogercl 0:095b19b8fb7e 39 }
Rogercl 0:095b19b8fb7e 40
Rogercl 0:095b19b8fb7e 41 void scheduleBleEventsProcessing(BLE::OnEventsToProcessCallbackContext* context) {
Rogercl 0:095b19b8fb7e 42 BLE &ble = BLE::Instance();
Rogercl 0:095b19b8fb7e 43 eventQueue.call(Callback<void()>(&ble, &BLE::processEvents));
Rogercl 0:095b19b8fb7e 44 }
Rogercl 0:095b19b8fb7e 45
Rogercl 0:095b19b8fb7e 46 #endif