presence_reg_protocol_access.c
Go to the documentation of this file.
1 // Copyright (c) Acconeer AB, 2023
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 /**
20  * @brief Get the protocol error status flags
21  *
22  * @return error flags as uint32 register value
23  */
24 static uint32_t get_protocol_error_flags(void);
25 
26 
27 //
28 // REGISTER READ/WRITE ACCESS FUNCTIONS
29 //
30 
31 
32 void presence_reg_read_version(uint32_t *value)
33 {
34  *value = acc_version_get_hex();
35 }
36 
37 
38 void presence_reg_read_protocol_status(uint32_t *value)
39 {
40  uint32_t error_flags = get_protocol_error_flags();
41  uint32_t protocol_status = 0;
42 
43  if ((error_flags & ACC_REG_ERROR_FLAG_PROTOCOL_STATE_ERROR) != 0)
44  {
46  }
47 
48  if ((error_flags & ACC_REG_ERROR_FLAG_PACKET_LENGTH_ERROR) != 0)
49  {
51  }
52 
53  if ((error_flags & ACC_REG_ERROR_FLAG_ADDRESS_ERROR) != 0)
54  {
56  }
57 
58  if ((error_flags & ACC_REG_ERROR_FLAG_WRITE_FAILED) != 0)
59  {
61  }
62 
63  if ((error_flags & ACC_REG_ERROR_FLAG_WRITE_TO_READ_ONLY) != 0)
64  {
66  }
67 
68  *value = protocol_status;
69 }
70 
71 
72 void presence_reg_read_measure_counter(uint32_t *value)
73 {
75 }
76 
77 
78 void presence_reg_read_detector_status(uint32_t *value)
79 {
81 }
82 
83 
84 void presence_reg_read_presence_result(uint32_t *value)
85 {
87 }
88 
89 
91 {
92  float float_value = i2c_presence_detector_get_distance();
93 
94  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
95 }
96 
97 
99 {
101 
102  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
103 }
104 
105 
107 {
109 
110  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
111 }
112 
113 
115 {
117 
119 }
120 
121 
122 bool presence_reg_write_sweeps_per_frame(const uint32_t value)
123 {
124  bool status = false;
126 
127  if (config != NULL)
128  {
130  status = true;
131  }
132 
133  return status;
134 }
135 
136 
138 {
140 
142 }
143 
144 
146 {
147  bool status = false;
149 
150  if (config != NULL)
151  {
153  status = true;
154  }
155 
156  return status;
157 }
158 
159 
161 {
163 
164  bool bool_value = acc_detector_presence_config_inter_phase_boost_get(config);
165 
166  *value = bool_value ? 1 : 0;
167 }
168 
169 
171 {
172  bool status = false;
174 
175  if (config != NULL)
176  {
177  bool enabled = (value != 0);
179  status = true;
180  }
181 
182  return status;
183 }
184 
185 
187 {
189 
190  bool bool_value = acc_detector_presence_config_intra_detection_get(config);
191 
192  *value = bool_value ? 1 : 0;
193 }
194 
195 
197 {
198  bool status = false;
200 
201  if (config != NULL)
202  {
203  bool enabled = (value != 0);
205  status = true;
206  }
207 
208  return status;
209 }
210 
211 
213 {
215 
216  bool bool_value = acc_detector_presence_config_inter_detection_get(config);
217 
218  *value = bool_value ? 1 : 0;
219 }
220 
221 
223 {
224  bool status = false;
226 
227  if (config != NULL)
228  {
229  bool enabled = (value != 0);
231  status = true;
232  }
233 
234  return status;
235 }
236 
237 
238 void presence_reg_read_frame_rate(uint32_t *value)
239 {
241  float float_value = acc_detector_presence_config_frame_rate_get(config);
242 
243  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
244 }
245 
246 
247 bool presence_reg_write_frame_rate(const uint32_t value)
248 {
249  bool status = false;
251 
252  if (config != NULL)
253  {
254  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
255  acc_detector_presence_config_frame_rate_set(config, float_value);
256  status = true;
257  }
258 
259  return status;
260 }
261 
262 
264 {
267 
268  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
269 }
270 
271 
273 {
274  bool status = false;
276 
277  if (config != NULL)
278  {
279  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
281  status = true;
282  }
283 
284  return status;
285 }
286 
287 
289 {
292 
293  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
294 }
295 
296 
298 {
299  bool status = false;
301 
302  if (config != NULL)
303  {
304  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
306  status = true;
307  }
308 
309  return status;
310 }
311 
312 
314 {
317 
318  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
319 }
320 
321 
323 {
324  bool status = false;
326 
327  if (config != NULL)
328  {
329  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
331  status = true;
332  }
333 
334  return status;
335 }
336 
337 
339 {
342 
343  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
344 }
345 
346 
348 {
349  bool status = false;
351 
352  if (config != NULL)
353  {
354  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
356  status = true;
357  }
358 
359  return status;
360 }
361 
362 
364 {
367 
368  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
369 }
370 
371 
373 {
374  bool status = false;
376 
377  if (config != NULL)
378  {
379  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
381  status = true;
382  }
383 
384  return status;
385 }
386 
387 
389 {
392 
393  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
394 }
395 
396 
398 {
399  bool status = false;
401 
402  if (config != NULL)
403  {
404  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
406  status = true;
407  }
408 
409  return status;
410 }
411 
412 
414 {
417 
418  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
419 }
420 
421 
423 {
424  bool status = false;
426 
427  if (config != NULL)
428  {
429  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
431  status = true;
432  }
433 
434  return status;
435 }
436 
437 
439 {
442 
443  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
444 }
445 
446 
448 {
449  bool status = false;
451 
452  if (config != NULL)
453  {
454  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
456  status = true;
457  }
458 
459  return status;
460 }
461 
462 
464 {
466 
467  bool bool_value = acc_detector_presence_config_auto_profile_get(config);
468 
469  *value = bool_value ? 1 : 0;
470 }
471 
472 
473 bool presence_reg_write_auto_profile_enabled(const uint32_t value)
474 {
475  bool status = false;
477 
478  if (config != NULL)
479  {
480  bool enabled = (value != 0);
482  status = true;
483  }
484 
485  return status;
486 }
487 
488 
490 {
492 
493  bool bool_value = acc_detector_presence_config_auto_step_length_get(config);
494 
495  *value = bool_value ? 1 : 0;
496 }
497 
498 
500 {
501  bool status = false;
503 
504  if (config != NULL)
505  {
506  bool enabled = (value != 0);
508  status = true;
509  }
510 
511  return status;
512 }
513 
514 
515 void presence_reg_read_manual_profile(uint32_t *value)
516 {
519  uint32_t profile_value = 0;
520 
521  switch (profile)
522  {
525  break;
528  break;
531  break;
534  break;
537  break;
538  default:
539  break;
540  }
541 
542  *value = profile_value;
543 }
544 
545 
546 bool presence_reg_write_manual_profile(const uint32_t value)
547 {
548  bool status = false;
550 
551  if (config != NULL)
552  {
553  status = true;
555 
556  switch (value)
557  {
559  profile = ACC_CONFIG_PROFILE_1;
560  break;
562  profile = ACC_CONFIG_PROFILE_2;
563  break;
565  profile = ACC_CONFIG_PROFILE_3;
566  break;
568  profile = ACC_CONFIG_PROFILE_4;
569  break;
571  profile = ACC_CONFIG_PROFILE_5;
572  break;
573  default:
574  status = false;
575  break;
576  }
577 
578  if (status)
579  {
581  }
582  }
583 
584  return status;
585 }
586 
587 
589 {
591 
593 }
594 
595 
596 bool presence_reg_write_manual_step_length(const uint32_t value)
597 {
598  bool status = false;
600 
601  if (config != NULL)
602  {
604  status = true;
605  }
606 
607  return status;
608 }
609 
610 
611 void presence_reg_read_start(uint32_t *value)
612 {
614  float float_value = acc_detector_presence_config_start_get(config);
615 
616  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
617 }
618 
619 
620 bool presence_reg_write_start(const uint32_t value)
621 {
622  bool status = false;
624 
625  if (config != NULL)
626  {
627  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
628  acc_detector_presence_config_start_set(config, float_value);
629  status = true;
630  }
631 
632  return status;
633 }
634 
635 
636 void presence_reg_read_end(uint32_t *value)
637 {
639  float float_value = acc_detector_presence_config_end_get(config);
640 
641  *value = acc_reg_protocol_float_to_uint32_milli(float_value);
642 }
643 
644 
645 bool presence_reg_write_end(const uint32_t value)
646 {
647  bool status = false;
649 
650  if (config != NULL)
651  {
652  float float_value = acc_reg_protocol_uint32_milli_to_float(value);
653  acc_detector_presence_config_end_set(config, float_value);
654  status = true;
655  }
656 
657  return status;
658 }
659 
660 
662 {
664 
666 
667  *value = bool_value ? 1 : 0;
668 }
669 
670 
672 {
673  bool status = false;
675 
676  if (config != NULL)
677  {
678  bool enabled = (value != 0);
680  status = true;
681  }
682 
683  return status;
684 }
685 
686 
687 void presence_reg_read_hwaas(uint32_t *value)
688 {
690 
692 }
693 
694 
695 bool presence_reg_write_hwaas(uint32_t value)
696 {
697  bool status = false;
699 
700  if (config != NULL)
701  {
703  status = true;
704  }
705 
706  return status;
707 }
708 
709 
711 {
713  {
714  *value = 1;
715  }
716  else
717  {
718  *value = 0;
719  }
720 }
721 
722 
723 bool presence_reg_write_detection_on_gpio(const uint32_t value)
724 {
725  bool enable = (value != 0);
726 
728 
729  return true;
730 }
731 
732 
733 bool presence_reg_write_command(const uint32_t value)
734 {
735  return i2c_presence_detector_command(value);
736 }
737 
738 
739 //
740 // PRIVATE HELPER FUNCTIONS
741 //
742 
743 
744 static uint32_t get_protocol_error_flags(void)
745 {
746  /* Make sure we do not have a race for error flags */
748 
749  uint32_t error_flags = acc_reg_protocol_get_error_flags();
750 
752 
753  return error_flags;
754 }
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:372
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:413
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:338
presence_reg_read_manual_profile
void presence_reg_read_manual_profile(uint32_t *value)
Definition: presence_reg_protocol_access.c:515
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:347
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:230
ACC_REG_ERROR_FLAG_PACKET_LENGTH_ERROR
#define ACC_REG_ERROR_FLAG_PACKET_LENGTH_ERROR
Definition: acc_reg_protocol.h:15
acc_detector_presence_config_inter_phase_boost_set
void acc_detector_presence_config_inter_phase_boost_set(acc_detector_presence_config_t *presence_config, bool enable)
Set inter-frame phase boost.
acc_config_profile_t
acc_config_profile_t
Profile.
Definition: acc_definitions_a121.h:39
presence_reg_write_intra_detection_enabled
bool presence_reg_write_intra_detection_enabled(const uint32_t value)
Definition: presence_reg_protocol_access.c:196
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:499
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:723
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:596
presence_reg_read_intra_detection_threshold
void presence_reg_read_intra_detection_threshold(uint32_t *value)
Definition: presence_reg_protocol_access.c:263
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:114
presence_reg_read_reset_filters_on_prepare
void presence_reg_read_reset_filters_on_prepare(uint32_t *value)
Definition: presence_reg_protocol_access.c:661
presence_reg_read_intra_presence_score
void presence_reg_read_intra_presence_score(uint32_t *value)
Definition: presence_reg_protocol_access.c:98
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:90
presence_reg_write_end
bool presence_reg_write_end(const uint32_t value)
Definition: presence_reg_protocol_access.c:645
presence_reg_read_protocol_status
void presence_reg_read_protocol_status(uint32_t *value)
Definition: presence_reg_protocol_access.c:38
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:18
presence_reg_read_inter_detection_threshold
void presence_reg_read_inter_detection_threshold(uint32_t *value)
Definition: presence_reg_protocol_access.c:288
presence_reg_read_start
void presence_reg_read_start(uint32_t *value)
Definition: presence_reg_protocol_access.c:611
presence_reg_write_inter_detection_threshold
bool presence_reg_write_inter_detection_threshold(const uint32_t value)
Definition: presence_reg_protocol_access.c:297
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:313
i2c_presence_detector_get_counter
uint32_t i2c_presence_detector_get_counter(void)
Get presence detector measure counter.
Definition: i2c_presence_detector.c:318
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:588
acc_version_get_hex
uint32_t acc_version_get_hex(void)
Get the version of the Acconeer software as a hex number.
ACC_CONFIG_PROFILE_4
@ ACC_CONFIG_PROFILE_4
Definition: acc_definitions_a121.h:45
presence_reg_write_sweeps_per_frame
bool presence_reg_write_sweeps_per_frame(const uint32_t value)
Definition: presence_reg_protocol_access.c:122
PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE3
#define PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE3
Definition: presence_reg_protocol.h:118
presence_reg_write_command
bool presence_reg_write_command(const uint32_t value)
Definition: presence_reg_protocol_access.c:733
presence_reg_read_end
void presence_reg_read_end(uint32_t *value)
Definition: presence_reg_protocol_access.c:636
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:116
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:145
PRESENCE_REG_PROTOCOL_STATUS_FIELD_PROTOCOL_STATE_ERROR_MASK
#define PRESENCE_REG_PROTOCOL_STATUS_FIELD_PROTOCOL_STATE_ERROR_MASK
Definition: presence_reg_protocol.h:57
presence_reg_read_auto_profile_enabled
void presence_reg_read_auto_profile_enabled(uint32_t *value)
Definition: presence_reg_protocol_access.c:463
PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE4
#define PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE4
Definition: presence_reg_protocol.h:119
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:84
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:363
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)
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:201
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:120
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:247
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:331
i2c_presence_detector_get_distance
float i2c_presence_detector_get_distance(void)
Get presence detector distance.
Definition: i2c_presence_detector.c:279
presence_reg_read_intra_detection_enabled
void presence_reg_read_intra_detection_enabled(uint32_t *value)
Definition: presence_reg_protocol_access.c:186
presence_reg_write_intra_detection_threshold
bool presence_reg_write_intra_detection_threshold(const uint32_t value)
Definition: presence_reg_protocol_access.c:272
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:238
i2c_presence_detector_get_result
uint32_t i2c_presence_detector_get_result(void)
Get presence detector result.
Definition: i2c_presence_detector.c:243
ACC_CONFIG_PROFILE_5
@ ACC_CONFIG_PROFILE_5
Definition: acc_definitions_a121.h:47
presence_reg_read_inter_presence_score
void presence_reg_read_inter_presence_score(uint32_t *value)
Definition: presence_reg_protocol_access.c:106
presence_reg_read_detector_status
void presence_reg_read_detector_status(uint32_t *value)
Definition: presence_reg_protocol_access.c:78
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:65
PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE2
#define PRESENCE_REG_MANUAL_PROFILE_ENUM_PROFILE2
Definition: presence_reg_protocol.h:117
presence_reg_write_auto_profile_enabled
bool presence_reg_write_auto_profile_enabled(const uint32_t value)
Definition: presence_reg_protocol_access.c:473
i2c_presence_detector.h
presence_reg_write_hwaas
bool presence_reg_write_hwaas(uint32_t value)
Definition: presence_reg_protocol_access.c:695
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.
presence_reg_write_inter_detection_enabled
bool presence_reg_write_inter_detection_enabled(const uint32_t value)
Definition: presence_reg_protocol_access.c:222
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:422
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:710
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:44
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_intra_frame_time_const
void presence_reg_read_intra_frame_time_const(uint32_t *value)
Definition: presence_reg_protocol_access.c:388
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_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:489
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:397
presence_reg_write_inter_phase_boost_enabled
bool presence_reg_write_inter_phase_boost_enabled(const uint32_t value)
Definition: presence_reg_protocol_access.c:170
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:305
acc_reg_protocol.h
presence_reg_read_inter_phase_boost_enabled
void presence_reg_read_inter_phase_boost_enabled(uint32_t *value)
Definition: presence_reg_protocol_access.c:160
presence_reg_write_start
bool presence_reg_write_start(const uint32_t value)
Definition: presence_reg_protocol_access.c:620
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:32
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:342
acc_integration_critical_section_enter
void acc_integration_critical_section_enter(void)
Definition: acc_integration_cortex.c:10
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:447
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:322
ACC_CONFIG_PROFILE_2
@ ACC_CONFIG_PROFILE_2
Definition: acc_definitions_a121.h:43
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:292
PRESENCE_REG_PROTOCOL_STATUS_FIELD_ADDRESS_ERROR_MASK
#define PRESENCE_REG_PROTOCOL_STATUS_FIELD_ADDRESS_ERROR_MASK
Definition: presence_reg_protocol.h:61
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.
acc_detector_presence_config_inter_phase_boost_get
bool acc_detector_presence_config_inter_phase_boost_get(const acc_detector_presence_config_t *presence_config)
Get if inter-frame phase boost is enabled.
get_protocol_error_flags
static uint32_t get_protocol_error_flags(void)
Get the protocol error status flags.
Definition: presence_reg_protocol_access.c:744
presence_reg_read_inter_detection_enabled
void presence_reg_read_inter_detection_enabled(uint32_t *value)
Definition: presence_reg_protocol_access.c:212
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_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_3
@ ACC_CONFIG_PROFILE_3
Definition: acc_definitions_a121.h:44
PRESENCE_REG_PROTOCOL_STATUS_FIELD_WRITE_FAILED_MASK
#define PRESENCE_REG_PROTOCOL_STATUS_FIELD_WRITE_FAILED_MASK
Definition: presence_reg_protocol.h:63
ACC_CONFIG_PROFILE_1
@ ACC_CONFIG_PROFILE_1
Definition: acc_definitions_a121.h:42
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:671
presence_reg_read_inter_frame_presence_timeout
void presence_reg_read_inter_frame_presence_timeout(uint32_t *value)
Definition: presence_reg_protocol_access.c:137
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:59
presence_reg_write_manual_profile
bool presence_reg_write_manual_profile(const uint32_t value)
Definition: presence_reg_protocol_access.c:546
presence_reg_read_inter_output_time_const
void presence_reg_read_inter_output_time_const(uint32_t *value)
Definition: presence_reg_protocol_access.c:438
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:687
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.
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:207
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.