distance_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_distance.h"
12 #include "acc_integration.h"
13 #include "acc_version.h"
14 
15 #include "acc_reg_protocol.h"
16 #include "distance_reg_protocol.h"
17 #include "i2c_distance_detector.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  * @brief Get peak distance
30  *
31  * This function will return the peak distance in mm
32  *
33  * @param[in] peak_id The index of the peak
34  * @return The uint32 value representation of the peak distance
35  */
36 static uint32_t get_peak_distance(uint16_t peak_id);
37 
38 
39 /**
40  * @brief Get peak strength
41  *
42  * This function will return the peak distance in dB * 1000
43  *
44  * @param[in] peak_id The index of the peak
45  * @return The int32 value representation of the peak strength
46  */
47 static uint32_t get_peak_strength(uint16_t peak_id);
48 
49 
50 //
51 // REGISTER READ/WRITE ACCESS FUNCTIONS
52 //
53 
54 
55 void distance_reg_read_application_id(uint32_t *value)
56 {
58 }
59 
60 
61 void distance_reg_read_version(uint32_t *value)
62 {
63  *value = acc_version_get_hex();
64 }
65 
66 
67 void distance_reg_read_protocol_status(uint32_t *value)
68 {
69  uint32_t error_flags = get_protocol_error_flags();
70  uint32_t protocol_status = 0;
71 
72  if ((error_flags & ACC_REG_ERROR_FLAG_PROTOCOL_STATE_ERROR) != 0)
73  {
75  }
76 
77  if ((error_flags & ACC_REG_ERROR_FLAG_PACKET_LENGTH_ERROR) != 0)
78  {
80  }
81 
82  if ((error_flags & ACC_REG_ERROR_FLAG_ADDRESS_ERROR) != 0)
83  {
85  }
86 
87  if ((error_flags & ACC_REG_ERROR_FLAG_WRITE_FAILED) != 0)
88  {
90  }
91 
92  if ((error_flags & ACC_REG_ERROR_FLAG_WRITE_TO_READ_ONLY) != 0)
93  {
95  }
96 
97  *value = protocol_status;
98 }
99 
100 
102 {
104 }
105 
106 
108 {
110 }
111 
112 
114 {
116 }
117 
118 
119 void distance_reg_read_peak0_distance(uint32_t *value)
120 {
121  *value = get_peak_distance(0);
122 }
123 
124 
125 void distance_reg_read_peak1_distance(uint32_t *value)
126 {
127  *value = get_peak_distance(1);
128 }
129 
130 
131 void distance_reg_read_peak2_distance(uint32_t *value)
132 {
133  *value = get_peak_distance(2);
134 }
135 
136 
137 void distance_reg_read_peak3_distance(uint32_t *value)
138 {
139  *value = get_peak_distance(3);
140 }
141 
142 
143 void distance_reg_read_peak4_distance(uint32_t *value)
144 {
145  *value = get_peak_distance(4);
146 }
147 
148 
149 void distance_reg_read_peak5_distance(uint32_t *value)
150 {
151  *value = get_peak_distance(5);
152 }
153 
154 
155 void distance_reg_read_peak6_distance(uint32_t *value)
156 {
157  *value = get_peak_distance(6);
158 }
159 
160 
161 void distance_reg_read_peak7_distance(uint32_t *value)
162 {
163  *value = get_peak_distance(7);
164 }
165 
166 
167 void distance_reg_read_peak8_distance(uint32_t *value)
168 {
169  *value = get_peak_distance(8);
170 }
171 
172 
173 void distance_reg_read_peak9_distance(uint32_t *value)
174 {
175  *value = get_peak_distance(9);
176 }
177 
178 
179 void distance_reg_read_peak0_strength(uint32_t *value)
180 {
181  *value = get_peak_strength(0);
182 }
183 
184 
185 void distance_reg_read_peak1_strength(uint32_t *value)
186 {
187  *value = get_peak_strength(1);
188 }
189 
190 
191 void distance_reg_read_peak2_strength(uint32_t *value)
192 {
193  *value = get_peak_strength(2);
194 }
195 
196 
197 void distance_reg_read_peak3_strength(uint32_t *value)
198 {
199  *value = get_peak_strength(3);
200 }
201 
202 
203 void distance_reg_read_peak4_strength(uint32_t *value)
204 {
205  *value = get_peak_strength(4);
206 }
207 
208 
209 void distance_reg_read_peak5_strength(uint32_t *value)
210 {
211  *value = get_peak_strength(5);
212 }
213 
214 
215 void distance_reg_read_peak6_strength(uint32_t *value)
216 {
217  *value = get_peak_strength(6);
218 }
219 
220 
221 void distance_reg_read_peak7_strength(uint32_t *value)
222 {
223  *value = get_peak_strength(7);
224 }
225 
226 
227 void distance_reg_read_peak8_strength(uint32_t *value)
228 {
229  *value = get_peak_strength(8);
230 }
231 
232 
233 void distance_reg_read_peak9_strength(uint32_t *value)
234 {
235  *value = get_peak_strength(9);
236 }
237 
238 
239 void distance_reg_read_start(uint32_t *value)
240 {
243 
245 }
246 
247 
248 bool distance_reg_write_start(const uint32_t value)
249 {
250  bool status = false;
252 
253  if (config != NULL)
254  {
255  float start = acc_reg_protocol_uint32_milli_to_float(value);
257  status = true;
258  }
259 
260  return status;
261 }
262 
263 
264 void distance_reg_read_end(uint32_t *value)
265 {
268 
270 }
271 
272 
273 bool distance_reg_write_end(const uint32_t value)
274 {
275  bool status = false;
277 
278  if (config != NULL)
279  {
280  float end = acc_reg_protocol_uint32_milli_to_float(value);
282  status = true;
283  }
284 
285  return status;
286 }
287 
288 
290 {
292 
294 }
295 
296 
297 bool distance_reg_write_max_step_length(const uint32_t value)
298 {
299  bool status = false;
301 
302  if (config != NULL)
303  {
305  status = true;
306  }
307 
308  return status;
309 }
310 
311 
313 {
315 
317 }
318 
319 
321 {
322  bool status = false;
324 
325  if (config != NULL)
326  {
328  status = true;
329  }
330 
331  return status;
332 }
333 
334 
335 void distance_reg_read_signal_quality(uint32_t *value)
336 {
339 
340  *value = acc_reg_protocol_float_to_int32_milli(signal_quality);
341 }
342 
343 
344 bool distance_reg_write_signal_quality(const uint32_t value)
345 {
346  bool status = false;
348 
349  if (config != NULL)
350  {
351  float signal_quality = acc_reg_protocol_int32_milli_to_float(value);
353  status = true;
354  }
355 
356  return status;
357 }
358 
359 
360 void distance_reg_read_max_profile(uint32_t *value)
361 {
364  uint32_t profile_value = 0;
365 
366  switch (profile)
367  {
370  break;
373  break;
376  break;
379  break;
382  break;
383  default:
384  break;
385  }
386 
387  *value = profile_value;
388 }
389 
390 
391 bool distance_reg_write_max_profile(const uint32_t value)
392 {
393  bool status = false;
395 
396  if (config != NULL)
397  {
398  status = true;
400 
401  switch (value)
402  {
404  profile = ACC_CONFIG_PROFILE_1;
405  break;
407  profile = ACC_CONFIG_PROFILE_2;
408  break;
410  profile = ACC_CONFIG_PROFILE_3;
411  break;
413  profile = ACC_CONFIG_PROFILE_4;
414  break;
416  profile = ACC_CONFIG_PROFILE_5;
417  break;
418  default:
419  status = false;
420  break;
421  }
422 
423  if (status)
424  {
426  }
427  }
428 
429  return status;
430 }
431 
432 
434 {
437  uint32_t threshold_method_value = 0;
438 
439  switch (threshold_method)
440  {
443  break;
445  threshold_method_value = DISTANCE_REG_THRESHOLD_METHOD_ENUM_FIXED_STRENGTH;
446  break;
448  threshold_method_value = DISTANCE_REG_THRESHOLD_METHOD_ENUM_RECORDED;
449  break;
451  threshold_method_value = DISTANCE_REG_THRESHOLD_METHOD_ENUM_CFAR;
452  break;
453  default:
454  break;
455  }
456 
457  *value = threshold_method_value;
458 }
459 
460 
461 bool distance_reg_write_threshold_method(const uint32_t value)
462 {
463  bool status = false;
465 
466  if (config != NULL)
467  {
468  status = true;
470 
471  switch (value)
472  {
475  break;
478  break;
481  break;
484  break;
485  default:
486  status = false;
487  break;
488  }
489 
490  if (status)
491  {
493  }
494  }
495 
496  return status;
497 }
498 
499 
500 void distance_reg_read_peak_sorting(uint32_t *value)
501 {
504  uint32_t peak_sorting_value = 0;
505 
506  switch (peak_sorting)
507  {
509  peak_sorting_value = DISTANCE_REG_PEAK_SORTING_ENUM_CLOSEST;
510  break;
512  peak_sorting_value = DISTANCE_REG_PEAK_SORTING_ENUM_STRONGEST;
513  break;
514  default:
515  break;
516  }
517 
518  *value = peak_sorting_value;
519 }
520 
521 
522 bool distance_reg_write_peak_sorting(const uint32_t value)
523 {
524  bool status = false;
526 
527  if (config != NULL)
528  {
529  status = true;
531 
532  switch (value)
533  {
536  break;
539  break;
540  default:
541  status = false;
542  break;
543  }
544 
545  if (status)
546  {
548  }
549  }
550 
551  return status;
552 }
553 
554 
556 {
558 
560 }
561 
562 
564 {
565  bool status = false;
567 
568  if (config != NULL)
569  {
571  status = true;
572  }
573 
574  return status;
575 }
576 
577 
579 {
582 
583  *value = acc_reg_protocol_float_to_uint32_milli(fixed_threshold_value);
584 }
585 
586 
588 {
589  bool status = false;
591 
592  if (config != NULL)
593  {
594  float fixed_threshold_value = acc_reg_protocol_uint32_milli_to_float(value);
596  status = true;
597  }
598 
599  return status;
600 }
601 
602 
604 {
607 
608  *value = acc_reg_protocol_float_to_int32_milli(fixed_threshold_value);
609 }
610 
611 
613 {
614  bool status = false;
616 
617  if (config != NULL)
618  {
619  float fixed_threshold_value = acc_reg_protocol_int32_milli_to_float(value);
621  status = true;
622  }
623 
624  return status;
625 }
626 
627 
629 {
631  float threshold_sensitivity = acc_detector_distance_config_threshold_sensitivity_get(config);
632 
633  *value = acc_reg_protocol_float_to_uint32_milli(threshold_sensitivity);
634 }
635 
636 
638 {
639  bool status = false;
641 
642  if (config != NULL)
643  {
644  float threshold_sensitivity = acc_reg_protocol_uint32_milli_to_float(value);
646  status = true;
647  }
648 
649  return status;
650 }
651 
652 
654 {
657  uint32_t reflector_shape_value = 0;
658 
659  switch (reflector_shape)
660  {
662  reflector_shape_value = DISTANCE_REG_REFLECTOR_SHAPE_ENUM_GENERIC;
663  break;
665  reflector_shape_value = DISTANCE_REG_REFLECTOR_SHAPE_ENUM_PLANAR;
666  break;
667  default:
668  break;
669  }
670 
671  *value = reflector_shape_value;
672 }
673 
674 
675 bool distance_reg_write_reflector_shape(const uint32_t value)
676 {
677  bool status = false;
679 
680  if (config != NULL)
681  {
682  status = true;
684 
685  switch (value)
686  {
689  break;
692  break;
693  default:
694  status = false;
695  break;
696  }
697 
698  if (status)
699  {
701  }
702  }
703 
704  return status;
705 }
706 
707 
709 {
711  {
712  *value = 1;
713  }
714  else
715  {
716  *value = 0;
717  }
718 }
719 
720 
721 bool distance_reg_write_measure_on_wakeup(const uint32_t value)
722 {
723  bool enable = (value != 0);
724 
726 
727  return true;
728 }
729 
730 
731 bool distance_reg_write_command(const uint32_t value)
732 {
733  return i2c_distance_detector_command(value);
734 }
735 
736 
737 //
738 // PRIVATE HELPER FUNCTIONS
739 //
740 
741 
742 static uint32_t get_protocol_error_flags(void)
743 {
744  /* Make sure we do not have a race for error flags */
746 
747  uint32_t error_flags = acc_reg_protocol_get_error_flags();
748 
750 
751  return error_flags;
752 }
753 
754 
755 static uint32_t get_peak_distance(uint16_t peak_id)
756 {
757  float distance = i2c_distance_detector_get_peak_distance(peak_id);
758 
760 }
761 
762 
763 static uint32_t get_peak_strength(uint16_t peak_id)
764 {
765  float strength = i2c_distance_detector_get_peak_strength(peak_id);
766 
767  return acc_reg_protocol_float_to_int32_milli(strength);
768 }
distance_reg_read_reflector_shape
void distance_reg_read_reflector_shape(uint32_t *value)
Definition: distance_reg_protocol_access.c:653
distance_reg_read_peak9_distance
void distance_reg_read_peak9_distance(uint32_t *value)
Definition: distance_reg_protocol_access.c:173
acc_detector_distance_config_fixed_amplitude_threshold_value_get
float acc_detector_distance_config_fixed_amplitude_threshold_value_get(const acc_detector_distance_config_t *config)
Get fixed amplitude threshold value.
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_distance_threshold_method_t
acc_detector_distance_threshold_method_t
Enum for threshold methods.
Definition: acc_detector_distance_definitions.h:42
DISTANCE_REG_PROTOCOL_STATUS_FIELD_WRITE_TO_READ_ONLY_MASK
#define DISTANCE_REG_PROTOCOL_STATUS_FIELD_WRITE_TO_READ_ONLY_MASK
Definition: distance_reg_protocol.h:74
acc_detector_distance_config_peak_sorting_set
void acc_detector_distance_config_peak_sorting_set(acc_detector_distance_config_t *config, acc_detector_distance_peak_sorting_t peak_sorting)
Set peak sorting method.
distance_reg_read_peak0_strength
void distance_reg_read_peak0_strength(uint32_t *value)
Definition: distance_reg_protocol_access.c:179
distance_reg_read_peak7_distance
void distance_reg_read_peak7_distance(uint32_t *value)
Definition: distance_reg_protocol_access.c:161
ACC_CONFIG_PROFILE_4
@ ACC_CONFIG_PROFILE_4
Definition: acc_definitions_a121.h:55
distance_reg_write_fixed_strength_threshold_value
bool distance_reg_write_fixed_strength_threshold_value(const uint32_t value)
Definition: distance_reg_protocol_access.c:612
DISTANCE_REG_MAX_PROFILE_ENUM_PROFILE1
#define DISTANCE_REG_MAX_PROFILE_ENUM_PROFILE1
Definition: distance_reg_protocol.h:135
acc_detector_distance_config_close_range_leakage_cancellation_get
bool acc_detector_distance_config_close_range_leakage_cancellation_get(const acc_detector_distance_config_t *config)
Get if close range leakage cancellation is enabled.
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
distance_reg_read_end
void distance_reg_read_end(uint32_t *value)
Definition: distance_reg_protocol_access.c:264
DISTANCE_REG_THRESHOLD_METHOD_ENUM_FIXED_AMPLITUDE
#define DISTANCE_REG_THRESHOLD_METHOD_ENUM_FIXED_AMPLITUDE
Definition: distance_reg_protocol.h:142
distance_reg_read_distance_result
void distance_reg_read_distance_result(uint32_t *value)
Definition: distance_reg_protocol_access.c:113
acc_version.h
distance_reg_read_num_frames_recorded_threshold
void distance_reg_read_num_frames_recorded_threshold(uint32_t *value)
Definition: distance_reg_protocol_access.c:555
ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_FIXED_AMPLITUDE
@ ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_FIXED_AMPLITUDE
Definition: acc_detector_distance_definitions.h:45
distance_reg_write_close_range_leakage_cancellation
bool distance_reg_write_close_range_leakage_cancellation(const uint32_t value)
Definition: distance_reg_protocol_access.c:320
distance_reg_read_peak9_strength
void distance_reg_read_peak9_strength(uint32_t *value)
Definition: distance_reg_protocol_access.c:233
DISTANCE_REG_THRESHOLD_METHOD_ENUM_FIXED_STRENGTH
#define DISTANCE_REG_THRESHOLD_METHOD_ENUM_FIXED_STRENGTH
Definition: distance_reg_protocol.h:145
distance_reg_read_peak5_distance
void distance_reg_read_peak5_distance(uint32_t *value)
Definition: distance_reg_protocol_access.c:149
ACC_DETECTOR_DISTANCE_PEAK_SORTING_STRONGEST
@ ACC_DETECTOR_DISTANCE_PEAK_SORTING_STRONGEST
Definition: acc_detector_distance_definitions.h:36
ACC_REG_ERROR_FLAG_ADDRESS_ERROR
#define ACC_REG_ERROR_FLAG_ADDRESS_ERROR
Definition: acc_reg_protocol.h:16
acc_detector_distance_config_threshold_method_set
void acc_detector_distance_config_threshold_method_set(acc_detector_distance_config_t *config, acc_detector_distance_threshold_method_t threshold_method)
Set threshold method.
distance_reg_read_peak2_strength
void distance_reg_read_peak2_strength(uint32_t *value)
Definition: distance_reg_protocol_access.c:191
distance_reg_read_measure_on_wakeup
void distance_reg_read_measure_on_wakeup(uint32_t *value)
Definition: distance_reg_protocol_access.c:708
distance_reg_read_max_profile
void distance_reg_read_max_profile(uint32_t *value)
Definition: distance_reg_protocol_access.c:360
acc_detector_distance_config_start_set
void acc_detector_distance_config_start_set(acc_detector_distance_config_t *config, float start_m)
Set start of measured interval (m)
acc_detector_distance_config_fixed_amplitude_threshold_value_set
void acc_detector_distance_config_fixed_amplitude_threshold_value_set(acc_detector_distance_config_t *config, float fixed_threshold_value)
Set fixed amplitude threshold value.
acc_integration_critical_section_exit
void acc_integration_critical_section_exit(void)
Definition: acc_integration_cortex.c:16
distance_reg_read_peak3_distance
void distance_reg_read_peak3_distance(uint32_t *value)
Definition: distance_reg_protocol_access.c:137
acc_detector_distance_config_peak_sorting_get
acc_detector_distance_peak_sorting_t acc_detector_distance_config_peak_sorting_get(const acc_detector_distance_config_t *config)
Get peak sorting method.
distance_reg_write_peak_sorting
bool distance_reg_write_peak_sorting(const uint32_t value)
Definition: distance_reg_protocol_access.c:522
acc_detector_distance_config_num_frames_recorded_threshold_get
uint16_t acc_detector_distance_config_num_frames_recorded_threshold_get(const acc_detector_distance_config_t *config)
Get number of frames to use for recorded threshold.
distance_reg_protocol.h
ACC_CONFIG_PROFILE_5
@ ACC_CONFIG_PROFILE_5
Definition: acc_definitions_a121.h:57
distance_reg_read_max_step_length
void distance_reg_read_max_step_length(uint32_t *value)
Definition: distance_reg_protocol_access.c:289
distance_reg_read_peak6_strength
void distance_reg_read_peak6_strength(uint32_t *value)
Definition: distance_reg_protocol_access.c:215
acc_integration.h
distance_reg_write_start
bool distance_reg_write_start(const uint32_t value)
Definition: distance_reg_protocol_access.c:248
acc_detector_distance_config_threshold_sensitivity_get
float acc_detector_distance_config_threshold_sensitivity_get(const acc_detector_distance_config_t *config)
Get threshold sensitivity.
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
i2c_distance_detector_get_measure_on_wakeup
bool i2c_distance_detector_get_measure_on_wakeup(void)
Get measure on wake up state.
Definition: i2c_distance_detector.c:280
distance_reg_read_peak4_strength
void distance_reg_read_peak4_strength(uint32_t *value)
Definition: distance_reg_protocol_access.c:203
DISTANCE_REG_MAX_PROFILE_ENUM_PROFILE3
#define DISTANCE_REG_MAX_PROFILE_ENUM_PROFILE3
Definition: distance_reg_protocol.h:137
distance_reg_read_detector_status
void distance_reg_read_detector_status(uint32_t *value)
Definition: distance_reg_protocol_access.c:107
distance_reg_write_max_profile
bool distance_reg_write_max_profile(const uint32_t value)
Definition: distance_reg_protocol_access.c:391
distance_reg_read_peak8_distance
void distance_reg_read_peak8_distance(uint32_t *value)
Definition: distance_reg_protocol_access.c:167
acc_detector_distance_config_max_step_length_get
uint16_t acc_detector_distance_config_max_step_length_get(const acc_detector_distance_config_t *config)
Get maximum step length.
acc_detector_distance_reflector_shape_t
acc_detector_distance_reflector_shape_t
Enum for reflector shapes.
Definition: acc_detector_distance_definitions.h:57
DISTANCE_REG_MAX_PROFILE_ENUM_PROFILE4
#define DISTANCE_REG_MAX_PROFILE_ENUM_PROFILE4
Definition: distance_reg_protocol.h:138
ACC_REG_ERROR_FLAG_WRITE_FAILED
#define ACC_REG_ERROR_FLAG_WRITE_FAILED
Definition: acc_reg_protocol.h:17
i2c_distance_detector_get_status
uint32_t i2c_distance_detector_get_status(void)
Get distance detector status.
Definition: i2c_distance_detector.c:188
acc_detector_distance_config_close_range_leakage_cancellation_set
void acc_detector_distance_config_close_range_leakage_cancellation_set(acc_detector_distance_config_t *config, bool enable)
Enable close range leakage cancellation.
ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_PLANAR
@ ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_PLANAR
Definition: acc_detector_distance_definitions.h:62
distance_reg_write_command
bool distance_reg_write_command(const uint32_t value)
Definition: distance_reg_protocol_access.c:731
acc_detector_distance_config_end_get
float acc_detector_distance_config_end_get(const acc_detector_distance_config_t *config)
Get end of measured interval (m)
distance_reg_read_fixed_strength_threshold_value
void distance_reg_read_fixed_strength_threshold_value(uint32_t *value)
Definition: distance_reg_protocol_access.c:603
distance_reg_write_max_step_length
bool distance_reg_write_max_step_length(const uint32_t value)
Definition: distance_reg_protocol_access.c:297
distance_reg_read_peak1_strength
void distance_reg_read_peak1_strength(uint32_t *value)
Definition: distance_reg_protocol_access.c:185
acc_detector_distance_config_max_profile_set
void acc_detector_distance_config_max_profile_set(acc_detector_distance_config_t *config, acc_config_profile_t max_profile)
Set maximum Profile.
acc_detector_distance_config_max_profile_get
acc_config_profile_t acc_detector_distance_config_max_profile_get(const acc_detector_distance_config_t *config)
Get maximum Profile.
ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_FIXED_STRENGTH
@ ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_FIXED_STRENGTH
Definition: acc_detector_distance_definitions.h:47
DISTANCE_REG_PROTOCOL_STATUS_FIELD_ADDRESS_ERROR_MASK
#define DISTANCE_REG_PROTOCOL_STATUS_FIELD_ADDRESS_ERROR_MASK
Definition: distance_reg_protocol.h:70
i2c_distance_detector_get_result
uint32_t i2c_distance_detector_get_result(void)
Get distance detector result.
Definition: i2c_distance_detector.c:200
i2c_distance_detector.h
get_protocol_error_flags
static uint32_t get_protocol_error_flags(void)
Get the protocol error status flags.
Definition: distance_reg_protocol_access.c:742
distance_reg_read_signal_quality
void distance_reg_read_signal_quality(uint32_t *value)
Definition: distance_reg_protocol_access.c:335
distance_reg_write_measure_on_wakeup
bool distance_reg_write_measure_on_wakeup(const uint32_t value)
Definition: distance_reg_protocol_access.c:721
get_peak_distance
static uint32_t get_peak_distance(uint16_t peak_id)
Get peak distance.
Definition: distance_reg_protocol_access.c:755
i2c_distance_detector_get_peak_distance
float i2c_distance_detector_get_peak_distance(uint16_t peak_id)
Get the peak distance for a specific peak id.
Definition: i2c_distance_detector.c:246
acc_detector_distance_config_signal_quality_set
void acc_detector_distance_config_signal_quality_set(acc_detector_distance_config_t *config, float signal_quality)
Set signal quality (dB)
DISTANCE_REG_MAX_PROFILE_ENUM_PROFILE5
#define DISTANCE_REG_MAX_PROFILE_ENUM_PROFILE5
Definition: distance_reg_protocol.h:139
i2c_distance_detector_get_counter
uint32_t i2c_distance_detector_get_counter(void)
Get distance detector measure counter.
Definition: i2c_distance_detector.c:234
DISTANCE_REG_PEAK_SORTING_ENUM_CLOSEST
#define DISTANCE_REG_PEAK_SORTING_ENUM_CLOSEST
Definition: distance_reg_protocol.h:148
DISTANCE_REG_THRESHOLD_METHOD_ENUM_CFAR
#define DISTANCE_REG_THRESHOLD_METHOD_ENUM_CFAR
Definition: distance_reg_protocol.h:144
acc_reg_protocol_float_to_int32_milli
int32_t acc_reg_protocol_float_to_int32_milli(float value)
Convert 1000 * float to int32.
Definition: acc_reg_protocol.c:330
distance_reg_read_application_id
void distance_reg_read_application_id(uint32_t *value)
Definition: distance_reg_protocol_access.c:55
distance_reg_read_protocol_status
void distance_reg_read_protocol_status(uint32_t *value)
Definition: distance_reg_protocol_access.c:67
distance_reg_read_threshold_method
void distance_reg_read_threshold_method(uint32_t *value)
Definition: distance_reg_protocol_access.c:433
distance_reg_read_version
void distance_reg_read_version(uint32_t *value)
Definition: distance_reg_protocol_access.c:61
distance_reg_write_num_frames_recorded_threshold
bool distance_reg_write_num_frames_recorded_threshold(const uint32_t value)
Definition: distance_reg_protocol_access.c:563
distance_reg_read_start
void distance_reg_read_start(uint32_t *value)
Definition: distance_reg_protocol_access.c:239
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
acc_detector_distance_config_fixed_strength_threshold_value_get
float acc_detector_distance_config_fixed_strength_threshold_value_get(const acc_detector_distance_config_t *config)
Get fixed strength threshold value.
distance_reg_read_peak0_distance
void distance_reg_read_peak0_distance(uint32_t *value)
Definition: distance_reg_protocol_access.c:119
distance_reg_read_peak5_strength
void distance_reg_read_peak5_strength(uint32_t *value)
Definition: distance_reg_protocol_access.c:209
i2c_distance_detector_get_config
acc_detector_distance_config_t * i2c_distance_detector_get_config(void)
Get distance detector configuration handle.
Definition: i2c_distance_detector.c:161
distance_reg_read_peak4_distance
void distance_reg_read_peak4_distance(uint32_t *value)
Definition: distance_reg_protocol_access.c:143
DISTANCE_REG_REFLECTOR_SHAPE_ENUM_GENERIC
#define DISTANCE_REG_REFLECTOR_SHAPE_ENUM_GENERIC
Definition: distance_reg_protocol.h:152
ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR
@ ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR
Definition: acc_detector_distance_definitions.h:51
acc_reg_protocol_int32_milli_to_float
float acc_reg_protocol_int32_milli_to_float(int32_t value)
Convert int32 / 1000 to float.
Definition: acc_reg_protocol.c:342
ACC_REG_ERROR_FLAG_PROTOCOL_STATE_ERROR
#define ACC_REG_ERROR_FLAG_PROTOCOL_STATE_ERROR
Definition: acc_reg_protocol.h:14
DISTANCE_REG_PROTOCOL_STATUS_FIELD_PACKET_LENGTH_ERROR_MASK
#define DISTANCE_REG_PROTOCOL_STATUS_FIELD_PACKET_LENGTH_ERROR_MASK
Definition: distance_reg_protocol.h:68
acc_detector_distance_config_end_set
void acc_detector_distance_config_end_set(acc_detector_distance_config_t *config, float end_m)
Set end of measured interval (m)
acc_detector_distance_peak_sorting_t
acc_detector_distance_peak_sorting_t
Enum for peak sorting algorithms.
Definition: acc_detector_distance_definitions.h:31
DISTANCE_REG_PROTOCOL_STATUS_FIELD_PROTOCOL_STATE_ERROR_MASK
#define DISTANCE_REG_PROTOCOL_STATUS_FIELD_PROTOCOL_STATE_ERROR_MASK
Definition: distance_reg_protocol.h:66
acc_detector_distance_config_num_frames_recorded_threshold_set
void acc_detector_distance_config_num_frames_recorded_threshold_set(acc_detector_distance_config_t *config, uint16_t num_frames)
Set number of frames to use for recorded threshold.
distance_reg_write_threshold_method
bool distance_reg_write_threshold_method(const uint32_t value)
Definition: distance_reg_protocol_access.c:461
distance_reg_read_peak1_distance
void distance_reg_read_peak1_distance(uint32_t *value)
Definition: distance_reg_protocol_access.c:125
acc_detector_distance_definitions.h
distance_reg_write_signal_quality
bool distance_reg_write_signal_quality(const uint32_t value)
Definition: distance_reg_protocol_access.c:344
ACC_REG_ERROR_FLAG_WRITE_TO_READ_ONLY
#define ACC_REG_ERROR_FLAG_WRITE_TO_READ_ONLY
Definition: acc_reg_protocol.h:18
distance_reg_read_peak8_strength
void distance_reg_read_peak8_strength(uint32_t *value)
Definition: distance_reg_protocol_access.c:227
ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_RECORDED
@ ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_RECORDED
Definition: acc_detector_distance_definitions.h:49
DISTANCE_REG_APPLICATION_ID_ENUM_DISTANCE_DETECTOR
#define DISTANCE_REG_APPLICATION_ID_ENUM_DISTANCE_DETECTOR
Definition: distance_reg_protocol.h:167
ACC_DETECTOR_DISTANCE_PEAK_SORTING_CLOSEST
@ ACC_DETECTOR_DISTANCE_PEAK_SORTING_CLOSEST
Definition: acc_detector_distance_definitions.h:34
distance_reg_read_peak2_distance
void distance_reg_read_peak2_distance(uint32_t *value)
Definition: distance_reg_protocol_access.c:131
acc_reg_protocol.h
DISTANCE_REG_PEAK_SORTING_ENUM_STRONGEST
#define DISTANCE_REG_PEAK_SORTING_ENUM_STRONGEST
Definition: distance_reg_protocol.h:149
acc_detector_distance_config_signal_quality_get
float acc_detector_distance_config_signal_quality_get(const acc_detector_distance_config_t *config)
Get signal quality.
distance_reg_write_reflector_shape
bool distance_reg_write_reflector_shape(const uint32_t value)
Definition: distance_reg_protocol_access.c:675
DISTANCE_REG_MAX_PROFILE_ENUM_PROFILE2
#define DISTANCE_REG_MAX_PROFILE_ENUM_PROFILE2
Definition: distance_reg_protocol.h:136
acc_integration_critical_section_enter
void acc_integration_critical_section_enter(void)
Definition: acc_integration_cortex.c:9
acc_detector_distance_config_threshold_method_get
acc_detector_distance_threshold_method_t acc_detector_distance_config_threshold_method_get(const acc_detector_distance_config_t *config)
Get threshold method.
acc_detector_distance_config_reflector_shape_set
void acc_detector_distance_config_reflector_shape_set(acc_detector_distance_config_t *config, acc_detector_distance_reflector_shape_t reflector_shape)
Set reflector shape.
distance_reg_read_measure_counter
void distance_reg_read_measure_counter(uint32_t *value)
Definition: distance_reg_protocol_access.c:101
acc_config_profile_t
acc_config_profile_t
Profile.
Definition: acc_definitions_a121.h:49
DISTANCE_REG_PROTOCOL_STATUS_FIELD_WRITE_FAILED_MASK
#define DISTANCE_REG_PROTOCOL_STATUS_FIELD_WRITE_FAILED_MASK
Definition: distance_reg_protocol.h:72
acc_detector_distance_config_threshold_sensitivity_set
void acc_detector_distance_config_threshold_sensitivity_set(acc_detector_distance_config_t *config, float threshold_sensitivity)
Set threshold sensitivity.
distance_reg_read_threshold_sensitivity
void distance_reg_read_threshold_sensitivity(uint32_t *value)
Definition: distance_reg_protocol_access.c:628
acc_detector_distance_config_fixed_strength_threshold_value_set
void acc_detector_distance_config_fixed_strength_threshold_value_set(acc_detector_distance_config_t *config, float fixed_threshold_value)
Set fixed strength threshold value.
i2c_distance_detector_measure_on_wakeup
void i2c_distance_detector_measure_on_wakeup(bool enable)
Enable/Disable measure on wake up.
Definition: i2c_distance_detector.c:270
acc_detector_distance_config_start_get
float acc_detector_distance_config_start_get(const acc_detector_distance_config_t *config)
Get start of measured interval (m)
acc_detector_distance.h
distance_reg_read_peak_sorting
void distance_reg_read_peak_sorting(uint32_t *value)
Definition: distance_reg_protocol_access.c:500
i2c_distance_detector_command
bool i2c_distance_detector_command(uint32_t command)
Send command to be executed to i2c distance detector.
Definition: i2c_distance_detector.c:166
i2c_distance_detector_get_peak_strength
float i2c_distance_detector_get_peak_strength(uint16_t peak_id)
Get the peak strength for a specific peak id.
Definition: i2c_distance_detector.c:258
distance_reg_write_threshold_sensitivity
bool distance_reg_write_threshold_sensitivity(const uint32_t value)
Definition: distance_reg_protocol_access.c:637
distance_reg_read_peak7_strength
void distance_reg_read_peak7_strength(uint32_t *value)
Definition: distance_reg_protocol_access.c:221
ACC_CONFIG_PROFILE_1
@ ACC_CONFIG_PROFILE_1
Definition: acc_definitions_a121.h:52
acc_detector_distance_config_t
struct acc_detector_distance_config acc_detector_distance_config_t
Distance Detector configuration.
Definition: acc_detector_distance.h:43
ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_GENERIC
@ ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_GENERIC
Definition: acc_detector_distance_definitions.h:60
acc_detector_distance_config_max_step_length_set
void acc_detector_distance_config_max_step_length_set(acc_detector_distance_config_t *config, uint16_t max_step_length)
Set maximum step length.
distance_reg_write_fixed_amplitude_threshold_value
bool distance_reg_write_fixed_amplitude_threshold_value(const uint32_t value)
Definition: distance_reg_protocol_access.c:587
distance_reg_write_end
bool distance_reg_write_end(const uint32_t value)
Definition: distance_reg_protocol_access.c:273
DISTANCE_REG_THRESHOLD_METHOD_ENUM_RECORDED
#define DISTANCE_REG_THRESHOLD_METHOD_ENUM_RECORDED
Definition: distance_reg_protocol.h:143
distance_reg_read_peak6_distance
void distance_reg_read_peak6_distance(uint32_t *value)
Definition: distance_reg_protocol_access.c:155
get_peak_strength
static uint32_t get_peak_strength(uint16_t peak_id)
Get peak strength.
Definition: distance_reg_protocol_access.c:763
distance_reg_read_fixed_amplitude_threshold_value
void distance_reg_read_fixed_amplitude_threshold_value(uint32_t *value)
Definition: distance_reg_protocol_access.c:578
acc_detector_distance_config_reflector_shape_get
acc_detector_distance_reflector_shape_t acc_detector_distance_config_reflector_shape_get(const acc_detector_distance_config_t *config)
Get reflector shape.
ACC_CONFIG_PROFILE_3
@ ACC_CONFIG_PROFILE_3
Definition: acc_definitions_a121.h:54
distance_reg_read_peak3_strength
void distance_reg_read_peak3_strength(uint32_t *value)
Definition: distance_reg_protocol_access.c:197
DISTANCE_REG_REFLECTOR_SHAPE_ENUM_PLANAR
#define DISTANCE_REG_REFLECTOR_SHAPE_ENUM_PLANAR
Definition: distance_reg_protocol.h:153
distance_reg_read_close_range_leakage_cancellation
void distance_reg_read_close_range_leakage_cancellation(uint32_t *value)
Definition: distance_reg_protocol_access.c:312