Mercurial > public > ostc4
comparison Discovery/Inc/cv_heartbeat.h @ 1037:2af07aa38531 GasConsumption
Merge with external development branches:
Some features have been prepared for integration: Profiles, DMA UART on Firmware part, Bluetooth discovery and messges logging for development phase. All these new function are deactivated by compile switch and may be activated using the configuration.h for testing purpose.
| author | Ideenmodellierer |
|---|---|
| date | Mon, 15 Sep 2025 21:12:44 +0200 |
| parents | 195bfbdf961d |
| children |
comparison
equal
deleted
inserted
replaced
| 1029:e938901f6386 | 1037:2af07aa38531 |
|---|---|
| 1 /////////////////////////////////////////////////////////////////////////////// | |
| 2 /// -*- coding: UTF-8 -*- | |
| 3 /// | |
| 4 /// \file Discovery/Inc/cv_heartbeat.h | |
| 5 /// \brief Function definitions for connecting to a Polar HC10 heartbeat sensor | |
| 6 /// \date 3 July 2025 | |
| 7 | |
| 8 /////////////////////////////////////////////////////////////////////////////// | |
| 9 /// \par Copyright (c) 2014-2015 Heinrichs Weikamp gmbh | |
| 10 /// | |
| 11 /// This program is free software: you can redistribute it and/or modify | |
| 12 /// it under the terms of the GNU General Public License as published by | |
| 13 /// the Free Software Foundation, either version 3 of the License, or | |
| 14 /// (at your option) any later version. | |
| 15 /// | |
| 16 /// This program is distributed in the hope that it will be useful, | |
| 17 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 /// GNU General Public License for more details. | |
| 20 /// | |
| 21 /// You should have received a copy of the GNU General Public License | |
| 22 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 23 ////////////////////////////////////////////////////////////////////////////// | |
| 24 | |
| 25 #ifndef INC_CV_HEARTBEAT_H_ | |
| 26 #define INC_CV_HEARTBEAT_H_ | |
| 27 | |
| 28 #include <stdint.h> | |
| 29 | |
| 30 | |
| 31 #define BLUEMOD_ADDR_SIZE (20u) /* length of address respond */ | |
| 32 #define BLUEMOD_RSSI_SIZE (5u) | |
| 33 #define BLUEMOD_NAME_SIZE (40u) | |
| 34 | |
| 35 void openEdit_Heartbeat(void); | |
| 36 | |
| 37 typedef enum | |
| 38 { | |
| 39 NO_INDICATOR = 0, | |
| 40 DEVICE_INDICATOR, | |
| 41 CONNECTION_INDICATOR, | |
| 42 SERVICE_INDICATOR, | |
| 43 CHARACTERISTIC_INDICATOR, | |
| 44 DESCRIPTOR_INDICATOR, | |
| 45 PULSE_INDICATOR, | |
| 46 OK_INDICATOR, /* module control */ | |
| 47 ERROR_INDICATOR /* module control */ | |
| 48 } indicatior_t; | |
| 49 | |
| 50 typedef enum | |
| 51 { | |
| 52 BT_READ_NOTHING = 0, | |
| 53 BT_READ_DEVICE_ADDR, | |
| 54 BT_READ_DEVICE_RSSI, | |
| 55 BT_READ_DEVICE_NAME, | |
| 56 BT_READ_CON_DETAILS, | |
| 57 BT_READ_SERV_HANDLE, | |
| 58 BT_READ_SERV_START, | |
| 59 BT_READ_SERV_END, | |
| 60 BT_READ_SERV_UUID, | |
| 61 BT_READ_CHAR_CONHANDLE, | |
| 62 BT_READ_CHAR_ATTRIBUTE, | |
| 63 BT_READ_CHAR_PROPERTY, | |
| 64 BT_READ_CHAR_VALUEHANDLE, | |
| 65 BT_READ_CHAR_UUID, | |
| 66 BT_READ_DESC_CONHANDLE, | |
| 67 BT_READ_DESC_CHARHANDLE, | |
| 68 BT_READ_DESC_DESCHANDLE, | |
| 69 BT_READ_DESC_UUID, | |
| 70 BT_READ_PULSE_CONHANDLE, | |
| 71 BT_READ_PULSE_VALUEHANDLE, | |
| 72 BT_READ_PULSE_DATA, | |
| 73 } readDataType_t; | |
| 74 | |
| 75 typedef enum | |
| 76 { | |
| 77 SENSOR_HB_OFFLINE = 0, /* Default Status no data available */ | |
| 78 SENSOR_HB_ENABLE_BLE, | |
| 79 SENSOR_HB_CHECK_CONFIG, | |
| 80 SENSOR_HB_DISCOVER, | |
| 81 SENSOR_HB_CONNECT, | |
| 82 SENSOR_HB_DISCONNECT, | |
| 83 SENSOR_HB_SERVICES, | |
| 84 SENSOR_HB_CHARACTERISTIC, | |
| 85 SENSOR_HB_DESCRIPTOR, | |
| 86 SENSOR_HB_SUBSCRIBE, | |
| 87 SENSOR_HB_RESTART, | |
| 88 SENSOR_HB_DETECTION_INDICATOR, /* searching for indicators to identify data items */ | |
| 89 SENSOR_HB_DETECTION_RSSI, | |
| 90 SENSOR_HB_DETECTION_NAME, | |
| 91 SENSOR_HB_DETECTION_MAN, | |
| 92 SENSOR_HB_DETECTION_UUID, | |
| 93 SENSOR_HB_FOUND, /* A device providing the requested service was found */ | |
| 94 SENSOR_HB_CONNECTED, /* Connection to heartbeat sensor established */ | |
| 95 SENSOR_HB_OFFLINEMODE, /* Oflline measurement started */ | |
| 96 } sensorHeartbeat_State_t; | |
| 97 | |
| 98 typedef struct | |
| 99 { | |
| 100 uint8_t address[BLUEMOD_ADDR_SIZE]; | |
| 101 uint8_t rssi[BLUEMOD_RSSI_SIZE]; | |
| 102 uint8_t name[BLUEMOD_NAME_SIZE]; | |
| 103 } btDdeviceData_t; | |
| 104 | |
| 105 | |
| 106 typedef struct | |
| 107 { | |
| 108 uint8_t handle; | |
| 109 uint8_t start[6]; | |
| 110 uint8_t end[6]; | |
| 111 uint8_t uuid[50]; | |
| 112 } btDeviceService_t; | |
| 113 | |
| 114 typedef struct | |
| 115 { | |
| 116 uint8_t conHandle; | |
| 117 uint8_t attrHandle[10]; | |
| 118 uint8_t properties[10]; | |
| 119 uint8_t valueHandle[10]; | |
| 120 uint8_t uuid[50]; | |
| 121 } btDeviceCharacteristic_t; | |
| 122 | |
| 123 typedef struct | |
| 124 { | |
| 125 uint8_t conHandle; | |
| 126 uint8_t charHandle[10]; | |
| 127 uint8_t descHandle[10]; | |
| 128 uint8_t uuid[50]; | |
| 129 } btDeviceDescriptor_t; | |
| 130 | |
| 131 typedef struct { | |
| 132 uint16_t heart_rate; | |
| 133 uint16_t energy_expended; | |
| 134 uint16_t rr_intervals[10]; | |
| 135 uint8_t rr_count; | |
| 136 } HRMeasurement_t; | |
| 137 | |
| 138 sensorHeartbeat_State_t cv_heartbeat_getState(); | |
| 139 void refresh_Heartbeat(void); | |
| 140 void cv_heartbeat_Control(void); | |
| 141 uint8_t cv_heartbeat_HandleData(); | |
| 142 | |
| 143 #endif /* INC_CV_HEARTBEAT_H_ */ |
