presence_reg_protocol_access.c
Go to the documentation of this file.
1 // Copyright (c) Acconeer AB, 2023-2025
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 
14 #include "acc_reg_protocol.h"
15 #include "i2c_presence_detector.h"
16 #include "presence_reg_protocol.h"
17 
18 /**
19  * @brief Get the protocol error status flags
20  *
21  * @return error flags as uint32 register value
22  */
23 static uint32_t get_protocol_error_flags(void);
24 
25 //
26 // REGISTER READ/WRITE ACCESS FUNCTIONS
27 //
28 
29 void presence_reg_read_application_id(uint32_t *value)
30 {
32 }
33 
34 void presence_reg_read_version(uint32_t *value)
35 {
36  *value = acc_version_get_hex();
37 }
38 
39 void presence_reg_read_protocol_status(uint32_t *value)
40 {
41  uint32_t error_flags = get_protocol_error_flags();
42  uint32_t protocol_status = 0;
43 
44  if ((error_flags & ACC_REG_ERROR_FLAG_PROTOCOL_STATE_ERROR) != 0)
45  {
47  }
48 
49  if ((error_flags & ACC_REG_ERROR_FLAG_PACKET_LENGTH_ERROR) != 0)
50  {
52  }
53 
54  if ((error_flags & ACC_REG_ERROR_FLAG_ADDRESS_ERROR) != 0)
55  {
57  }
58 
59  if ((error_flags & ACC_REG_ERROR_FLAG_WRITE_FAILED) != 0)
60  {
62  }
63 
64  if ((error_flags & ACC_REG_ERROR_FLAG_WRITE_TO_READ_ONLY) != 0)
65  {
67  }
68 
69  *value = protocol_status;
70 }
71 
72 void presence_reg_read_measure_counter(uint32_t *value)
73 {
75 }
76 
77 void presence_reg_read_detector_status(uint32_t *value)
78 {
80 }
81 
82 void presence_reg_read_presence_result(uint32_t *value)
83 {
85 }
86 
88 {
89  float float_value = i2c_presence_detector_get_distance();
90 
91  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
92 }
93 
95 {
97 
98  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
99 }
100 
102 {
104 
105  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
106 }
107 
109 {
111 
113 }
114 
115 bool presence_reg_write_sweeps_per_frame(const uint32_t value)
116 {
117  bool status = false;
119 
120  if (config != NULL)
121  {
123  status = true;
124  }
125 
126  return status;
127 }
128 
130 {
132 
134 }
135 
137 {
138  bool status = false;
140 
141  if (config != NULL)
142  {
144  status = true;
145  }
146 
147  return status;
148 }
149 
151 {
153 
155 
156  *value = bool_value ? 1 : 0;
157 }
158 
160 {
161  bool status = false;
163 
164  if (config != NULL)
165  {
166  bool enabled = (value != 0);
168  status = true;
169  }
170 
171  return status;
172 }
173 
175 {
177 
179 
180  *value = bool_value ? 1 : 0;
181 }
182 
184 {
185  bool status = false;
187 
188  if (config != NULL)
189  {
190  bool enabled = (value != 0);
192  status = true;
193  }
194 
195  return status;
196 }
197 
198 void presence_reg_read_frame_rate(uint32_t *value)
199 {
202 
203  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
204 }
205 
206 bool presence_reg_write_frame_rate(const uint32_t value)
207 {
208  bool status = false;
210 
211  if (config != NULL)
212  {
213  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
215  status = true;
216  }
217 
218  return status;
219 }
220 
222 {
225 
226  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
227 }
228 
230 {
231  bool status = false;
233 
234  if (config != NULL)
235  {
236  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
238  status = true;
239  }
240 
241  return status;
242 }
243 
245 {
248 
249  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
250 }
251 
253 {
254  bool status = false;
256 
257  if (config != NULL)
258  {
259  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
261  status = true;
262  }
263 
264  return status;
265 }
266 
268 {
271 
272  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
273 }
274 
276 {
277  bool status = false;
279 
280  if (config != NULL)
281  {
282  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
284  status = true;
285  }
286 
287  return status;
288 }
289 
291 {
294 
295  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
296 }
297 
299 {
300  bool status = false;
302 
303  if (config != NULL)
304  {
305  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
307  status = true;
308  }
309 
310  return status;
311 }
312 
314 {
317 
318  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
319 }
320 
322 {
323  bool status = false;
325 
326  if (config != NULL)
327  {
328  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
330  status = true;
331  }
332 
333  return status;
334 }
335 
337 {
340 
341  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
342 }
343 
345 {
346  bool status = false;
348 
349  if (config != NULL)
350  {
351  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
353  status = true;
354  }
355 
356  return status;
357 }
358 
360 {
363 
364  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
365 }
366 
368 {
369  bool status = false;
371 
372  if (config != NULL)
373  {
374  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
376  status = true;
377  }
378 
379  return status;
380 }
381 
383 {
386 
387  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
388 }
389 
391 {
392  bool status = false;
394 
395  if (config != NULL)
396  {
397  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
399  status = true;
400  }
401 
402  return status;
403 }
404 
406 {
408 
410 
411  *value = bool_value ? 1 : 0;
412 }
413 
414 bool presence_reg_write_auto_profile_enabled(const uint32_t value)
415 {
416  bool status = false;
418 
419  if (config != NULL)
420  {
421  bool enabled = (value != 0);
423  status = true;
424  }
425 
426  return status;
427 }
428 
430 {
432 
434 
435  *value = bool_value ? 1 : 0;
436 }
437 
439 {
440  bool status = false;
442 
443  if (config != NULL)
444  {
445  bool enabled = (value != 0);
447  status = true;
448  }
449 
450  return status;
451 }
452 
453 void presence_reg_read_manual_profile(uint32_t *value)
454 {
457  uint32_t profile_value = 0;
458 
459  switch (profile)
460  {
463  break;
466  break;
469  break;
472  break;
475  break;
476  default:
477  break;
478  }
479 
480  *value = profile_value;
481 }
482 
483 bool presence_reg_write_manual_profile(const uint32_t value)
484 {
485  bool status = false;
487 
488  if (config != NULL)
489  {
490  status = true;
492 
493  switch (value)
494  {
496  profile = ACC_CONFIG_PROFILE_1;
497  break;
499  profile = ACC_CONFIG_PROFILE_2;
500  break;
502  profile = ACC_CONFIG_PROFILE_3;
503  break;
505  profile = ACC_CONFIG_PROFILE_4;
506  break;
508  profile = ACC_CONFIG_PROFILE_5;
509  break;
510  default:
511  status = false;
512  break;
513  }
514 
515  if (status)
516  {
518  }
519  }
520 
521  return status;
522 }
523 
525 {
527 
529 }
530 
531 bool presence_reg_write_manual_step_length(const uint32_t value)
532 {
533  bool status = false;
535 
536  if (config != NULL)
537  {
539  status = true;
540  }
541 
542  return status;
543 }
544 
545 void presence_reg_read_start(uint32_t *value)
546 {
548  float float_value = acc_detector_presence_config_start_get(config);
549 
550  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
551 }
552 
553 bool presence_reg_write_start(const uint32_t value)
554 {
555  bool status = false;
557 
558  if (config != NULL)
559  {
560  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
562  status = true;
563  }
564 
565  return status;
566 }
567 
568 void presence_reg_read_end(uint32_t *value)
569 {
571  float float_value = acc_detector_presence_config_end_get(config);
572 
573  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
574 }
575 
576 bool presence_reg_write_end(const uint32_t value)
577 {
578  bool status = false;
580 
581  if (config != NULL)
582  {
583  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
585  status = true;
586  }
587 
588  return status;
589 }
590 
592 {
594 
596 
597  *value = bool_value ? 1 : 0;
598 }
599 
601 {
602  bool status = false;
604 
605  if (config != NULL)
606  {
607  bool enabled = (value != 0);
609  status = true;
610  }
611 
612  return status;
613 }
614 
615 void presence_reg_read_hwaas(uint32_t *value)
616 {
618 
620 }
621 
622 bool presence_reg_write_hwaas(uint32_t value)
623 {
624  bool status = false;
626 
627  if (config != NULL)
628  {
630  status = true;
631  }
632 
633  return status;
634 }
635 
637 {
639 
641 
642  *value = bool_value ? 1 : 0;
643 }
644 
645 bool presence_reg_write_automatic_subsweeps(const uint32_t value)
646 {
647  bool status = false;
649 
650  if (config != NULL)
651  {
652  bool enabled = (value != 0);
654  status = true;
655  }
656 
657  return status;
658 }
659 
660 void presence_reg_read_signal_quality(uint32_t *value)
661 {
664 
665  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
666 }
667 
668 bool presence_reg_write_signal_quality(const uint32_t value)
669 {
670  bool status = false;
672 
673  if (config != NULL)
674  {
675  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
677  status = true;
678  }
679 
680  return status;
681 }
682 
684 {
686  {
687  *value = 1;
688  }
689  else
690  {
691  *value = 0;
692  }
693 }
694 
695 bool presence_reg_write_detection_on_gpio(const uint32_t value)
696 {
697  bool enable = (value != 0);
698 
700 
701  return true;
702 }
703 
705 {
707 }
708 
709 bool presence_reg_write_command(const uint32_t value)
710 {
711  return i2c_presence_detector_command(value);
712 }
713 
714 //
715 // PRIVATE HELPER FUNCTIONS
716 //
717 
718 static uint32_t get_protocol_error_flags(void)
719 {
720  /* Make sure we do not have a race for error flags */
722 
723  uint32_t error_flags = acc_reg_protocol_get_error_flags();
724 
726 
727  return error_flags;
728 }
presence_reg_write_inter_frame_slow_cutoff
bool presence_reg_write_inter_frame_slow_cutoff(const uint32_t value)
Definition: presence_reg_protocol_access.c:321
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
acc_detector_presence_config_inter_detection_set
void acc_detector_presence_config_inter_detection_set(acc_detector_presence_config_t *presence_config, bool enable)
Set inter-frame presence detection.
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.
presence_reg_read_intra_output_time_const
void presence_reg_read_intra_output_time_const(uint32_t *value)
Definition: presence_reg_protocol_access.c:359
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)
presence_reg_read_inter_frame_fast_cutoff
void presence_reg_read_inter_frame_fast_cutoff(uint32_t *value)
Definition: presence_reg_protocol_access.c:290
presence_reg_read_manual_profile
void presence_reg_read_manual_profile(uint32_t *value)
Definition: presence_reg_protocol_access.c:453
presence_reg_write_inter_frame_fast_cutoff
bool presence_reg_write_inter_frame_fast_cutoff(const uint32_t value)
Definition: presence_reg_protocol_access.c:298
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
i2c_presence_detector_get_status
uint32_t i2c_presence_detector_get_status(void)
Get presence detector status.
Definition: i2c_presence_detector.c:213
ACC_REG_ERROR_FLAG_PACKET_LENGTH_ERROR
#define ACC_REG_ERROR_FLAG_PACKET_LENGTH_ERROR
Definition: acc_reg_protocol.h:15
presence_reg_write_intra_detection_enabled
bool presence_reg_write_intra_detection_enabled(const uint32_t value)
Definition: presence_reg_protocol_access.c:159
presence_reg_write_auto_step_length_enabled
bool presence_reg_write_auto_step_length_enabled(const uint32_t value)
Definition: presence_reg_protocol_access.c:438
acc_version.h
acc_detector_presence_config_inter_frame_deviation_time_const_set
void acc_detector_presence_config_inter_frame_deviation_time_const_set(acc_detector_presence_config_t *presence_config, float inter_frame_deviation_time_const)
Set the time constant of the low pass filter for the inter-frame deviation between fast and slow.
acc_detector_presence_config_reset_filters_on_prepare_get
bool acc_detector_presence_config_reset_filters_on_prepare_get(const acc_detector_presence_config_t *presence_config)
Get if the presence filters should reset on prepare.
presence_reg_write_detection_on_gpio
bool presence_reg_write_detection_on_gpio(const uint32_t value)
Definition: presence_reg_protocol_access.c:695
acc_detector_presence_config_auto_profile_set
void acc_detector_presence_config_auto_profile_set(acc_detector_presence_config_t *presence_config, bool enable)
Enable automatic selection of profile based on start point of measurement.
presence_reg_write_manual_step_length
bool presence_reg_write_manual_step_length(const uint32_t value)
Definition: presence_reg_protocol_access.c:531
presence_reg_read_intra_detection_threshold
void presence_reg_read_intra_detection_threshold(uint32_t *value)
Definition: presence_reg_protocol_access.c:221
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.
presence_reg_read_sweeps_per_frame
void presence_reg_read_sweeps_per_frame(uint32_t *value)
Definition: presence_reg_protocol_access.c:108
presence_reg_read_reset_filters_on_prepare
void presence_reg_read_reset_filters_on_prepare(uint32_t *value)
Definition: presence_reg_protocol_access.c:591
presence_reg_read_intra_presence_score
void presence_reg_read_intra_presence_score(uint32_t *value)
Definition: presence_reg_protocol_access.c:94
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.
presence_reg_read_presence_distance
void presence_reg_read_presence_distance(uint32_t *value)
Definition: presence_reg_protocol_access.c:87
presence_reg_write_end
bool presence_reg_write_end(const uint32_t value)
Definition: presence_reg_protocol_access.c:576
presence_reg_read_protocol_status
void presence_reg_read_protocol_status(uint32_t *value)
Definition: presence_reg_protocol_access.c:39
acc_detector_presence_config_inter_output_time_const_get
float acc_detector_presence_config_inter_output_time_const_get(const acc_detector_presence_config_t *presence_config)
Get the time constant for the output in the inter-frame part.
acc_integration_critical_section_exit
void acc_integration_critical_section_exit(void)
Definition: acc_integration_cortex.c:16
presence_reg_read_inter_detection_threshold
void presence_reg_read_inter_detection_threshold(uint32_t *value)
Definition: presence_reg_protocol_access.c:244
presence_reg_read_start
void presence_reg_read_start(uint32_t *value)
Definition: presence_reg_protocol_access.c:545
ACC_CONFIG_PROFILE_5
@ ACC_CONFIG_PROFILE_5
Definition: acc_definitions_a121.h:57
presence_reg_write_inter_detection_threshold
bool presence_reg_write_inter_detection_threshold(const uint32_t value)
Definition: presence_reg_protocol_access.c:252
presence_reg_read_inter_frame_deviation_time_const
void presence_reg_read_inter_frame_deviation_time_const(uint32_t *value)
Definition: presence_reg_protocol_access.c:267
presence_reg_read_presence_actual_frame_rate
void presence_reg_read_presence_actual_frame_rate(uint32_t *value)
Definition: presence_reg_protocol_access.c:704
i2c_presence_detector_get_counter
uint32_t i2c_presence_detector_get_counter(void)
Get presence detector measure counter.
Definition: i2c_presence_detector.c:296
acc_integration.h
presence_reg_read_measure_counter
void presence_reg_read_measure_counter(uint32_t *value)
Definition: presence_reg_protocol_access.c:72
presence_reg_read_manual_step_length
void presence_reg_read_manual_step_length(uint32_t *value)
Definition: presence_reg_protocol_access.c:524
acc_version_get_hex
uint32_t acc_version_get_hex(void)
Get the version of the Acconeer software as a hex number.
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
presence_reg_write_sweeps_per_frame
bool presence_reg_write_sweeps_per_frame(const uint32_t value)
Definition: presence_reg_protocol_access.c:115
PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE3
#define PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE3
Definition: presence_reg_protocol.h:121
PRESENCE_REG_APPLICATION_ID_ENUM_PRESENCE_DETECTOR
#define PRESENCE_REG_APPLICATION_ID_ENUM_PRESENCE_DETECTOR
Definition: presence_reg_protocol.h:136
presence_reg_write_command
bool presence_reg_write_command(const uint32_t value)
Definition: presence_reg_protocol_access.c:709
presence_reg_read_end
void presence_reg_read_end(uint32_t *value)
Definition: presence_reg_protocol_access.c:568
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.
acc_detector_presence_config_inter_frame_slow_cutoff_get
float acc_detector_presence_config_inter_frame_slow_cutoff_get(const acc_detector_presence_config_t *presence_config)
Get the cutoff frequency of the low pass filter for the slow filtered absolute sweep mean.
PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE1
#define PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE1
Definition: presence_reg_protocol.h:119
presence_reg_write_inter_frame_presence_timeout
bool presence_reg_write_inter_frame_presence_timeout(const uint32_t value)
Definition: presence_reg_protocol_access.c:136
PRESENCE_REG_PROTOCOL_STATUS_FIELD_PROTOCOL_STATE_ERROR_MASK
#define PRESENCE_REG_PROTOCOL_STATUS_FIELD_PROTOCOL_STATE_ERROR_MASK
Definition: presence_reg_protocol.h:60
presence_reg_read_auto_profile_enabled
void presence_reg_read_auto_profile_enabled(uint32_t *value)
Definition: presence_reg_protocol_access.c:405
PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE4
#define PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE4
Definition: presence_reg_protocol.h:122
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.
presence_reg_read_presence_result
void presence_reg_read_presence_result(uint32_t *value)
Definition: presence_reg_protocol_access.c:82
acc_detector_presence_config_inter_detection_get
bool acc_detector_presence_config_inter_detection_get(const acc_detector_presence_config_t *presence_config)
Get if inter-frame presence detection is enabled.
presence_reg_read_inter_frame_slow_cutoff
void presence_reg_read_inter_frame_slow_cutoff(uint32_t *value)
Definition: presence_reg_protocol_access.c:313
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)
presence_reg_read_automatic_subsweeps
void presence_reg_read_automatic_subsweeps(uint32_t *value)
Definition: presence_reg_protocol_access.c:636
i2c_presence_detector_get_config
acc_detector_presence_config_t * i2c_presence_detector_get_config(void)
Get presence detector configuration handle.
Definition: i2c_presence_detector.c:186
acc_detector_presence_config_inter_frame_presence_timeout_get
uint16_t acc_detector_presence_config_inter_frame_presence_timeout_get(const acc_detector_presence_config_t *presence_config)
Get the inter-frame presence timeout in seconds.
ACC_REG_ERROR_FLAG_WRITE_FAILED
#define ACC_REG_ERROR_FLAG_WRITE_FAILED
Definition: acc_reg_protocol.h:17
PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE5
#define PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE5
Definition: presence_reg_protocol.h:123
acc_detector_presence_config_inter_frame_presence_timeout_set
void acc_detector_presence_config_inter_frame_presence_timeout_set(acc_detector_presence_config_t *presence_config, uint16_t inter_frame_presence_timeout)
Set the inter-frame presence timeout in seconds.
presence_reg_write_frame_rate
bool presence_reg_write_frame_rate(const uint32_t value)
Definition: presence_reg_protocol_access.c:206
i2c_presence_detector_presence_detected_gpio
void i2c_presence_detector_presence_detected_gpio(bool enable)
Enable/Disable gpio output for presence detected.
Definition: i2c_presence_detector.c:308
i2c_presence_detector_get_distance
float i2c_presence_detector_get_distance(void)
Get presence detector distance.
Definition: i2c_presence_detector.c:260
presence_reg_read_intra_detection_enabled
void presence_reg_read_intra_detection_enabled(uint32_t *value)
Definition: presence_reg_protocol_access.c:150
presence_reg_write_intra_detection_threshold
bool presence_reg_write_intra_detection_threshold(const uint32_t value)
Definition: presence_reg_protocol_access.c:229
acc_detector_presence_config_intra_detection_get
bool acc_detector_presence_config_intra_detection_get(const acc_detector_presence_config_t *presence_config)
Get if frame intra-frame presence detection is enabled.
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.
acc_detector_presence_config_intra_output_time_const_set
void acc_detector_presence_config_intra_output_time_const_set(acc_detector_presence_config_t *presence_config, float intra_output_time_const)
Set the time constant for the output in the intra-frame part.
presence_reg_read_frame_rate
void presence_reg_read_frame_rate(uint32_t *value)
Definition: presence_reg_protocol_access.c:198
i2c_presence_detector_get_result
uint32_t i2c_presence_detector_get_result(void)
Get presence detector result.
Definition: i2c_presence_detector.c:225
presence_reg_read_inter_presence_score
void presence_reg_read_inter_presence_score(uint32_t *value)
Definition: presence_reg_protocol_access.c:101
presence_reg_read_detector_status
void presence_reg_read_detector_status(uint32_t *value)
Definition: presence_reg_protocol_access.c:77
acc_detector_presence_config_inter_detection_threshold_get
float acc_detector_presence_config_inter_detection_threshold_get(const acc_detector_presence_config_t *presence_config)
Get the detection threshold for the inter-frame presence detection.
PRESENCE_REG_PROTOCOL_STATUS_FIELD_WRITE_TO_READ_ONLY_MASK
#define PRESENCE_REG_PROTOCOL_STATUS_FIELD_WRITE_TO_READ_ONLY_MASK
Definition: presence_reg_protocol.h:68
PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE2
#define PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE2
Definition: presence_reg_protocol.h:120
presence_reg_write_automatic_subsweeps
bool presence_reg_write_automatic_subsweeps(const uint32_t value)
Definition: presence_reg_protocol_access.c:645
presence_reg_write_auto_profile_enabled
bool presence_reg_write_auto_profile_enabled(const uint32_t value)
Definition: presence_reg_protocol_access.c:414
i2c_presence_detector.h
presence_reg_write_hwaas
bool presence_reg_write_hwaas(uint32_t value)
Definition: presence_reg_protocol_access.c:622
acc_detector_presence_config_inter_output_time_const_set
void acc_detector_presence_config_inter_output_time_const_set(acc_detector_presence_config_t *presence_config, float inter_output_time_const)
Set the time constant for the output in the inter-frame part.
acc_detector_presence_config_automatic_subsweeps_get
bool acc_detector_presence_config_automatic_subsweeps_get(const acc_detector_presence_config_t *presence_config)
Get if automatic subsweeps should be used.
presence_reg_write_inter_detection_enabled
bool presence_reg_write_inter_detection_enabled(const uint32_t value)
Definition: presence_reg_protocol_access.c:183
acc_detector_presence_config_reset_filters_on_prepare_set
void acc_detector_presence_config_reset_filters_on_prepare_set(acc_detector_presence_config_t *presence_config, bool enable)
Set if the presence filters should reset on prepare.
presence_reg_write_intra_output_time_const
bool presence_reg_write_intra_output_time_const(const uint32_t value)
Definition: presence_reg_protocol_access.c:367
acc_detector_presence_config_inter_frame_deviation_time_const_get
float acc_detector_presence_config_inter_frame_deviation_time_const_get(const acc_detector_presence_config_t *presence_config)
Get the time constant of the low pass filter for the inter-frame deviation between fast and slow.
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
presence_reg_protocol.h
acc_detector_presence_config_intra_detection_set
void acc_detector_presence_config_intra_detection_set(acc_detector_presence_config_t *presence_config, bool enable)
Set intra-frame presence detection.
presence_reg_read_detection_on_gpio
void presence_reg_read_detection_on_gpio(uint32_t *value)
Definition: presence_reg_protocol_access.c:683
acc_detector_presence_config_step_length_get
uint16_t acc_detector_presence_config_step_length_get(const acc_detector_presence_config_t *presence_config)
Get the step length in points.
acc_detector_presence_config_t
struct acc_detector_presence_config acc_detector_presence_config_t
Definition: acc_detector_presence.h:41
ACC_REG_ERROR_FLAG_PROTOCOL_STATE_ERROR
#define ACC_REG_ERROR_FLAG_PROTOCOL_STATE_ERROR
Definition: acc_reg_protocol.h:14
acc_detector_presence_config_auto_profile_get
bool acc_detector_presence_config_auto_profile_get(const acc_detector_presence_config_t *presence_config)
Get if automatic selection of profile based on start point of measurement is enabled.
presence_reg_read_signal_quality
void presence_reg_read_signal_quality(uint32_t *value)
Definition: presence_reg_protocol_access.c:660
presence_reg_read_intra_frame_time_const
void presence_reg_read_intra_frame_time_const(uint32_t *value)
Definition: presence_reg_protocol_access.c:336
acc_detector_presence_config_auto_step_length_get
bool acc_detector_presence_config_auto_step_length_get(const acc_detector_presence_config_t *presence_config)
Get if automatic selection of step length based on the profile is enabled.
acc_detector_presence_config_signal_quality_get
float acc_detector_presence_config_signal_quality_get(const acc_detector_presence_config_t *presence_config)
Get signal quality.
acc_detector_presence_config_inter_frame_slow_cutoff_set
void acc_detector_presence_config_inter_frame_slow_cutoff_set(acc_detector_presence_config_t *presence_config, float inter_frame_slow_cutoff)
Set the cutoff frequency of the low pass filter for the slow filtered absolute sweep mean.
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.
presence_reg_read_auto_step_length_enabled
void presence_reg_read_auto_step_length_enabled(uint32_t *value)
Definition: presence_reg_protocol_access.c:429
ACC_REG_ERROR_FLAG_WRITE_TO_READ_ONLY
#define ACC_REG_ERROR_FLAG_WRITE_TO_READ_ONLY
Definition: acc_reg_protocol.h:18
presence_reg_write_intra_frame_time_const
bool presence_reg_write_intra_frame_time_const(const uint32_t value)
Definition: presence_reg_protocol_access.c:344
i2c_presence_detector_get_inter_presence_score
float i2c_presence_detector_get_inter_presence_score(void)
Get inter presence score.
Definition: i2c_presence_detector.c:284
i2c_presence_detector_get_presence_frame_rate_mhz
uint32_t i2c_presence_detector_get_presence_frame_rate_mhz(void)
Get the actual frame rate for the current presence detector configuration.
Definition: i2c_presence_detector.c:330
acc_reg_protocol.h
presence_reg_write_start
bool presence_reg_write_start(const uint32_t value)
Definition: presence_reg_protocol_access.c:553
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.
presence_reg_read_version
void presence_reg_read_version(uint32_t *value)
Definition: presence_reg_protocol_access.c:34
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.
i2c_presence_detector_get_presence_detected_gpio
bool i2c_presence_detector_get_presence_detected_gpio(void)
Get gpio output for presence detected state.
Definition: i2c_presence_detector.c:318
presence_reg_read_application_id
void presence_reg_read_application_id(uint32_t *value)
Definition: presence_reg_protocol_access.c:29
acc_integration_critical_section_enter
void acc_integration_critical_section_enter(void)
Definition: acc_integration_cortex.c:9
presence_reg_write_inter_output_time_const
bool presence_reg_write_inter_output_time_const(const uint32_t value)
Definition: presence_reg_protocol_access.c:390
acc_config_profile_t
acc_config_profile_t
Profile.
Definition: acc_definitions_a121.h:49
presence_reg_write_inter_frame_deviation_time_const
bool presence_reg_write_inter_frame_deviation_time_const(const uint32_t value)
Definition: presence_reg_protocol_access.c:275
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.
i2c_presence_detector_get_intra_presence_score
float i2c_presence_detector_get_intra_presence_score(void)
Get intra presence score.
Definition: i2c_presence_detector.c:272
PRESENCE_REG_PROTOCOL_STATUS_FIELD_ADDRESS_ERROR_MASK
#define PRESENCE_REG_PROTOCOL_STATUS_FIELD_ADDRESS_ERROR_MASK
Definition: presence_reg_protocol.h:64
acc_detector_presence_config_inter_frame_fast_cutoff_get
float acc_detector_presence_config_inter_frame_fast_cutoff_get(const acc_detector_presence_config_t *presence_config)
Get the cutoff frequency of the low pass filter for the fast filtered absolute sweep mean.
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.
get_protocol_error_flags
static uint32_t get_protocol_error_flags(void)
Get the protocol error status flags.
Definition: presence_reg_protocol_access.c:718
presence_reg_read_inter_detection_enabled
void presence_reg_read_inter_detection_enabled(uint32_t *value)
Definition: presence_reg_protocol_access.c:174
acc_detector_presence_config_intra_frame_time_const_get
float acc_detector_presence_config_intra_frame_time_const_get(const acc_detector_presence_config_t *presence_config)
Get the time constant for the depthwise filtering in the intra-frame part.
acc_detector_presence_config_signal_quality_set
void acc_detector_presence_config_signal_quality_set(acc_detector_presence_config_t *presence_config, float signal_quality)
Set signal quality.
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
PRESENCE_REG_PROTOCOL_STATUS_FIELD_WRITE_FAILED_MASK
#define PRESENCE_REG_PROTOCOL_STATUS_FIELD_WRITE_FAILED_MASK
Definition: presence_reg_protocol.h:66
acc_detector_presence.h
acc_detector_presence_config_intra_output_time_const_get
float acc_detector_presence_config_intra_output_time_const_get(const acc_detector_presence_config_t *presence_config)
Get the time constant for the output in the intra-frame part.
presence_reg_write_reset_filters_on_prepare
bool presence_reg_write_reset_filters_on_prepare(const uint32_t value)
Definition: presence_reg_protocol_access.c:600
presence_reg_read_inter_frame_presence_timeout
void presence_reg_read_inter_frame_presence_timeout(uint32_t *value)
Definition: presence_reg_protocol_access.c:129
acc_detector_presence_config_inter_detection_threshold_set
void acc_detector_presence_config_inter_detection_threshold_set(acc_detector_presence_config_t *presence_config, float inter_detection_threshold)
Set the detection threshold for the inter-frame presence detection.
acc_detector_presence_config_auto_step_length_set
void acc_detector_presence_config_auto_step_length_set(acc_detector_presence_config_t *presence_config, bool enable)
Enable automatic selection of step length based on the profile.
PRESENCE_REG_PROTOCOL_STATUS_FIELD_PACKET_LENGTH_ERROR_MASK
#define PRESENCE_REG_PROTOCOL_STATUS_FIELD_PACKET_LENGTH_ERROR_MASK
Definition: presence_reg_protocol.h:62
presence_reg_write_manual_profile
bool presence_reg_write_manual_profile(const uint32_t value)
Definition: presence_reg_protocol_access.c:483
presence_reg_read_inter_output_time_const
void presence_reg_read_inter_output_time_const(uint32_t *value)
Definition: presence_reg_protocol_access.c:382
acc_detector_presence_config_intra_frame_time_const_set
void acc_detector_presence_config_intra_frame_time_const_set(acc_detector_presence_config_t *presence_config, float intra_frame_time_const)
Set the time constant for the depthwise filtering in the intra-frame part.
presence_reg_read_hwaas
void presence_reg_read_hwaas(uint32_t *value)
Definition: presence_reg_protocol_access.c:615
acc_detector_presence_config_step_length_set
void acc_detector_presence_config_step_length_set(acc_detector_presence_config_t *presence_config, uint16_t step_length)
Set the step length in points.
ACC_CONFIG_PROFILE_3
@ ACC_CONFIG_PROFILE_3
Definition: acc_definitions_a121.h:54
acc_detector_presence_config_automatic_subsweeps_set
void acc_detector_presence_config_automatic_subsweeps_set(acc_detector_presence_config_t *presence_config, bool automatic_subsweeps)
Set if automatic subsweeps should be used.
i2c_presence_detector_command
bool i2c_presence_detector_command(uint32_t command)
Send command to be executed to i2c presence detector.
Definition: i2c_presence_detector.c:191
acc_detector_presence_config_inter_frame_fast_cutoff_set
void acc_detector_presence_config_inter_frame_fast_cutoff_set(acc_detector_presence_config_t *presence_config, float inter_frame_fast_cutoff)
Set the cutoff frequency of the low pass filter for the fast filtered absolute sweep mean.
presence_reg_write_signal_quality
bool presence_reg_write_signal_quality(const uint32_t value)
Definition: presence_reg_protocol_access.c:668