Mercurial > public > ostc4
annotate Discovery/Inc/cv_heartbeat.h @ 1040:74be24428049 GasConsumption
Bugfix Fontpack update for large blocks:
The update of a font pack with a size > 768000 byte was interrupted and a manuel switch to bootloader had to be performed to get the font pack flashed. Rootcause was a missing address adjustment during the block read back function which caused a false error detection. Blocks > 768000 are read in two step while only one buffer is used for comparation. To fill the correct data into this buffer a dummy read of the flash data was added to get the data pointers to the correct offset. Another bug was regardings the read back itself where only the first byte was checked. After array indexing the complete buffer is noch verified.
| author | Ideenmodellierer |
|---|---|
| date | Mon, 13 Oct 2025 20:54:25 +0200 |
| parents | 195bfbdf961d |
| children |
| rev | line source |
|---|---|
| 1032 | 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, | |
|
1033
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
43 CHARACTERISTIC_INDICATOR, |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
44 DESCRIPTOR_INDICATOR, |
| 1034 | 45 PULSE_INDICATOR, |
| 1032 | 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, | |
|
1033
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
60 BT_READ_SERV_UUID, |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
61 BT_READ_CHAR_CONHANDLE, |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
62 BT_READ_CHAR_ATTRIBUTE, |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
63 BT_READ_CHAR_PROPERTY, |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
64 BT_READ_CHAR_VALUEHANDLE, |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
65 BT_READ_CHAR_UUID, |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
66 BT_READ_DESC_CONHANDLE, |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
67 BT_READ_DESC_CHARHANDLE, |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
68 BT_READ_DESC_DESCHANDLE, |
| 1034 | 69 BT_READ_DESC_UUID, |
| 70 BT_READ_PULSE_CONHANDLE, | |
| 71 BT_READ_PULSE_VALUEHANDLE, | |
| 72 BT_READ_PULSE_DATA, | |
| 1032 | 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, | |
|
1033
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
82 SENSOR_HB_DISCONNECT, |
| 1032 | 83 SENSOR_HB_SERVICES, |
|
1033
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
84 SENSOR_HB_CHARACTERISTIC, |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
85 SENSOR_HB_DESCRIPTOR, |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
86 SENSOR_HB_SUBSCRIBE, |
| 1032 | 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 | |
|
1033
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
114 typedef struct |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
115 { |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
116 uint8_t conHandle; |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
117 uint8_t attrHandle[10]; |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
118 uint8_t properties[10]; |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
119 uint8_t valueHandle[10]; |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
120 uint8_t uuid[50]; |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
121 } btDeviceCharacteristic_t; |
| 1032 | 122 |
|
1033
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
123 typedef struct |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
124 { |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
125 uint8_t conHandle; |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
126 uint8_t charHandle[10]; |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
127 uint8_t descHandle[10]; |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
128 uint8_t uuid[50]; |
|
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
129 } btDeviceDescriptor_t; |
| 1032 | 130 |
| 1034 | 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 | |
| 1032 | 138 sensorHeartbeat_State_t cv_heartbeat_getState(); |
| 139 void refresh_Heartbeat(void); | |
| 140 void cv_heartbeat_Control(void); | |
|
1033
5f66e44d69f0
Added functionality needed for subscription of standard Bluetooth pulse service notifications
Ideenmodellierer
parents:
1032
diff
changeset
|
141 uint8_t cv_heartbeat_HandleData(); |
| 1032 | 142 |
| 143 #endif /* INC_CV_HEARTBEAT_H_ */ |
