Lizzy project
Dependencies: aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT
aconno_ble/aconno_ble.h@8:7ba4f82de9b6, 2018-03-20 (annotated)
- Committer:
- dbartolovic
- Date:
- Tue Mar 20 15:13:51 2018 +0000
- Revision:
- 8:7ba4f82de9b6
- Parent:
- 5:9903738f2587
- Child:
- 9:aef8bb3d13ed
Added lizzy service.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jurica238814 | 0:fc77522f4d28 | 1 | /* |
jurica238814 | 0:fc77522f4d28 | 2 | * Made by Jurica Resetar @ aconno |
jurica238814 | 0:fc77522f4d28 | 3 | * More info @ aconno.de |
jurica238814 | 0:fc77522f4d28 | 4 | * jurica_resetar@yahoo.com |
jurica238814 | 0:fc77522f4d28 | 5 | */ |
jurica238814 | 0:fc77522f4d28 | 6 | |
jurica238814 | 0:fc77522f4d28 | 7 | #ifndef ACONNO_BLE_H |
jurica238814 | 0:fc77522f4d28 | 8 | #define ACONNO_BLE_H |
jurica238814 | 0:fc77522f4d28 | 9 | |
jurica238814 | 0:fc77522f4d28 | 10 | #include "mbed.h" |
jurica238814 | 0:fc77522f4d28 | 11 | #include "ble/BLE.h" |
jurica238814 | 0:fc77522f4d28 | 12 | #include "GapAdvertisingData.h" |
dbartolovic | 8:7ba4f82de9b6 | 13 | #include "lizzy_service.h" |
jurica238814 | 0:fc77522f4d28 | 14 | |
jurica238814 | 0:fc77522f4d28 | 15 | #define MSD_SIZE_b (10) |
jurica238814 | 0:fc77522f4d28 | 16 | #define ADV_INTERVAL_MS (100) |
dbartolovic | 1:198b9945994e | 17 | #define APPLICATION_ID (0xCF170059) //(0xCF170059) |
jurica238814 | 0:fc77522f4d28 | 18 | |
dbartolovic | 8:7ba4f82de9b6 | 19 | #define LSB_VALUE (0x0001) |
dbartolovic | 8:7ba4f82de9b6 | 20 | |
jurica238814 | 0:fc77522f4d28 | 21 | /* Global variables and constants */ |
jurica238814 | 0:fc77522f4d28 | 22 | |
jurica238814 | 0:fc77522f4d28 | 23 | struct __attribute__((packed, aligned(1))) advertising_packet{ |
jurica238814 | 0:fc77522f4d28 | 24 | uint32_t header; |
jurica238814 | 0:fc77522f4d28 | 25 | uint8_t type; |
jurica238814 | 0:fc77522f4d28 | 26 | union{ |
jurica238814 | 0:fc77522f4d28 | 27 | struct{ |
jurica238814 | 0:fc77522f4d28 | 28 | int16_t gyroscope[3]; |
jurica238814 | 0:fc77522f4d28 | 29 | int16_t accelerometer[3]; |
jurica238814 | 0:fc77522f4d28 | 30 | int16_t magnetometer[3]; |
dbartolovic | 5:9903738f2587 | 31 | uint16_t acc_lsb_value; |
jurica238814 | 0:fc77522f4d28 | 32 | }; |
jurica238814 | 0:fc77522f4d28 | 33 | struct{ |
jurica238814 | 0:fc77522f4d28 | 34 | float temperature; |
jurica238814 | 0:fc77522f4d28 | 35 | float humidity; |
jurica238814 | 0:fc77522f4d28 | 36 | float pressure; |
jurica238814 | 0:fc77522f4d28 | 37 | float light; |
jurica238814 | 0:fc77522f4d28 | 38 | uint8_t battery; |
jurica238814 | 0:fc77522f4d28 | 39 | }; |
jurica238814 | 0:fc77522f4d28 | 40 | }; |
jurica238814 | 0:fc77522f4d28 | 41 | }; |
jurica238814 | 0:fc77522f4d28 | 42 | |
dbartolovic | 8:7ba4f82de9b6 | 43 | extern LizzyService *lizzy_service; |
dbartolovic | 8:7ba4f82de9b6 | 44 | |
jurica238814 | 0:fc77522f4d28 | 45 | /* Function declarations */ |
jurica238814 | 0:fc77522f4d28 | 46 | void bleInitComplete(BLE::InitializationCompleteCallbackContext *params); |
jurica238814 | 0:fc77522f4d28 | 47 | void updatePayload(BLE *ble, advertising_packet *advertisementPacket); |
jurica238814 | 0:fc77522f4d28 | 48 | |
jurica238814 | 0:fc77522f4d28 | 49 | |
jurica238814 | 0:fc77522f4d28 | 50 | #endif //ACONNO_BLE_H |