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
ble_config.h@0:095b19b8fb7e, 2019-03-07 (annotated)
- Committer:
- Rogercl
- Date:
- Thu Mar 07 23:30:19 2019 +0000
- Revision:
- 0:095b19b8fb7e
Modificado o BLE para facilitacao dos testes.; ; Necessario Debugar para encontrar problemas.
Who changed what in which revision?
User | Revision | Line number | New 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 |