ref_app_breathing_reg_protocol_access.c
Go to the documentation of this file.
1 // Copyright (c) Acconeer AB, 2023-2024
2 // All rights reserved
3 // This file is subject to the terms and conditions defined in the file
4 // 'LICENSES/license_acconeer.txt', (BSD 3-Clause License) which is part
5 // of this source code package.
6
7 #include <stdbool.h>
8 #include <stdint.h>
9
10 #include "acc_detector_presence.h"
11 #include "acc_integration.h"
12 #include "acc_version.h"
13 #include "ref_app_breathing.h"
14
15 #include "acc_reg_protocol.h"
16 #include "i2c_ref_app_breathing.h"
17 #include "ref_app_breathing_reg_protocol.h"
18
19
20 /**
21 * @brief Get the protocol error status flags
22 *
23 * @return error flags as uint32 register value
24 */
25 static uint32_t get_protocol_error_flags(void);
26
27
28 //
29 // REGISTER READ/WRITE ACCESS FUNCTIONS
30 //
31
32
33 void ref_app_breathing_reg_read_application_id(uint32_t *value)
34 {
35 *value = REF_APP_BREATHING_REG_APPLICATION_ID_ENUM_REF_APP_BREATHING;
36 }
37
38
39 void ref_app_breathing_reg_read_version(uint32_t *value)
40 {
41 *value = acc_version_get_hex();
42 }
43
44
45 void ref_app_breathing_reg_read_protocol_status(uint32_t *value)
46 {
47 uint32_t error_flags = get_protocol_error_flags();
48 uint32_t protocol_status = 0;
49
50 if ((error_flags & ACC_REG_ERROR_FLAG_PROTOCOL_STATE_ERROR) != 0)
51 {
52 protocol_status |= REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_PROTOCOL_STATE_ERROR_MASK;
53 }
54
55 if ((error_flags & ACC_REG_ERROR_FLAG_PACKET_LENGTH_ERROR) != 0)
56 {
57 protocol_status |= REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_PACKET_LENGTH_ERROR_MASK;
58 }
59
60 if ((error_flags & ACC_REG_ERROR_FLAG_ADDRESS_ERROR) != 0)
61 {
62 protocol_status |= REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_ADDRESS_ERROR_MASK;
63 }
64
65 if ((error_flags & ACC_REG_ERROR_FLAG_WRITE_FAILED) != 0)
66 {
67 protocol_status |= REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_WRITE_FAILED_MASK;
68 }
69
70 if ((error_flags & ACC_REG_ERROR_FLAG_WRITE_TO_READ_ONLY) != 0)
71 {
72 protocol_status |= REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_WRITE_TO_READ_ONLY_MASK;
73 }
74
75 *value = protocol_status;
76 }
77
78
79 void ref_app_breathing_reg_read_measure_counter(uint32_t *value)
80 {
81 *value = i2c_ref_app_breathing_get_counter();
82 }
83
84
85 void ref_app_breathing_reg_read_app_status(uint32_t *value)
86 {
87 *value = i2c_ref_app_breathing_get_status();
88 }
89
90
91 void ref_app_breathing_reg_read_breathing_result(uint32_t *value)
92 {
93 *value = i2c_ref_app_breathing_get_result();
94 }
95
96
97 void ref_app_breathing_reg_read_breathing_rate(uint32_t *value)
98 {
99 float float_value = i2c_ref_app_breathing_get_breathing_rate();
100
101 *value = (uint32_t)float_value;
102 }
103
104
105 void ref_app_breathing_reg_read_app_state(uint32_t *value)
106 {
107 ref_app_breathing_app_state_t state = i2c_ref_app_breathing_get_app_state();
108
109 switch (state)
110 {
111 case REF_APP_BREATHING_APP_STATE_INIT:
112 *value = REF_APP_BREATHING_REG_APP_STATE_ENUM_INIT;
113 break;
114 case REF_APP_BREATHING_APP_STATE_NO_PRESENCE:
115 *value = REF_APP_BREATHING_REG_APP_STATE_ENUM_NO_PRESENCE;
116 break;
117 case REF_APP_BREATHING_APP_STATE_INTRA_PRESENCE:
118 *value = REF_APP_BREATHING_REG_APP_STATE_ENUM_INTRA_PRESENCE;
119 break;
120 case REF_APP_BREATHING_APP_STATE_DETERMINE_DISTANCE:
121 *value = REF_APP_BREATHING_REG_APP_STATE_ENUM_DETERMINE_DISTANCE;
122 break;
123 case REF_APP_BREATHING_APP_STATE_ESTIMATE_BREATHING_RATE:
124 *value = REF_APP_BREATHING_REG_APP_STATE_ENUM_ESTIMATE_BREATHING_RATE;
125 break;
126 default:
127 //Not possible
128 break;
129 }
130 }
131
132
133 void ref_app_breathing_reg_read_start(uint32_t *value)
134 {
135 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
136 float float_value = acc_detector_presence_config_start_get(config->presence_config);
137
138 *value = acc_reg_protocol_float_to_uint32_milli(float_value);
139 }
140
141
142 bool ref_app_breathing_reg_write_start(const uint32_t value)
143 {
144 bool status = false;
145 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
146
147 if (config != NULL)
148 {
149 float float_value = acc_reg_protocol_uint32_milli_to_float(value);
150 acc_detector_presence_config_start_set(config->presence_config, float_value);
151 status = true;
152 }
153
154 return status;
155 }
156
157
158 void ref_app_breathing_reg_read_end(uint32_t *value)
159 {
160 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
161 float float_value = acc_detector_presence_config_end_get(config->presence_config);
162
163 *value = acc_reg_protocol_float_to_uint32_milli(float_value);
164 }
165
166
167 bool ref_app_breathing_reg_write_end(const uint32_t value)
168 {
169 bool status = false;
170 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
171
172 if (config != NULL)
173 {
174 float float_value = acc_reg_protocol_uint32_milli_to_float(value);
175 acc_detector_presence_config_end_set(config->presence_config, float_value);
176 status = true;
177 }
178
179 return status;
180 }
181
182
183 void ref_app_breathing_reg_read_num_distances_to_analyze(uint32_t *value)
184 {
185 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
186
187 *value = config->num_dists_to_analyze;
188 }
189
190
191 bool ref_app_breathing_reg_write_num_distances_to_analyze(const uint32_t value)
192 {
193 bool status = false;
194 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
195
196 if (config != NULL)
197 {
198 config->num_dists_to_analyze = value;
199 status = true;
200 }
201
202 return status;
203 }
204
205
206 void ref_app_breathing_reg_read_distance_determination_duration_s(uint32_t *value)
207 {
208 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
209
210 *value = config->distance_determination_duration_s;
211 }
212
213
214 bool ref_app_breathing_reg_write_distance_determination_duration_s(const uint32_t value)
215 {
216 bool status = false;
217 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
218
219 if (config != NULL)
220 {
221 config->distance_determination_duration_s = value;
222 status = true;
223 }
224
225 return status;
226 }
227
228
229 void ref_app_breathing_reg_read_use_presence_processor(uint32_t *value)
230 {
231 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
232
233 *value = config->use_presence_processor ? 1 : 0;
234 }
235
236
237 bool ref_app_breathing_reg_write_use_presence_processor(const uint32_t value)
238 {
239 bool status = false;
240 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
241
242 if (config != NULL)
243 {
244 config->use_presence_processor = (value != 0);
245 status = true;
246 }
247
248 return status;
249 }
250
251
252 void ref_app_breathing_reg_read_lowest_breathing_rate(uint32_t *value)
253 {
254 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
255
256 *value = config->lowest_breathing_rate;
257 }
258
259
260 bool ref_app_breathing_reg_write_lowest_breathing_rate(const uint32_t value)
261 {
262 bool status = false;
263 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
264
265 if (config != NULL)
266 {
267 config->lowest_breathing_rate = value;
268 status = true;
269 }
270
271 return status;
272 }
273
274
275 void ref_app_breathing_reg_read_highest_breathing_rate(uint32_t *value)
276 {
277 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
278
279 *value = config->highest_breathing_rate;
280 }
281
282
283 bool ref_app_breathing_reg_write_highest_breathing_rate(const uint32_t value)
284 {
285 bool status = false;
286 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
287
288 if (config != NULL)
289 {
290 config->highest_breathing_rate = value;
291 status = true;
292 }
293
294 return status;
295 }
296
297
298 void ref_app_breathing_reg_read_time_series_length_s(uint32_t *value)
299 {
300 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
301
302 *value = config->time_series_length_s;
303 }
304
305
306 bool ref_app_breathing_reg_write_time_series_length_s(const uint32_t value)
307 {
308 bool status = false;
309 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
310
311 if (config != NULL)
312 {
313 config->time_series_length_s = value;
314 status = true;
315 }
316
317 return status;
318 }
319
320
321 void ref_app_breathing_reg_read_frame_rate(uint32_t *value)
322 {
323 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
324 float float_value = acc_detector_presence_config_frame_rate_get(config->presence_config);
325
326 *value = acc_reg_protocol_float_to_uint32_milli(float_value);
327 }
328
329
330 bool ref_app_breathing_reg_write_frame_rate(const uint32_t value)
331 {
332 bool status = false;
333 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
334
335 if (config != NULL)
336 {
337 float float_value = acc_reg_protocol_uint32_milli_to_float(value);
338 acc_detector_presence_config_frame_rate_set(config->presence_config, float_value);
339 status = true;
340 }
341
342 return status;
343 }
344
345
346 void ref_app_breathing_reg_read_sweeps_per_frame(uint32_t *value)
347 {
348 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
349
350 *value = acc_detector_presence_config_sweeps_per_frame_get(config->presence_config);
351 }
352
353
354 bool ref_app_breathing_reg_write_sweeps_per_frame(const uint32_t value)
355 {
356 bool status = false;
357 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
358
359 if (config != NULL)
360 {
361 acc_detector_presence_config_sweeps_per_frame_set(config->presence_config, value);
362 status = true;
363 }
364
365 return status;
366 }
367
368
369 void ref_app_breathing_reg_read_hwaas(uint32_t *value)
370 {
371 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
372
373 *value = acc_detector_presence_config_hwaas_get(config->presence_config);
374 }
375
376
377 bool ref_app_breathing_reg_write_hwaas(uint32_t value)
378 {
379 bool status = false;
380 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
381
382 if (config != NULL)
383 {
384 acc_detector_presence_config_hwaas_set(config->presence_config, value);
385 status = true;
386 }
387
388 return status;
389 }
390
391
392 void ref_app_breathing_reg_read_profile(uint32_t *value)
393 {
394 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
395 acc_config_profile_t profile = acc_detector_presence_config_profile_get(config->presence_config);
396 uint32_t profile_value = 0;
397
398 switch (profile)
399 {
400 case ACC_CONFIG_PROFILE_1:
401 profile_value = REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE1;
402 break;
403 case ACC_CONFIG_PROFILE_2:
404 profile_value = REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE2;
405 break;
406 case ACC_CONFIG_PROFILE_3:
407 profile_value = REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE3;
408 break;
409 case ACC_CONFIG_PROFILE_4:
410 profile_value = REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE4;
411 break;
412 case ACC_CONFIG_PROFILE_5:
413 profile_value = REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE5;
414 break;
415 default:
416 break;
417 }
418
419 *value = profile_value;
420 }
421
422
423 bool ref_app_breathing_reg_write_profile(const uint32_t value)
424 {
425 bool status = false;
426 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
427
428 if (config != NULL)
429 {
430 status = true;
431 acc_config_profile_t profile = ACC_CONFIG_PROFILE_1;
432
433 switch (value)
434 {
435 case REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE1:
436 profile = ACC_CONFIG_PROFILE_1;
437 break;
438 case REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE2:
439 profile = ACC_CONFIG_PROFILE_2;
440 break;
441 case REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE3:
442 profile = ACC_CONFIG_PROFILE_3;
443 break;
444 case REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE4:
445 profile = ACC_CONFIG_PROFILE_4;
446 break;
447 case REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE5:
448 profile = ACC_CONFIG_PROFILE_5;
449 break;
450 default:
451 status = false;
452 break;
453 }
454
455 if (status)
456 {
457 acc_detector_presence_config_profile_set(config->presence_config, profile);
458 }
459 }
460
461 return status;
462 }
463
464
465 void ref_app_breathing_reg_read_intra_detection_threshold(uint32_t *value)
466 {
467 const ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
468 float float_value = acc_detector_presence_config_intra_detection_threshold_get(config->presence_config);
469
470 *value = acc_reg_protocol_float_to_uint32_milli(float_value);
471 }
472
473
474 bool ref_app_breathing_reg_write_intra_detection_threshold(const uint32_t value)
475 {
476 bool status = false;
477 ref_app_breathing_config_t *config = i2c_ref_app_breathing_get_config();
478
479 if (config != NULL)
480 {
481 float float_value = acc_reg_protocol_uint32_milli_to_float(value);
482 acc_detector_presence_config_intra_detection_threshold_set(config->presence_config, float_value);
483 status = true;
484 }
485
486 return status;
487 }
488
489
490 bool ref_app_breathing_reg_write_command(const uint32_t value)
491 {
492 return i2c_ref_app_breathing_command(value);
493 }
494
495
496 //
497 // PRIVATE HELPER FUNCTIONS
498 //
499
500
501 static uint32_t get_protocol_error_flags(void)
502 {
503 /* Make sure we do not have a race for error flags */
504 acc_integration_critical_section_enter();
505
506 uint32_t error_flags = acc_reg_protocol_get_error_flags();
507
508 acc_integration_critical_section_exit();
509
510 return error_flags;
511 }
REF_APP_BREATHING_APP_STATE_ESTIMATE_BREATHING_RATE
@ REF_APP_BREATHING_APP_STATE_ESTIMATE_BREATHING_RATE
Definition: ref_app_breathing.h:66
acc_reg_protocol_float_to_uint32_milli
uint32_t acc_reg_protocol_float_to_uint32_milli(float value)
Convert 1000 * float to uint32.
Definition: acc_reg_protocol.c:336
ref_app_breathing_reg_read_app_state
void ref_app_breathing_reg_read_app_state(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:105
REF_APP_BREATHING_REG_APP_STATE_ENUM_ESTIMATE_BREATHING_RATE
#define REF_APP_BREATHING_REG_APP_STATE_ENUM_ESTIMATE_BREATHING_RATE
Definition: ref_app_breathing_reg_protocol.h:108
acc_detector_presence_config_sweeps_per_frame_set
void acc_detector_presence_config_sweeps_per_frame_set(acc_detector_presence_config_t *presence_config, uint16_t sweeps_per_frame)
Set the number of sweeps per frame.
ref_app_breathing_reg_write_command
bool ref_app_breathing_reg_write_command(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:490
REF_APP_BREATHING_APP_STATE_INIT
@ REF_APP_BREATHING_APP_STATE_INIT
Definition: ref_app_breathing.h:62
i2c_ref_app_breathing_get_status
uint32_t i2c_ref_app_breathing_get_status(void)
Get ref app breathing status.
Definition: i2c_ref_app_breathing.c:204
ACC_CONFIG_PROFILE_4
@ ACC_CONFIG_PROFILE_4
Definition: acc_definitions_a121.h:55
acc_detector_presence_config_hwaas_set
void acc_detector_presence_config_hwaas_set(acc_detector_presence_config_t *presence_config, uint16_t hwaas)
Set the hardware accelerated average samples (HWAAS)
REF_APP_BREATHING_REG_APPLICATION_ID_ENUM_REF_APP_BREATHING
#define REF_APP_BREATHING_REG_APPLICATION_ID_ENUM_REF_APP_BREATHING
Definition: ref_app_breathing_reg_protocol.h:129
REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_PROTOCOL_STATE_ERROR_MASK
#define REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_PROTOCOL_STATE_ERROR_MASK
Definition: ref_app_breathing_reg_protocol.h:47
acc_reg_protocol_get_error_flags
uint32_t acc_reg_protocol_get_error_flags(void)
Get the error flags for the register protocol.
Definition: acc_reg_protocol.c:319
ACC_REG_ERROR_FLAG_PACKET_LENGTH_ERROR
#define ACC_REG_ERROR_FLAG_PACKET_LENGTH_ERROR
Definition: acc_reg_protocol.h:15
acc_version.h
ref_app_breathing_reg_write_highest_breathing_rate
bool ref_app_breathing_reg_write_highest_breathing_rate(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:283
i2c_ref_app_breathing_get_config
ref_app_breathing_config_t * i2c_ref_app_breathing_get_config(void)
Get ref app breathing configuration handle.
Definition: i2c_ref_app_breathing.c:177
REF_APP_BREATHING_REG_APP_STATE_ENUM_INTRA_PRESENCE
#define REF_APP_BREATHING_REG_APP_STATE_ENUM_INTRA_PRESENCE
Definition: ref_app_breathing_reg_protocol.h:106
ref_app_breathing_reg_write_end
bool ref_app_breathing_reg_write_end(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:167
ref_app_breathing_reg_read_time_series_length_s
void ref_app_breathing_reg_read_time_series_length_s(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:298
ACC_REG_ERROR_FLAG_ADDRESS_ERROR
#define ACC_REG_ERROR_FLAG_ADDRESS_ERROR
Definition: acc_reg_protocol.h:16
acc_detector_presence_config_start_get
float acc_detector_presence_config_start_get(const acc_detector_presence_config_t *presence_config)
Get the start point of measurement interval in meters.
REF_APP_BREATHING_REG_APP_STATE_ENUM_DETERMINE_DISTANCE
#define REF_APP_BREATHING_REG_APP_STATE_ENUM_DETERMINE_DISTANCE
Definition: ref_app_breathing_reg_protocol.h:107
acc_detector_presence_config_frame_rate_set
void acc_detector_presence_config_frame_rate_set(acc_detector_presence_config_t *presence_config, float frame_rate)
Set the frame rate.
REF_APP_BREATHING_REG_APP_STATE_ENUM_INIT
#define REF_APP_BREATHING_REG_APP_STATE_ENUM_INIT
Definition: ref_app_breathing_reg_protocol.h:104
ref_app_breathing.h
acc_integration_critical_section_exit
void acc_integration_critical_section_exit(void)
Definition: acc_integration_cortex.c:16
ref_app_breathing_reg_read_end
void ref_app_breathing_reg_read_end(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:158
ref_app_breathing_reg_write_hwaas
bool ref_app_breathing_reg_write_hwaas(uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:377
ACC_CONFIG_PROFILE_5
@ ACC_CONFIG_PROFILE_5
Definition: acc_definitions_a121.h:57
i2c_ref_app_breathing.h
ref_app_breathing_reg_read_lowest_breathing_rate
void ref_app_breathing_reg_read_lowest_breathing_rate(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:252
acc_integration.h
ref_app_breathing_reg_write_start
bool ref_app_breathing_reg_write_start(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:142
acc_version_get_hex
uint32_t acc_version_get_hex(void)
Get the version of the Acconeer software as a hex number.
REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_PACKET_LENGTH_ERROR_MASK
#define REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_PACKET_LENGTH_ERROR_MASK
Definition: ref_app_breathing_reg_protocol.h:49
config
cargo_config_t config
Definition: i2c_example_cargo.c:34
ACC_CONFIG_PROFILE_2
@ ACC_CONFIG_PROFILE_2
Definition: acc_definitions_a121.h:53
ref_app_breathing_reg_write_time_series_length_s
bool ref_app_breathing_reg_write_time_series_length_s(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:306
REF_APP_BREATHING_APP_STATE_INTRA_PRESENCE
@ REF_APP_BREATHING_APP_STATE_INTRA_PRESENCE
Definition: ref_app_breathing.h:64
i2c_ref_app_breathing_get_breathing_rate
float i2c_ref_app_breathing_get_breathing_rate(void)
Get breathing rate.
Definition: i2c_ref_app_breathing.c:245
acc_detector_presence_config_intra_detection_threshold_set
void acc_detector_presence_config_intra_detection_threshold_set(acc_detector_presence_config_t *presence_config, float intra_detection_threshold)
Set the detection threshold for the intra-frame presence detection.
i2c_ref_app_breathing_get_app_state
ref_app_breathing_app_state_t i2c_ref_app_breathing_get_app_state(void)
Get app state.
Definition: i2c_ref_app_breathing.c:257
ref_app_breathing_reg_read_num_distances_to_analyze
void ref_app_breathing_reg_read_num_distances_to_analyze(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:183
ref_app_breathing_reg_read_sweeps_per_frame
void ref_app_breathing_reg_read_sweeps_per_frame(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:346
acc_detector_presence_config_end_get
float acc_detector_presence_config_end_get(const acc_detector_presence_config_t *presence_config)
Get the end point of measurement interval in meters.
acc_detector_presence_config_hwaas_get
uint16_t acc_detector_presence_config_hwaas_get(const acc_detector_presence_config_t *presence_config)
Get the hardware accelerated average samples (HWAAS)
REF_APP_BREATHING_REG_APP_STATE_ENUM_NO_PRESENCE
#define REF_APP_BREATHING_REG_APP_STATE_ENUM_NO_PRESENCE
Definition: ref_app_breathing_reg_protocol.h:105
ref_app_breathing_reg_write_intra_detection_threshold
bool ref_app_breathing_reg_write_intra_detection_threshold(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:474
ACC_REG_ERROR_FLAG_WRITE_FAILED
#define ACC_REG_ERROR_FLAG_WRITE_FAILED
Definition: acc_reg_protocol.h:17
ref_app_breathing_reg_read_measure_counter
void ref_app_breathing_reg_read_measure_counter(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:79
ref_app_breathing_reg_write_sweeps_per_frame
bool ref_app_breathing_reg_write_sweeps_per_frame(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:354
i2c_ref_app_breathing_get_counter
uint32_t i2c_ref_app_breathing_get_counter(void)
Get measure counter.
Definition: i2c_ref_app_breathing.c:269
ref_app_breathing_reg_read_intra_detection_threshold
void ref_app_breathing_reg_read_intra_detection_threshold(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:465
ref_app_breathing_reg_read_application_id
void ref_app_breathing_reg_read_application_id(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:33
acc_detector_presence_config_end_set
void acc_detector_presence_config_end_set(acc_detector_presence_config_t *presence_config, float end)
Set the end point of measurement interval in meters.
ref_app_breathing_reg_read_app_status
void ref_app_breathing_reg_read_app_status(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:85
REF_APP_BREATHING_APP_STATE_NO_PRESENCE
@ REF_APP_BREATHING_APP_STATE_NO_PRESENCE
Definition: ref_app_breathing.h:63
ref_app_breathing_reg_protocol.h
i2c_ref_app_breathing_command
bool i2c_ref_app_breathing_command(uint32_t command)
Send command to be executed to i2c ref app breathing.
Definition: i2c_ref_app_breathing.c:182
REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE3
#define REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE3
Definition: ref_app_breathing_reg_protocol.h:113
ref_app_breathing_reg_write_num_distances_to_analyze
bool ref_app_breathing_reg_write_num_distances_to_analyze(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:191
REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_WRITE_TO_READ_ONLY_MASK
#define REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_WRITE_TO_READ_ONLY_MASK
Definition: ref_app_breathing_reg_protocol.h:55
ref_app_breathing_reg_write_lowest_breathing_rate
bool ref_app_breathing_reg_write_lowest_breathing_rate(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:260
REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE5
#define REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE5
Definition: ref_app_breathing_reg_protocol.h:115
ref_app_breathing_reg_read_hwaas
void ref_app_breathing_reg_read_hwaas(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:369
acc_reg_protocol_uint32_milli_to_float
float acc_reg_protocol_uint32_milli_to_float(uint32_t value)
Convert uint32 / 1000 to float.
Definition: acc_reg_protocol.c:351
REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE2
#define REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE2
Definition: ref_app_breathing_reg_protocol.h:112
ref_app_breathing_reg_read_start
void ref_app_breathing_reg_read_start(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:133
ref_app_breathing_reg_read_profile
void ref_app_breathing_reg_read_profile(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:392
ref_app_breathing_reg_read_breathing_result
void ref_app_breathing_reg_read_breathing_result(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:91
ref_app_breathing_reg_read_version
void ref_app_breathing_reg_read_version(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:39
get_protocol_error_flags
static uint32_t get_protocol_error_flags(void)
Get the protocol error status flags.
Definition: ref_app_breathing_reg_protocol_access.c:501
ACC_REG_ERROR_FLAG_PROTOCOL_STATE_ERROR
#define ACC_REG_ERROR_FLAG_PROTOCOL_STATE_ERROR
Definition: acc_reg_protocol.h:14
ref_app_breathing_reg_read_protocol_status
void ref_app_breathing_reg_read_protocol_status(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:45
acc_detector_presence_config_sweeps_per_frame_get
uint16_t acc_detector_presence_config_sweeps_per_frame_get(const acc_detector_presence_config_t *presence_config)
Get the number of sweeps per frame.
REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE4
#define REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE4
Definition: ref_app_breathing_reg_protocol.h:114
ACC_REG_ERROR_FLAG_WRITE_TO_READ_ONLY
#define ACC_REG_ERROR_FLAG_WRITE_TO_READ_ONLY
Definition: acc_reg_protocol.h:18
ref_app_breathing_reg_write_frame_rate
bool ref_app_breathing_reg_write_frame_rate(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:330
ref_app_breathing_reg_read_breathing_rate
void ref_app_breathing_reg_read_breathing_rate(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:97
REF_APP_BREATHING_APP_STATE_DETERMINE_DISTANCE
@ REF_APP_BREATHING_APP_STATE_DETERMINE_DISTANCE
Definition: ref_app_breathing.h:65
REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_WRITE_FAILED_MASK
#define REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_WRITE_FAILED_MASK
Definition: ref_app_breathing_reg_protocol.h:53
acc_reg_protocol.h
acc_detector_presence_config_frame_rate_get
float acc_detector_presence_config_frame_rate_get(const acc_detector_presence_config_t *presence_config)
Get the frame rate.
acc_detector_presence_config_profile_set
void acc_detector_presence_config_profile_set(acc_detector_presence_config_t *presence_config, acc_config_profile_t profile)
Set a profile.
ref_app_breathing_reg_read_highest_breathing_rate
void ref_app_breathing_reg_read_highest_breathing_rate(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:275
ref_app_breathing_reg_read_distance_determination_duration_s
void ref_app_breathing_reg_read_distance_determination_duration_s(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:206
acc_integration_critical_section_enter
void acc_integration_critical_section_enter(void)
Definition: acc_integration_cortex.c:9
ref_app_breathing_reg_write_profile
bool ref_app_breathing_reg_write_profile(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:423
acc_config_profile_t
acc_config_profile_t
Profile.
Definition: acc_definitions_a121.h:49
acc_detector_presence_config_intra_detection_threshold_get
float acc_detector_presence_config_intra_detection_threshold_get(const acc_detector_presence_config_t *presence_config)
Get the detection threshold for the intra-frame presence detection.
acc_detector_presence_config_profile_get
acc_config_profile_t acc_detector_presence_config_profile_get(const acc_detector_presence_config_t *presence_config)
Get the currently set profile.
i2c_ref_app_breathing_get_result
uint32_t i2c_ref_app_breathing_get_result(void)
Get ref app breathing result.
Definition: i2c_ref_app_breathing.c:216
ref_app_breathing_config_t
Breathing application config container.
Definition: ref_app_breathing.h:25
acc_detector_presence_config_start_set
void acc_detector_presence_config_start_set(acc_detector_presence_config_t *presence_config, float start)
Set the start point of measurement interval in meters.
ACC_CONFIG_PROFILE_1
@ ACC_CONFIG_PROFILE_1
Definition: acc_definitions_a121.h:52
acc_detector_presence.h
ref_app_breathing_reg_read_frame_rate
void ref_app_breathing_reg_read_frame_rate(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:321
REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_ADDRESS_ERROR_MASK
#define REF_APP_BREATHING_REG_PROTOCOL_STATUS_FIELD_ADDRESS_ERROR_MASK
Definition: ref_app_breathing_reg_protocol.h:51
ACC_CONFIG_PROFILE_3
@ ACC_CONFIG_PROFILE_3
Definition: acc_definitions_a121.h:54
ref_app_breathing_reg_write_use_presence_processor
bool ref_app_breathing_reg_write_use_presence_processor(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:237
ref_app_breathing_reg_write_distance_determination_duration_s
bool ref_app_breathing_reg_write_distance_determination_duration_s(const uint32_t value)
Definition: ref_app_breathing_reg_protocol_access.c:214
ref_app_breathing_app_state_t
ref_app_breathing_app_state_t
State of the application.
Definition: ref_app_breathing.h:60
ref_app_breathing_reg_read_use_presence_processor
void ref_app_breathing_reg_read_use_presence_processor(uint32_t *value)
Definition: ref_app_breathing_reg_protocol_access.c:229
REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE1
#define REF_APP_BREATHING_REG_PROFILE_ENUM_PROFILE1
Definition: ref_app_breathing_reg_protocol.h:111