Lizzy project
Dependencies: aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT
aconno_ble/aconno_ble.h@0:fc77522f4d28, 2018-03-07 (annotated)
- Committer:
- jurica238814
- Date:
- Wed Mar 07 13:40:28 2018 +0000
- Revision:
- 0:fc77522f4d28
- Child:
- 1:198b9945994e
Init commit.
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" |
jurica238814 | 0:fc77522f4d28 | 13 | |
jurica238814 | 0:fc77522f4d28 | 14 | #define MSD_SIZE_b (10) |
jurica238814 | 0:fc77522f4d28 | 15 | #define ADV_INTERVAL_MS (100) |
jurica238814 | 0:fc77522f4d28 | 16 | #define APPLICATION_ID (0xFFFF0059) //(0xCF170059) |
jurica238814 | 0:fc77522f4d28 | 17 | |
jurica238814 | 0:fc77522f4d28 | 18 | /* Global variables and constants */ |
jurica238814 | 0:fc77522f4d28 | 19 | |
jurica238814 | 0:fc77522f4d28 | 20 | struct __attribute__((packed, aligned(1))) advertising_packet{ |
jurica238814 | 0:fc77522f4d28 | 21 | uint32_t header; |
jurica238814 | 0:fc77522f4d28 | 22 | uint8_t type; |
jurica238814 | 0:fc77522f4d28 | 23 | union{ |
jurica238814 | 0:fc77522f4d28 | 24 | struct{ |
jurica238814 | 0:fc77522f4d28 | 25 | int16_t gyroscope[3]; |
jurica238814 | 0:fc77522f4d28 | 26 | int16_t accelerometer[3]; |
jurica238814 | 0:fc77522f4d28 | 27 | int16_t magnetometer[3]; |
jurica238814 | 0:fc77522f4d28 | 28 | }; |
jurica238814 | 0:fc77522f4d28 | 29 | struct{ |
jurica238814 | 0:fc77522f4d28 | 30 | float temperature; |
jurica238814 | 0:fc77522f4d28 | 31 | float humidity; |
jurica238814 | 0:fc77522f4d28 | 32 | float pressure; |
jurica238814 | 0:fc77522f4d28 | 33 | float light; |
jurica238814 | 0:fc77522f4d28 | 34 | uint8_t battery; |
jurica238814 | 0:fc77522f4d28 | 35 | }; |
jurica238814 | 0:fc77522f4d28 | 36 | }; |
jurica238814 | 0:fc77522f4d28 | 37 | }; |
jurica238814 | 0:fc77522f4d28 | 38 | |
jurica238814 | 0:fc77522f4d28 | 39 | /* Function declarations */ |
jurica238814 | 0:fc77522f4d28 | 40 | void bleInitComplete(BLE::InitializationCompleteCallbackContext *params); |
jurica238814 | 0:fc77522f4d28 | 41 | void updatePayload(BLE *ble, advertising_packet *advertisementPacket); |
jurica238814 | 0:fc77522f4d28 | 42 | |
jurica238814 | 0:fc77522f4d28 | 43 | |
jurica238814 | 0:fc77522f4d28 | 44 | #endif //ACONNO_BLE_H |