|
|
Distance Detector API description. More...
Data Structures | |
| struct | acc_detector_distance_result_t |
| Distance Detector result returned from acc_detector_distance_process. More... | |
Macros | |
| #define | ACC_DETECTOR_DISTANCE_RESULT_MAX_NUM_DISTANCES (10U) |
| The maximum number of estimated distances that is returned in the Detector result. More... | |
Typedefs | |
| typedef struct acc_detector_distance_handle | acc_detector_distance_handle_t |
| Distance Detector handle. More... | |
| typedef struct acc_detector_distance_config | acc_detector_distance_config_t |
| Distance Detector configuration. More... | |
Distance Detector API description.
For a thorough description of the Distance Detector, see the Distance Detector User Guide.
| #define ACC_DETECTOR_CAL_RESULT_DYNAMIC_DATA_SIZE (8U) |
The size of the result from a completed calibration update.
Definition at line 18 of file acc_detector_distance_definitions.h.
| #define ACC_DETECTOR_DISTANCE_RESULT_MAX_NUM_DISTANCES (10U) |
The maximum number of estimated distances that is returned in the Detector result.
Definition at line 29 of file acc_detector_distance.h.
| typedef struct acc_detector_distance_config acc_detector_distance_config_t |
Distance Detector configuration.
Used when calling the Distance Detector configuration functions.
Definition at line 43 of file acc_detector_distance.h.
| typedef struct acc_detector_distance_handle acc_detector_distance_handle_t |
Distance Detector handle.
Used when calling the Distance Detector control and process functions.
Definition at line 36 of file acc_detector_distance.h.
Enum for peak sorting algorithms.
| Enumerator | |
|---|---|
| ACC_DETECTOR_DISTANCE_PEAK_SORTING_CLOSEST | Return peaks with the closest detection first. |
| ACC_DETECTOR_DISTANCE_PEAK_SORTING_STRONGEST | Return peaks with the peak with the highest RCS first. |
Definition at line 31 of file acc_detector_distance_definitions.h.
Enum for reflector shapes.
| Enumerator | |
|---|---|
| ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_GENERIC | Use a generic reflector shape for RCS calculation |
| ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_PLANAR | Use a planar reflector shape for RCS calculation |
Definition at line 57 of file acc_detector_distance_definitions.h.
Enum for threshold methods.
Definition at line 42 of file acc_detector_distance_definitions.h.
| 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.
Calibrating the Detector is needed to ensure reliable Detector results.
See the calibration sections in the Distance Detector User Guide for more information.
| [in] | sensor | The sensor instance to use for calibration |
| [in] | handle | The Distance Detector handle |
| [in] | sensor_cal_result | Sensor calibration result |
| [in] | buffer | Working memory buffer needed by function |
| [in] | buffer_size | The size of buffer. Needs to be at least the result of acc_detector_distance_get_sizes |
| [out] | detector_cal_result_static | Static result of calibration |
| [in] | detector_cal_result_static_size | The size of detector_cal_result_static. Needs to be at least the result of acc_detector_distance_get_sizes |
| [out] | detector_cal_result_dynamic | Dynamic result of calibration |
| [out] | calibration_complete | Will be set to true when the calibration is complete. If false; at least one more call to this function is needed. Note that it's necessary to wait for interrupt between calls. |
| 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.
See acc_detector_distance_config_close_range_leakage_cancellation_set.
| [in] | config | The Distance Detector configuration |
| void acc_detector_distance_config_close_range_leakage_cancellation_set | ( | acc_detector_distance_config_t * | config, |
| bool | enable | ||
| ) |
Enable close range leakage cancellation.
Close range leakage cancellation refers to the process of measuring close to the sensor(<100mm) by first characterizing the direct leakage, and then subtracting it from the measured sweep in order to isolate the signal component of interest.
The close range leakage cancellation process requires the sensor to be installed in its intended geometry with free space in front of the sensor during Detector calibration.
This is default off.
| [out] | config | The Distance Detector configuration |
| [in] | enable | true to enable close range leakage cancellation logic, false to disable |
| acc_detector_distance_config_t* acc_detector_distance_config_create | ( | void | ) |
Create a Distance Detector configuration.
The returned configuration is used when calling the Distance configuration functions.
| void acc_detector_distance_config_destroy | ( | acc_detector_distance_config_t * | config | ) |
Destroy Distance Detector configuration.
To be called when Distance Detector configuration is no longer needed, typically at end of application.
| [in] | config | The Distance Detector configuration to destroy |
| float acc_detector_distance_config_end_get | ( | const acc_detector_distance_config_t * | config | ) |
Get end of measured interval (m)
See acc_detector_distance_config_end_set.
| [in] | config | The Distance Detector configuration |
| void acc_detector_distance_config_end_set | ( | acc_detector_distance_config_t * | config, |
| float | end_m | ||
| ) |
Set end of measured interval (m)
This should be used to make sure that objects in the desired range interval can be detected.
For example, if objects in the environment can appear between 0.5 m and 2.0 m from the sensor, an end of around 2.1 m is probably a good setting.
| [out] | config | The Distance Detector configuration |
| [in] | end_m | The end of measured interval |
| float acc_detector_distance_config_fixed_amplitude_threshold_value_get | ( | const acc_detector_distance_config_t * | config | ) |
Get fixed amplitude threshold value.
See acc_detector_distance_config_fixed_amplitude_threshold_value_set.
| [in] | config | The Distance Detector configuration |
| 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.
See acc_detector_distance_config_threshold_method_set for more information.
| [out] | config | The Distance Detector configuration |
| [in] | fixed_threshold_value | The fixed threshold value |
| float acc_detector_distance_config_fixed_strength_threshold_value_get | ( | const acc_detector_distance_config_t * | config | ) |
Get fixed strength threshold value.
See acc_detector_distance_config_fixed_strength_threshold_value_set.
| [in] | config | The Distance Detector configuration |
| 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.
See acc_detector_distance_config_threshold_method_set for more information.
| [out] | config | The Distance Detector configuration |
| [in] | fixed_threshold_value | The fixed threshold value |
| 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.
If handle != NULL, the underlying sensor configs will also be logged.
| [in] | handle | The Distance Detector handle, can be NULL |
| [in] | config | The Distance Detector configuration |
| acc_config_profile_t acc_detector_distance_config_max_profile_get | ( | const acc_detector_distance_config_t * | config | ) |
Get maximum Profile.
See acc_detector_distance_config_max_profile_set.
| [in] | config | The Distance Detector configuration |
| void acc_detector_distance_config_max_profile_set | ( | acc_detector_distance_config_t * | config, |
| acc_config_profile_t | max_profile | ||
| ) |
Set maximum Profile.
Profile sets the duration and shape of the emitted pulse from the sensor. This is normally automatically set by the detector depending on the range start/end configurations.
This function sets an upper limit to the automatically set Profile.
A low maximum profile improves the radial distance resolution but decreases the SNR.
| [out] | config | The Distance Detector configuration |
| [in] | max_profile | The maximum profile |
| uint16_t acc_detector_distance_config_max_step_length_get | ( | const acc_detector_distance_config_t * | config | ) |
Get maximum step length.
See acc_detector_distance_config_max_step_length_set.
| [in] | config | The Distance Detector configuration |
| void acc_detector_distance_config_max_step_length_set | ( | acc_detector_distance_config_t * | config, |
| uint16_t | max_step_length | ||
| ) |
Set maximum step length.
Step length is the number of 2.5 mm distance points between each measurement point in the underlying IQ data. This is normally automatically set by the detector depending on the range start/end configurations.
This function sets an upper limit to the automatically set step length. If set to 0 (default), no upper limit is enforced.
A small maximum step length increases SNR (signal quality) through more efficient distance filtering, but also increases the measurement time and power consumption.
| [out] | config | The Distance Detector configuration |
| [in] | max_step_length | The maximum step length |
| 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.
See acc_detector_distance_config_num_frames_recorded_threshold_set.
| [in] | config | The Distance Detector configuration |
| 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.
If recorded threshold is used, the Distance Detector calibration collects IQ data to create a threshold. The number of frames sets how much IQ data is collected.
A lower number reduces calibration time and a higher number results in a more statistically significant threshold.
See acc_detector_distance_config_threshold_method_set for more information.
| [out] | config | The Distance Detector configuration |
| [in] | num_frames | The number of frames |
| acc_detector_distance_peak_sorting_t acc_detector_distance_config_peak_sorting_get | ( | const acc_detector_distance_config_t * | config | ) |
Get peak sorting method.
See acc_detector_distance_config_peak_sorting_set.
| [in] | config | The Distance Detector configuration |
| 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.
Sets the method used determining the order of the resulting estimated distances.
See acc_detector_distance_peak_sorting_t for a short description of each method.
More detailed information on peak sorting can be found in the Distance Detector User Guide.
| [out] | config | The Distance Detector configuration |
| [in] | peak_sorting | The peak sorting method |
| acc_detector_distance_reflector_shape_t acc_detector_distance_config_reflector_shape_get | ( | const acc_detector_distance_config_t * | config | ) |
Get reflector shape.
See acc_detector_distance_config_reflector_shape_set.
| [in] | config | The Distance Detector configuration |
| 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.
Set the expected shape of objects to be found by the Distance Detector. This is used to optimize underlying sensor settings.
See the Distance Detector User Guide for more information.
| [out] | config | The Distance Detector configuration |
| [in] | reflector_shape | The reflector shape |
| float acc_detector_distance_config_signal_quality_get | ( | const acc_detector_distance_config_t * | config | ) |
Get signal quality.
See acc_detector_distance_config_signal_quality_set.
| [in] | config | The Distance Detector configuration |
| void acc_detector_distance_config_signal_quality_set | ( | acc_detector_distance_config_t * | config, |
| float | signal_quality | ||
| ) |
Set signal quality (dB)
High signal quality results in better SNR (signal-to-noise ratio). High signal quality leads to longer measurement time which leads to higher power consumption. Signal quality can be set within the interval [-10, 35].
| [out] | config | The Distance Detector configuration |
| [in] | signal_quality | The signal quality |
| float acc_detector_distance_config_start_get | ( | const acc_detector_distance_config_t * | config | ) |
Get start of measured interval (m)
See acc_detector_distance_config_start_set.
| [in] | config | The Distance Detector configuration |
| void acc_detector_distance_config_start_set | ( | acc_detector_distance_config_t * | config, |
| float | start_m | ||
| ) |
Set start of measured interval (m)
This should be used to make sure that objects in the desired range interval can be detected.
| [out] | config | The Distance Detector configuration |
| [in] | start_m | The start of measured interval (m) |
| acc_detector_distance_threshold_method_t acc_detector_distance_config_threshold_method_get | ( | const acc_detector_distance_config_t * | config | ) |
Get threshold method.
See acc_detector_distance_config_threshold_method_set.
| [in] | config | The Distance Detector configuration |
| 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.
Sets which method to use for determining if a peak in the underlying radar data is a reflection or not (and will be returned as a distance estimation).
See acc_detector_distance_threshold_method_t for a short description of each method.
More detailed information on thresholds can be found in the Distance Detector User Guide.
| [out] | config | The Distance Detector configuration |
| [in] | threshold_method | The threshold method |
| float acc_detector_distance_config_threshold_sensitivity_get | ( | const acc_detector_distance_config_t * | config | ) |
Get threshold sensitivity.
See acc_detector_distance_config_threshold_sensitivity_set.
| [in] | config | The Distance Detector configuration |
| void acc_detector_distance_config_threshold_sensitivity_set | ( | acc_detector_distance_config_t * | config, |
| float | threshold_sensitivity | ||
| ) |
Set threshold sensitivity.
Set how sensitive the threshold is. Only applicable for ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_RECORDED and ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR.
A high sensitivity will make the Distance Detector find more reflections, but there is a higher risk that some of the reflection are false positives.
Threshold sensitivity can be set within the interval [0, 1].
| [out] | config | The Distance Detector configuration |
| [in] | threshold_sensitivity | The threshold sensitivity |
| 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.
The returned handle is used when calling the Detector control and process functions.
| [in] | config | The Distance Detector configuration |
| void acc_detector_distance_destroy | ( | acc_detector_distance_handle_t * | handle | ) |
Destroy Distance Detector handle, freeing its resources.
To be called when Distance Detector handle is no longer needed, typically at end of application.
| [in] | handle | The Distance Detector handle to destroy |
| 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.
buffer_size is the size of working memory (buffer) needed for the different Detector functions. This includes memory for sensor control and Detector calculations. This memory can be reused between sensor instances and Detector handles.
detector_cal_result_static_size is the size of the static part of the Detector calibration result.
Both sizes are dependent on the configuration used which is contained in the provided handle.
| [in] | handle | The Distance Detector handle |
| [out] | buffer_size | The buffer size |
| [out] | detector_cal_result_static_size | The calibration result size |
| 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.
This function loads the provided configuration and calibration result to the sensor via SPI.
This should be done before every measure.
| [in,out] | handle | The Distance Detector handle |
| [in] | config | The Distance Detector configuration |
| [in] | sensor | The sensor instance |
| [in] | sensor_cal_result | The sensor calibration result |
| [in] | buffer | Memory used by the detector. Should be at least buffer_size bytes |
| [in] | buffer_size | The buffer size received by acc_detector_distance_get_sizes |
| 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.
This function takes sensor data (an IQ data frame) as input and finds distances to objects. For more information on the processing, see the Distance Detector User Guide.
Needs to be called multiple times until 'result_available' is true. See example_detector_distance.c how this is done.
| [in] | handle | The Distance Detector handle |
| [in] | buffer | A reference to the buffer (populated by acc_sensor_read) containing the data to be processed. |
| [in] | detector_cal_result_static | The result from acc_detector_distance_calibrate |
| [in] | detector_cal_result_dynamic | The result from acc_detector_distance_calibrate or acc_detector_distance_update_calibration |
| [out] | result_available | True if the result Whether result will contain a new result |
| [out] | result | Distance Detector result |
| 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.
This function should be called if the acc_detector_distance_result_t::calibration_needed indication is set. A new sensor calibration needs to be done before calling this function.
See the calibration sections in the Distance Detector User Guide for more information.
| [in] | sensor | The sensor instance to use for calibration update |
| [in] | handle | The Detector handle |
| [in] | sensor_cal_result | Sensor calibration result |
| [in] | buffer | Working memory buffer needed by function |
| [in] | buffer_size | The size of buffer. Needs to be at least the result of acc_detector_distance_get_sizes |
| [out] | detector_cal_result_dynamic | Result of the calibration update |
| [out] | calibration_complete | Will be set to true when the calibration update is complete. If false; at least one more call to this function is needed. Note that it's necessary to wait for interrupt between calls. |