acc_detector_distance.h
Go to the documentation of this file.
1 // Copyright (c) Acconeer AB, 2022-2025
2 // All rights reserved
3
4 #ifndef ACC_DETECTOR_DISTANCE_H_
5 #define ACC_DETECTOR_DISTANCE_H_
6
7 #include <stdbool.h>
8 #include <stdint.h>
9
10 #include "acc_definitions_a121.h"
11 #include "acc_definitions_common.h"
12 #include "acc_detector_distance_definitions.h"
13 #include "acc_processing.h"
14 #include "acc_sensor.h"
15
16 /**
17 * @defgroup Distance Distance Detector
18 *
19 * @brief Distance Detector API description
20 *
21 * For a thorough description of the Distance Detector, see the
22 * Distance Detector User Guide.
23 * @{
24 */
25
26 /**
27 * @brief The maximum number of estimated distances that is returned in the Detector result
28 */
29 #define ACC_DETECTOR_DISTANCE_RESULT_MAX_NUM_DISTANCES (10U)
30
31 /**
32 * @brief Distance Detector handle
33 *
34 * Used when calling the Distance Detector control and process functions.
35 */
36 typedef struct acc_detector_distance_handle acc_detector_distance_handle_t;
37
38 /**
39 * @brief Distance Detector configuration
40 *
41 * Used when calling the Distance Detector configuration functions.
42 */
43 typedef struct acc_detector_distance_config acc_detector_distance_config_t;
44
45 /**
46 * @brief Distance Detector result returned from @ref acc_detector_distance_process
47 */
48 typedef struct
49 {
50 /**
51 * Estimated distances (m).
52 *
53 * Sorted according to the selected peak sorting strategy.
54 */
55 float distances[ACC_DETECTOR_DISTANCE_RESULT_MAX_NUM_DISTANCES];
56
57 /**
58 * Estimated reflector strengths (dB).
59 *
60 * Corresponds to the peak amplitude of the estimated distances.
61 */
62 float strengths[ACC_DETECTOR_DISTANCE_RESULT_MAX_NUM_DISTANCES];
63
64 /**
65 * The number of valid distances in the distances array.
66 *
67 * Corresponds to the number of detected objects according to the threshold method.
68 * If 0, no objects were detected.
69 */
70 uint8_t num_distances;
71
72 /**
73 * Indication of an object close to the start edge, located outside of the measurement range.
74 */
75 bool near_start_edge_status;
76
77 /**
78 * Indication of calibration needed.
79 *
80 * Is set if the temperature has changed by at least 15 degrees Celsius from
81 * the temperature at calibration.
82 *
83 * If true:
84 * - The sensor calibration needs to be redone by calling @ref acc_sensor_calibrate
85 * - The Detector calibration needs to be updated by calling @ref acc_detector_distance_update_calibration
86 */
87 bool calibration_needed;
88
89 /**
90 * Temperature in sensor during measurement (in degree Celsius).
91 *
92 * Note that it has poor absolute accuracy and should only be used
93 * for relative temperature measurements.
94 */
95 int16_t temperature;
96
97 /**
98 * Processing result, including IQ data, that the Distance detection is based on.
99 *
100 * This will point to memory in the buffer supplied to @ref acc_detector_distance_process
101 *
102 * Note: The processing result is only valid until the next time
103 * @ref acc_detector_distance_process is called.
104 */
105 acc_processing_result_t *processing_result;
106
107 /**
108 * Metadata for the processing result
109 *
110 * Note: The processing metedata is only valid until the next time
111 * @ref acc_detector_distance_process is called.
112 */
113 acc_processing_metadata_t *processing_metadata;
114
115 /**
116 * The sensor_config used for the processing result
117 *
118 * Note: The sensor_config is only valid until the next time
119 * @ref acc_detector_distance_process is called.
120 */
121 const acc_config_t *sensor_config;
122 } acc_detector_distance_result_t;
123
124 /**
125 * @brief Create a Distance Detector configuration
126 *
127 * The returned configuration is used when calling the Distance configuration functions.
128 *
129 * @return Distance Detector configuration, NULL at failure
130 */
131 acc_detector_distance_config_t *acc_detector_distance_config_create(void);
132
133 /**
134 * @brief Destroy Distance Detector configuration
135 *
136 * To be called when Distance Detector configuration is no longer needed,
137 * typically at end of application.
138 *
139 * @param[in] config The Distance Detector configuration to destroy
140 */
141 void acc_detector_distance_config_destroy(acc_detector_distance_config_t *config);
142
143 /**
144 * @brief Log Distance configuration, typically through printf
145 *
146 * If handle != NULL, the underlying sensor configs will also be logged.
147 *
148 * @param[in] handle The Distance Detector handle, can be NULL
149 * @param[in] config The Distance Detector configuration
150 */
151 void acc_detector_distance_config_log(const acc_detector_distance_handle_t *handle, const acc_detector_distance_config_t *config);
152
153 /**
154 * @brief Get the memory size needed to use the Distance Detector API functions
155 *
156 * buffer_size is the size of working memory (buffer) needed for the different Detector functions.
157 * This includes memory for sensor control and Detector calculations.
158 * This memory can be reused between sensor instances and Detector handles.
159 *
160 * detector_cal_result_static_size is the size of the static part of the Detector calibration result.
161 *
162 * Both sizes are dependent on the configuration used which is contained in the provided handle.
163 *
164 * @param[in] handle The Distance Detector handle
165 * @param[out] buffer_size The buffer size
166 * @param[out] detector_cal_result_static_size The calibration result size
167 * @return true if successful, false otherwise
168 */
169 bool acc_detector_distance_get_sizes(const acc_detector_distance_handle_t *handle, uint32_t *buffer_size, uint32_t *detector_cal_result_static_size);
170
171 /**
172 * @brief Create Distance Detector handle using the provided Distance Detector configuration
173 *
174 * The returned handle is used when calling the Detector control and process functions.
175 *
176 * @param[in] config The Distance Detector configuration
177 * @return Distance Detector handle, NULL at failure
178 */
179 acc_detector_distance_handle_t *acc_detector_distance_create(const acc_detector_distance_config_t *config);
180
181 /**
182 * @brief Destroy Distance Detector handle, freeing its resources
183 *
184 * To be called when Distance Detector handle is no longer needed,
185 * typically at end of application.
186 *
187 * @param[in] handle The Distance Detector handle to destroy
188 */
189 void acc_detector_distance_destroy(acc_detector_distance_handle_t *handle);
190
191 /**
192 * @brief Calibrate detector
193 *
194 * Calibrating the Detector is needed to ensure reliable Detector results.
195 *
196 * See the calibration sections in the Distance Detector User Guide for more information.
197 *
198 * @param[in] sensor The sensor instance to use for calibration
199 * @param[in] handle The Distance Detector handle
200 * @param[in] sensor_cal_result Sensor calibration result
201 * @param[in] buffer Working memory buffer needed by function
202 * @param[in] buffer_size The size of buffer. Needs to be at least
203 * the result of @ref acc_detector_distance_get_sizes
204 * @param[out] detector_cal_result_static Static result of calibration
205 * @param[in] detector_cal_result_static_size The size of detector_cal_result_static.
206 * Needs to be at least the result of @ref acc_detector_distance_get_sizes
207 * @param[out] detector_cal_result_dynamic Dynamic result of calibration
208 * @param[out] calibration_complete Will be set to true when the calibration is complete.
209 * If false; at least one more call to this function is needed.
210 * Note that it's necessary to wait for interrupt between calls.
211 * @return true if successful, false otherwise
212 */
213 bool acc_detector_distance_calibrate(acc_sensor_t *sensor,
214 acc_detector_distance_handle_t *handle,
215 const acc_cal_result_t *sensor_cal_result,
216 void *buffer,
217 uint32_t buffer_size,
218 uint8_t *detector_cal_result_static,
219 uint32_t detector_cal_result_static_size,
220 acc_detector_cal_result_dynamic_t *detector_cal_result_dynamic,
221 bool *calibration_complete);
222
223 /**
224 * @brief Perform a subset of the full Detector calibration
225 *
226 * This function should be called if the @ref acc_detector_distance_result_t.calibration_needed indication is set.
227 * A new sensor calibration needs to be done before calling this function.
228 *
229 * See the calibration sections in the Distance Detector User Guide for more information.
230 *
231 * @param[in] sensor The sensor instance to use for calibration update
232 * @param[in] handle The Detector handle
233 * @param[in] sensor_cal_result Sensor calibration result
234 * @param[in] buffer Working memory buffer needed by function
235 * @param[in] buffer_size The size of buffer. Needs to be at least
236 * the result of @ref acc_detector_distance_get_sizes
237 * @param[out] detector_cal_result_dynamic Result of the calibration update
238 * @param[out] calibration_complete Will be set to true when the calibration update is complete.
239 * If false; at least one more call to this function is needed.
240 * Note that it's necessary to wait for interrupt between calls.
241 * @return true if successful, false otherwise
242 */
243 bool acc_detector_distance_update_calibration(acc_sensor_t *sensor,
244 acc_detector_distance_handle_t *handle,
245 const acc_cal_result_t *sensor_cal_result,
246 void *buffer,
247 uint32_t buffer_size,
248 acc_detector_cal_result_dynamic_t *detector_cal_result_dynamic,
249 bool *calibration_complete);
250
251 /**
252 * @brief Prepare the Detector for measurements
253 *
254 * This function loads the provided configuration and calibration result
255 * to the sensor via SPI.
256 *
257 * This should be done before every measure.
258 *
259 * @param[in, out] handle The Distance Detector handle
260 * @param[in] config The Distance Detector configuration
261 * @param[in] sensor The sensor instance
262 * @param[in] sensor_cal_result The sensor calibration result
263 * @param[in] buffer Memory used by the detector. Should be at least buffer_size bytes
264 * @param[in] buffer_size The buffer size received by @ref acc_detector_distance_get_sizes
265 * @return true if successful, false otherwise
266 */
267 bool acc_detector_distance_prepare(const acc_detector_distance_handle_t *handle,
268 const acc_detector_distance_config_t *config,
269 acc_sensor_t *sensor,
270 const acc_cal_result_t *sensor_cal_result,
271 void *buffer,
272 uint32_t buffer_size);
273
274 /**
275 * @brief Process sensor data into a Detector result
276 *
277 * This function takes sensor data (an IQ data frame) as input and finds distances
278 * to objects. For more information on the processing, see the Distance Detector
279 * User Guide.
280 *
281 * Needs to be called multiple times until 'result_available' is true.
282 * See example_detector_distance.c how this is done.
283 *
284 * @param[in] handle The Distance Detector handle
285 * @param[in] buffer A reference to the buffer (populated by @ref acc_sensor_read) containing the
286 * data to be processed.
287 * @param[in] detector_cal_result_static The result from @ref acc_detector_distance_calibrate
288 * @param[in] detector_cal_result_dynamic The result from @ref acc_detector_distance_calibrate or @ref acc_detector_distance_update_calibration
289 * @param[out] result_available True if the result Whether result will contain a new result
290 * @param[out] result Distance Detector result
291 * @return true if successful, false otherwise
292 */
293 bool acc_detector_distance_process(acc_detector_distance_handle_t *handle,
294 void *buffer,
295 uint8_t *detector_cal_result_static,
296 acc_detector_cal_result_dynamic_t *detector_cal_result_dynamic,
297 bool *result_available,
298 acc_detector_distance_result_t *result);
299
300 /**
301 * @brief Set start of measured interval (m)
302 *
303 * This should be used to make sure that objects in the desired range
304 * interval can be detected.
305 *
306 * @param[out] config The Distance Detector configuration
307 * @param[in] start_m The start of measured interval (m)
308 */
309 void acc_detector_distance_config_start_set(acc_detector_distance_config_t *config, float start_m);
310
311 /**
312 * @brief Get start of measured interval (m)
313 *
314 * See @ref acc_detector_distance_config_start_set.
315 *
316 * @param[in] config The Distance Detector configuration
317 * @return The start of measured interval (m)
318 */
319 float acc_detector_distance_config_start_get(const acc_detector_distance_config_t *config);
320
321 /**
322 * @brief Set end of measured interval (m)
323 *
324 * This should be used to make sure that objects in the desired range
325 * interval can be detected.
326 *
327 * For example, if objects in the environment can appear between
328 * 0.5 m and 2.0 m from the sensor, an end of around 2.1 m is probably a good setting.
329 *
330 * @param[out] config The Distance Detector configuration
331 * @param[in] end_m The end of measured interval
332 */
333 void acc_detector_distance_config_end_set(acc_detector_distance_config_t *config, float end_m);
334
335 /**
336 * @brief Get end of measured interval (m)
337 *
338 * See @ref acc_detector_distance_config_end_set.
339 *
340 * @param[in] config The Distance Detector configuration
341 * @return The end of measured interval
342 */
343 float acc_detector_distance_config_end_get(const acc_detector_distance_config_t *config);
344
345 /**
346 * @brief Set maximum step length
347 *
348 * Step length is the number of 2.5 mm distance points between each
349 * measurement point in the underlying IQ data. This is normally
350 * automatically set by the detector depending on the range start/end
351 * configurations.
352 *
353 * This function sets an upper limit to the automatically set step length.
354 * If set to 0 (default), no upper limit is enforced.
355 *
356 * A small maximum step length increases SNR (signal quality) through more
357 * efficient distance filtering, but also increases the measurement time
358 * and power consumption.
359 *
360 * @param[out] config The Distance Detector configuration
361 * @param[in] max_step_length The maximum step length
362 */
363 void acc_detector_distance_config_max_step_length_set(acc_detector_distance_config_t *config, uint16_t max_step_length);
364
365 /**
366 * @brief Get maximum step length
367 *
368 * See @ref acc_detector_distance_config_max_step_length_set.
369 *
370 * @param[in] config The Distance Detector configuration
371 * @return The maximum step length
372 */
373 uint16_t acc_detector_distance_config_max_step_length_get(const acc_detector_distance_config_t *config);
374
375 /**
376 * @brief Enable close range leakage cancellation
377 *
378 * Close range leakage cancellation refers to the process of measuring close to the
379 * sensor(<100mm) by first characterizing the direct leakage, and then subtracting it
380 * from the measured sweep in order to isolate the signal component of interest.
381 *
382 * The close range leakage cancellation process requires the sensor to be installed in its
383 * intended geometry with free space in front of the sensor during Detector calibration.
384 *
385 * This is default off.
386 *
387 * @param[out] config The Distance Detector configuration
388 * @param[in] enable true to enable close range leakage cancellation logic, false to disable
389 */
390 void acc_detector_distance_config_close_range_leakage_cancellation_set(acc_detector_distance_config_t *config, bool enable);
391
392 /**
393 * @brief Get if close range leakage cancellation is enabled
394 *
395 * See @ref acc_detector_distance_config_close_range_leakage_cancellation_set.
396 *
397 * @param[in] config The Distance Detector configuration
398 * @return true if enabled, false if disabled
399 */
400 bool acc_detector_distance_config_close_range_leakage_cancellation_get(const acc_detector_distance_config_t *config);
401
402 /**
403 * @brief Set signal quality (dB)
404 *
405 * High signal quality results in better SNR (signal-to-noise ratio).
406 * High signal quality leads to longer measurement time which leads to higher power consumption.
407 * Signal quality can be set within the interval [-10, 35].
408 *
409 * @param[out] config The Distance Detector configuration
410 * @param[in] signal_quality The signal quality
411 */
412 void acc_detector_distance_config_signal_quality_set(acc_detector_distance_config_t *config, float signal_quality);
413
414 /**
415 * @brief Get signal quality
416 *
417 * See @ref acc_detector_distance_config_signal_quality_set.
418 *
419 * @param[in] config The Distance Detector configuration
420 * @return The signal quality
421 */
422 float acc_detector_distance_config_signal_quality_get(const acc_detector_distance_config_t *config);
423
424 /**
425 * @brief Set maximum Profile
426 *
427 * Profile sets the duration and shape of the emitted pulse from the sensor.
428 * This is normally automatically set by the detector depending on the range
429 * start/end configurations.
430 *
431 * This function sets an upper limit to the automatically set Profile.
432 *
433 * A low maximum profile improves the radial distance resolution but decreases the SNR.
434 *
435 * @param[out] config The Distance Detector configuration
436 * @param[in] max_profile The maximum profile
437 */
438 void acc_detector_distance_config_max_profile_set(acc_detector_distance_config_t *config, acc_config_profile_t max_profile);
439
440 /**
441 * @brief Get maximum Profile
442 *
443 * See @ref acc_detector_distance_config_max_profile_set.
444 *
445 * @param[in] config The Distance Detector configuration
446 * @return The maximum Profile
447 */
448 acc_config_profile_t acc_detector_distance_config_max_profile_get(const acc_detector_distance_config_t *config);
449
450 /**
451 * @brief Set threshold method
452 *
453 * Sets which method to use for determining if a peak in the underlying
454 * radar data is a reflection or not (and will be returned as a distance estimation).
455 *
456 * See @ref acc_detector_distance_threshold_method_t for a short description
457 * of each method.
458 *
459 * More detailed information on thresholds can be found in the Distance Detector
460 * User Guide.
461 *
462 * @param[out] config The Distance Detector configuration
463 * @param[in] threshold_method The threshold method
464 */
465 void acc_detector_distance_config_threshold_method_set(acc_detector_distance_config_t *config,
466 acc_detector_distance_threshold_method_t threshold_method);
467
468 /**
469 * @brief Get threshold method
470 *
471 * See @ref acc_detector_distance_config_threshold_method_set.
472 *
473 * @param[in] config The Distance Detector configuration
474 * @return The threshold method
475 */
476 acc_detector_distance_threshold_method_t acc_detector_distance_config_threshold_method_get(const acc_detector_distance_config_t *config);
477
478 /**
479 * @brief Set peak sorting method
480 *
481 * Sets the method used determining the order of the resulting
482 * estimated distances.
483 *
484 * See @ref acc_detector_distance_peak_sorting_t for a short description
485 * of each method.
486 *
487 * More detailed information on peak sorting can be found in the Distance Detector
488 * User Guide.
489 *
490 * @param[out] config The Distance Detector configuration
491 * @param[in] peak_sorting The peak sorting method
492 */
493 void acc_detector_distance_config_peak_sorting_set(acc_detector_distance_config_t *config, acc_detector_distance_peak_sorting_t peak_sorting);
494
495 /**
496 * @brief Get peak sorting method
497 *
498 * See @ref acc_detector_distance_config_peak_sorting_set.
499 *
500 * @param[in] config The Distance Detector configuration
501 * @return The peak sorting method
502 */
503 acc_detector_distance_peak_sorting_t acc_detector_distance_config_peak_sorting_get(const acc_detector_distance_config_t *config);
504
505 /**
506 * @brief Set number of frames to use for recorded threshold
507 *
508 * If recorded threshold is used, the Distance Detector calibration collects
509 * IQ data to create a threshold. The number of frames sets how much IQ data
510 * is collected.
511 *
512 * A lower number reduces calibration time and a higher number results
513 * in a more statistically significant threshold.
514 *
515 * See @ref acc_detector_distance_config_threshold_method_set for more information.
516 *
517 * @param[out] config The Distance Detector configuration
518 * @param[in] num_frames The number of frames
519 */
520 void acc_detector_distance_config_num_frames_recorded_threshold_set(acc_detector_distance_config_t *config, uint16_t num_frames);
521
522 /**
523 * @brief Get number of frames to use for recorded threshold
524 *
525 * See @ref acc_detector_distance_config_num_frames_recorded_threshold_set.
526 *
527 * @param[in] config The Distance Detector configuration
528 * @return The number of frames
529 */
530 uint16_t acc_detector_distance_config_num_frames_recorded_threshold_get(const acc_detector_distance_config_t *config);
531
532 /**
533 * @brief Set fixed amplitude threshold value
534 *
535 * See @ref acc_detector_distance_config_threshold_method_set for more information.
536 *
537 * @param[out] config The Distance Detector configuration
538 * @param[in] fixed_threshold_value The fixed threshold value
539 */
540 void acc_detector_distance_config_fixed_amplitude_threshold_value_set(acc_detector_distance_config_t *config, float fixed_threshold_value);
541
542 /**
543 * @brief Get fixed amplitude threshold value
544 *
545 * See @ref acc_detector_distance_config_fixed_amplitude_threshold_value_set.
546 *
547 * @param[in] config The Distance Detector configuration
548 * @return The fixed threshold value
549 */
550 float acc_detector_distance_config_fixed_amplitude_threshold_value_get(const acc_detector_distance_config_t *config);
551
552 /**
553 * @brief Set fixed strength threshold value
554 *
555 * See @ref acc_detector_distance_config_threshold_method_set for more information.
556 *
557 * @param[out] config The Distance Detector configuration
558 * @param[in] fixed_threshold_value The fixed threshold value
559 */
560 void acc_detector_distance_config_fixed_strength_threshold_value_set(acc_detector_distance_config_t *config, float fixed_threshold_value);
561
562 /**
563 * @brief Get fixed strength threshold value
564 *
565 * See @ref acc_detector_distance_config_fixed_strength_threshold_value_set.
566 *
567 * @param[in] config The Distance Detector configuration
568 * @return The fixed threshold value
569 */
570 float acc_detector_distance_config_fixed_strength_threshold_value_get(const acc_detector_distance_config_t *config);
571
572 /**
573 * @brief Set threshold sensitivity
574 *
575 * Set how sensitive the threshold is. Only applicable for
576 * @ref ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_RECORDED and
577 * @ref ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR.
578 *
579 * A high sensitivity will make the Distance Detector find more reflections,
580 * but there is a higher risk that some of the reflection are false positives.
581 *
582 * Threshold sensitivity can be set within the interval [0, 1].
583 *
584 * @param[out] config The Distance Detector configuration
585 * @param[in] threshold_sensitivity The threshold sensitivity
586 */
587 void acc_detector_distance_config_threshold_sensitivity_set(acc_detector_distance_config_t *config, float threshold_sensitivity);
588
589 /**
590 * @brief Get threshold sensitivity
591 *
592 * See @ref acc_detector_distance_config_threshold_sensitivity_set.
593 *
594 * @param[in] config The Distance Detector configuration
595 * @return The threshold sensitivity
596 */
597 float acc_detector_distance_config_threshold_sensitivity_get(const acc_detector_distance_config_t *config);
598
599 /**
600 * @brief Set reflector shape
601 *
602 * Set the expected shape of objects to be found by the Distance Detector.
603 * This is used to optimize underlying sensor settings.
604 *
605 * See the Distance Detector User Guide for more information.
606 *
607 * @param[out] config The Distance Detector configuration
608 * @param[in] reflector_shape The reflector shape
609 */
610 void acc_detector_distance_config_reflector_shape_set(acc_detector_distance_config_t *config,
611 acc_detector_distance_reflector_shape_t reflector_shape);
612
613 /**
614 * @brief Get reflector shape
615 *
616 * See @ref acc_detector_distance_config_reflector_shape_set.
617 *
618 * @param[in] config The Distance Detector configuration
619 * @return The reflector shape
620 */
621 acc_detector_distance_reflector_shape_t acc_detector_distance_config_reflector_shape_get(const acc_detector_distance_config_t *config);
622
623 /**
624 * @}
625 */
626
627 #endif
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_detector_distance_result_t::processing_result
acc_processing_result_t * processing_result
Definition: acc_detector_distance.h:105
acc_detector_distance_threshold_method_t
acc_detector_distance_threshold_method_t
Enum for threshold methods.
Definition: acc_detector_distance_definitions.h:42
acc_detector_distance_get_sizes
bool acc_detector_distance_get_sizes(const acc_detector_distance_handle_t *handle, uint32_t *buffer_size, uint32_t *detector_cal_result_static_size)
Get the memory size needed to use the Distance Detector API functions.
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.
acc_processing_result_t
Result provided by the processing module.
Definition: acc_processing.h:71
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_detector_distance_result_t::temperature
int16_t temperature
Definition: acc_detector_distance.h:95
buffer
void * buffer
Definition: i2c_example_cargo.c:40
sensor_cal_result
acc_cal_result_t sensor_cal_result
Definition: i2c_example_cargo.c:36
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.
acc_cal_result_t
The result from a completed calibration.
Definition: acc_definitions_a121.h:30
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_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.
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.
acc_detector_distance_result_t::num_distances
uint8_t num_distances
Definition: acc_detector_distance.h:70
acc_detector_distance_create
acc_detector_distance_handle_t * acc_detector_distance_create(const acc_detector_distance_config_t *config)
Create Distance Detector handle using the provided Distance Detector configuration.
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_detector_distance_config_destroy
void acc_detector_distance_config_destroy(acc_detector_distance_config_t *config)
Destroy Distance Detector configuration.
config
cargo_config_t config
Definition: i2c_example_cargo.c:34
acc_detector_distance_calibrate
bool acc_detector_distance_calibrate(acc_sensor_t *sensor, acc_detector_distance_handle_t *handle, const acc_cal_result_t *sensor_cal_result, void *buffer, uint32_t buffer_size, uint8_t *detector_cal_result_static, uint32_t detector_cal_result_static_size, acc_detector_cal_result_dynamic_t *detector_cal_result_dynamic, bool *calibration_complete)
Calibrate detector.
acc_detector_distance_process
bool acc_detector_distance_process(acc_detector_distance_handle_t *handle, void *buffer, uint8_t *detector_cal_result_static, acc_detector_cal_result_dynamic_t *detector_cal_result_dynamic, bool *result_available, acc_detector_distance_result_t *result)
Process sensor data into a Detector result.
acc_detector_distance_result_t::sensor_config
const acc_config_t * sensor_config
Definition: acc_detector_distance.h:121
acc_processing_metadata_t
Metadata that will be populated by the processing module during creation.
Definition: acc_processing.h:36
detector_cal_result_static
static uint8_t * detector_cal_result_static
Definition: example_detector_distance_calibration_caching.c:70
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
acc_sensor.h
buffer_size
uint32_t buffer_size
Definition: i2c_example_cargo.c:41
acc_detector_cal_result_dynamic_t
The result from a completed calibration update.
Definition: acc_detector_distance_definitions.h:23
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.
sensor
acc_sensor_t * sensor
Definition: i2c_example_cargo.c:33
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)
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_destroy
void acc_detector_distance_destroy(acc_detector_distance_handle_t *handle)
Destroy Distance Detector handle, freeing its resources.
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)
handle
cargo_handle_t * handle
Definition: i2c_example_cargo.c:35
result
cargo_result_t result
Definition: i2c_example_cargo.c:43
acc_config_t
struct acc_config acc_config_t
Definition: acc_config.h:24
acc_detector_distance_result_t::processing_metadata
acc_processing_metadata_t * processing_metadata
Definition: acc_detector_distance.h:113
detector_cal_result_static_size
static uint32_t detector_cal_result_static_size
Definition: example_detector_distance_calibration_caching.c:71
acc_detector_distance_result_t::calibration_needed
bool calibration_needed
Definition: acc_detector_distance.h:87
acc_detector_distance_config_log
void acc_detector_distance_config_log(const acc_detector_distance_handle_t *handle, const acc_detector_distance_config_t *config)
Log Distance configuration, typically through printf.
acc_detector_distance_prepare
bool acc_detector_distance_prepare(const acc_detector_distance_handle_t *handle, const acc_detector_distance_config_t *config, acc_sensor_t *sensor, const acc_cal_result_t *sensor_cal_result, void *buffer, uint32_t buffer_size)
Prepare the Detector for measurements.
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.
acc_detector_distance_result_t
Distance Detector result returned from acc_detector_distance_process.
Definition: acc_detector_distance.h:48
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
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.
acc_detector_distance_handle_t
struct acc_detector_distance_handle acc_detector_distance_handle_t
Distance Detector handle.
Definition: acc_detector_distance.h:36
acc_detector_distance_definitions.h
acc_detector_distance_update_calibration
bool acc_detector_distance_update_calibration(acc_sensor_t *sensor, acc_detector_distance_handle_t *handle, const acc_cal_result_t *sensor_cal_result, void *buffer, uint32_t buffer_size, acc_detector_cal_result_dynamic_t *detector_cal_result_dynamic, bool *calibration_complete)
Perform a subset of the full Detector calibration.
acc_detector_distance_result_t::near_start_edge_status
bool near_start_edge_status
Definition: acc_detector_distance.h:75
ACC_DETECTOR_DISTANCE_RESULT_MAX_NUM_DISTANCES
#define ACC_DETECTOR_DISTANCE_RESULT_MAX_NUM_DISTANCES
The maximum number of estimated distances that is returned in the Detector result.
Definition: acc_detector_distance.h:29
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.
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.
acc_config_profile_t
acc_config_profile_t
Profile.
Definition: acc_definitions_a121.h:49
acc_definitions_common.h
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.
acc_detector_distance_config_create
acc_detector_distance_config_t * acc_detector_distance_config_create(void)
Create a Distance Detector configuration.
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.
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_config_t
struct acc_detector_distance_config acc_detector_distance_config_t
Distance Detector configuration.
Definition: acc_detector_distance.h:43
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.
acc_processing.h
acc_sensor_t
struct acc_sensor acc_sensor_t
Definition: acc_sensor.h:31
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_definitions_a121.h