Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed nRF51822 circular_buffer
AccelService.h@13:e4c3b3e00e3d, 2016-05-25 (annotated)
- Committer:
- agufal
- Date:
- Wed May 25 13:35:41 2016 +0000
- Revision:
- 13:e4c3b3e00e3d
- Parent:
- 10:8c5a246b9045
implementado bucle principal con un sleep
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| agufal | 9:3708b94b2312 | 1 | #ifndef ACCELSERVICE_H |
| agufal | 9:3708b94b2312 | 2 | #define ACCELSERVICE_H |
| agufal | 9:3708b94b2312 | 3 | |
| agufal | 9:3708b94b2312 | 4 | #include "BLE.h" |
| agufal | 9:3708b94b2312 | 5 | #include "Vector.h" |
| agufal | 9:3708b94b2312 | 6 | |
| agufal | 9:3708b94b2312 | 7 | #define SERVICE_UUID 0xA000 |
| agufal | 9:3708b94b2312 | 8 | #define CHARACTERISTIC_UUID 0xA001 |
| agufal | 13:e4c3b3e00e3d | 9 | #define CALIBRATION_UUID 0xA002 |
| agufal | 9:3708b94b2312 | 10 | |
| agufal | 9:3708b94b2312 | 11 | class AccelService { |
| agufal | 9:3708b94b2312 | 12 | |
| agufal | 9:3708b94b2312 | 13 | public: |
| agufal | 9:3708b94b2312 | 14 | AccelService(); |
| agufal | 9:3708b94b2312 | 15 | void updateAccelState(Vector v); |
| agufal | 9:3708b94b2312 | 16 | |
| agufal | 9:3708b94b2312 | 17 | private: |
| agufal | 9:3708b94b2312 | 18 | GattCharacteristic _accelState; |
| agufal | 10:8c5a246b9045 | 19 | uint8_t _values[6]; // 3 ejes * 2 bytes por eje |
| agufal | 9:3708b94b2312 | 20 | |
| agufal | 9:3708b94b2312 | 21 | static void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params){ |
| agufal | 9:3708b94b2312 | 22 | |
| agufal | 9:3708b94b2312 | 23 | BLE::Instance().gap().startAdvertising(); |
| agufal | 9:3708b94b2312 | 24 | |
| agufal | 9:3708b94b2312 | 25 | } |
| agufal | 9:3708b94b2312 | 26 | |
| agufal | 9:3708b94b2312 | 27 | static void connectionCallback(const Gap::ConnectionCallbackParams_t *params){ |
| agufal | 9:3708b94b2312 | 28 | |
| agufal | 9:3708b94b2312 | 29 | BLE::Instance().gap().stopAdvertising(); |
| agufal | 9:3708b94b2312 | 30 | |
| agufal | 13:e4c3b3e00e3d | 31 | } |
| agufal | 9:3708b94b2312 | 32 | }; |
| agufal | 9:3708b94b2312 | 33 | |
| agufal | 9:3708b94b2312 | 34 | #endif //#ifndef ACCELSERVICE_H |
