Data Structures | Macros | Typedefs | Functions
Distance Detector

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...

## Functions
acc_detector_distance_config_t * | acc_detector_distance_config_create (void)
| Create a Distance Detector configuration. More...
void | acc_detector_distance_config_destroy (acc_detector_distance_config_t *config)
| Destroy Distance Detector configuration. More...
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. More...
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. More...
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. More...
void | acc_detector_distance_destroy (acc_detector_distance_handle_t *handle)
| Destroy Distance Detector handle, freeing its resources. More...
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. More...
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. More...
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. More...
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. More...
void | acc_detector_distance_config_start_set (acc_detector_distance_config_t *config, float start_m)
| Set start of measured interval (m) More...
float | acc_detector_distance_config_start_get (const acc_detector_distance_config_t *config)
| Get start of measured interval (m) More...
void | acc_detector_distance_config_end_set (acc_detector_distance_config_t *config, float end_m)
| Set end of measured interval (m) More...
float | acc_detector_distance_config_end_get (const acc_detector_distance_config_t *config)
| Get end of measured interval (m) More...
void | acc_detector_distance_config_max_step_length_set (acc_detector_distance_config_t *config, uint16_t max_step_length)
| Set maximum step length. More...
uint16_t | acc_detector_distance_config_max_step_length_get (const acc_detector_distance_config_t *config)
| Get maximum step length. More...
void | acc_detector_distance_config_close_range_leakage_cancellation_set (acc_detector_distance_config_t *config, bool enable)
| Enable close range leakage cancellation. More...
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. More...
void | acc_detector_distance_config_signal_quality_set (acc_detector_distance_config_t *config, float signal_quality)
| Set signal quality (dB) More...
float | acc_detector_distance_config_signal_quality_get (const acc_detector_distance_config_t *config)
| Get signal quality. More...
void | acc_detector_distance_config_max_profile_set (acc_detector_distance_config_t *config, acc_config_profile_t max_profile)
| Set maximum Profile. More...
acc_config_profile_t | acc_detector_distance_config_max_profile_get (const acc_detector_distance_config_t *config)
| Get maximum Profile. More...
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. More...
acc_detector_distance_threshold_method_t | acc_detector_distance_config_threshold_method_get (const acc_detector_distance_config_t *config)
| Get threshold method. More...
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. More...
acc_detector_distance_peak_sorting_t | acc_detector_distance_config_peak_sorting_get (const acc_detector_distance_config_t *config)
| Get peak sorting method. More...
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. More...
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. More...
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. More...
float | acc_detector_distance_config_fixed_amplitude_threshold_value_get (const acc_detector_distance_config_t *config)
| Get fixed amplitude threshold value. More...
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. More...
float | acc_detector_distance_config_fixed_strength_threshold_value_get (const acc_detector_distance_config_t *config)
| Get fixed strength threshold value. More...
void | acc_detector_distance_config_threshold_sensitivity_set (acc_detector_distance_config_t *config, float threshold_sensitivity)
| Set threshold sensitivity. More...
float | acc_detector_distance_config_threshold_sensitivity_get (const acc_detector_distance_config_t *config)
| Get threshold sensitivity. More...
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. More...
acc_detector_distance_reflector_shape_t | acc_detector_distance_config_reflector_shape_get (const acc_detector_distance_config_t *config)
| Get reflector shape. More...
#define | ACC_DETECTOR_CAL_RESULT_DYNAMIC_DATA_SIZE (8U)
| The size of the result from a completed calibration update. More...
enum | acc_detector_distance_peak_sorting_t { ACC_DETECTOR_DISTANCE_PEAK_SORTING_CLOSEST, ACC_DETECTOR_DISTANCE_PEAK_SORTING_STRONGEST }
| Enum for peak sorting algorithms. More...
enum | acc_detector_distance_threshold_method_t { ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_FIXED_AMPLITUDE, ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_FIXED_STRENGTH, ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_RECORDED, ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR }
| Enum for threshold methods. More...
enum | acc_detector_distance_reflector_shape_t { ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_GENERIC, ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_PLANAR }
| Enum for reflector shapes. More...

## Detailed Description

Distance Detector API description.

For a thorough description of the Distance Detector, see the Distance Detector User Guide.

## Macro Definition Documentation

## ◆ ACC_DETECTOR_CAL_RESULT_DYNAMIC_DATA_SIZE

#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.

## ◆ ACC_DETECTOR_DISTANCE_RESULT_MAX_NUM_DISTANCES

#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 Documentation

## ◆ acc_detector_distance_config_t

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.

## ◆ acc_detector_distance_handle_t

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.

## Enumeration Type Documentation

## ◆ acc_detector_distance_peak_sorting_t

enum acc_detector_distance_peak_sorting_t

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.

## ◆ acc_detector_distance_reflector_shape_t

enum acc_detector_distance_reflector_shape_t

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.

## ◆ acc_detector_distance_threshold_method_t

enum acc_detector_distance_threshold_method_t

Enum for threshold methods.

Enumerator
ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_FIXED_AMPLITUDE | Compares processed data against a fixed amplitude value
ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_FIXED_STRENGTH | Compares processed data against a fixed strength value
ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_RECORDED | Compares processed data against a recorded threshold
ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR | Uses the CFAR algorithm as a threshold

Definition at line 42 of file acc_detector_distance_definitions.h.

## Function Documentation

## ◆ 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.

Calibrating the Detector is needed to ensure reliable Detector results.

See the calibration sections in the Distance Detector User Guide for more information.

Parameters

  [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.

Returns
  true if successful, false otherwise

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

See acc_detector_distance_config_close_range_leakage_cancellation_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  true if enabled, false if disabled

## ◆ 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.

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.

Parameters

  [out] | config | The Distance Detector configuration
  [in] | enable | true to enable close range leakage cancellation logic, false to disable

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ acc_detector_distance_config_create()

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.

Returns
  Distance Detector configuration, NULL at failure

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ acc_detector_distance_config_destroy()

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.

Parameters

  [in] | config | The Distance Detector configuration to destroy

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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)

See acc_detector_distance_config_end_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The end of measured interval

## ◆ 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)

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.

Parameters

  [out] | config | The Distance Detector configuration
  [in] | end_m | The end of measured interval

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

See acc_detector_distance_config_fixed_amplitude_threshold_value_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The fixed threshold value

## ◆ 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.

See acc_detector_distance_config_threshold_method_set for more information.

Parameters

  [out] | config | The Distance Detector configuration
  [in] | fixed_threshold_value | The fixed threshold value

Examples
  ref_app_tank_level.c.

## ◆ 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.

See acc_detector_distance_config_fixed_strength_threshold_value_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The fixed threshold value

## ◆ 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.

See acc_detector_distance_config_threshold_method_set for more information.

Parameters

  [out] | config | The Distance Detector configuration
  [in] | fixed_threshold_value | The fixed threshold value

Examples
  ref_app_tank_level.c.

## ◆ 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.

If handle != NULL, the underlying sensor configs will also be logged.

Parameters

  [in] | handle | The Distance Detector handle, can be NULL
  [in] | config | The Distance Detector configuration

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, and example_detector_distance_with_iq_data_print.c.

## ◆ 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.

See acc_detector_distance_config_max_profile_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The maximum Profile

## ◆ 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.

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.

Parameters

  [out] | config | The Distance Detector configuration
  [in] | max_profile | The maximum profile

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

See acc_detector_distance_config_max_step_length_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The maximum step length

## ◆ 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.

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.

Parameters

  [out] | config | The Distance Detector configuration
  [in] | max_step_length | The maximum step length

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

See acc_detector_distance_config_num_frames_recorded_threshold_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The number of frames

## ◆ 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.

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.

Parameters

  [out] | config | The Distance Detector configuration
  [in] | num_frames | The number of frames

Examples
  example_detector_distance_calibration_caching.c, and ref_app_tank_level.c.

## ◆ 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.

See acc_detector_distance_config_peak_sorting_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The peak sorting method

## ◆ 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.

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.

Parameters

  [out] | config | The Distance Detector configuration
  [in] | peak_sorting | The peak sorting method

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

See acc_detector_distance_config_reflector_shape_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The reflector shape

## ◆ 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.

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.

Parameters

  [out] | config | The Distance Detector configuration
  [in] | reflector_shape | The reflector shape

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

See acc_detector_distance_config_signal_quality_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The signal quality

## ◆ 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)

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].

Parameters

  [out] | config | The Distance Detector configuration
  [in] | signal_quality | The signal quality

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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)

See acc_detector_distance_config_start_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The start of measured interval (m)

## ◆ 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)

This should be used to make sure that objects in the desired range interval can be detected.

Parameters

  [out] | config | The Distance Detector configuration
  [in] | start_m | The start of measured interval (m)

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

See acc_detector_distance_config_threshold_method_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The threshold method

## ◆ 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.

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.

Parameters

  [out] | config | The Distance Detector configuration
  [in] | threshold_method | The threshold method

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

See acc_detector_distance_config_threshold_sensitivity_set.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  The threshold sensitivity

## ◆ 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.

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].

Parameters

  [out] | config | The Distance Detector configuration
  [in] | threshold_sensitivity | The threshold sensitivity

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

The returned handle is used when calling the Detector control and process functions.

Parameters

  [in] | config | The Distance Detector configuration

Returns
  Distance Detector handle, NULL at failure

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ acc_detector_distance_destroy()

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.

Parameters

  [in] | handle | The Distance Detector handle to destroy

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

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.

Parameters

  [in] | handle | The Distance Detector handle
  [out] | buffer_size | The buffer size
  [out] | detector_cal_result_static_size | The calibration result size

Returns
  true if successful, false otherwise

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

This function loads the provided configuration and calibration result to the sensor via SPI.

This should be done before every measure.

Parameters

  [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

Returns
  true if successful, false otherwise

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

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.

Parameters

  [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

Returns
  true if successful, false otherwise

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.

## ◆ 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.

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.

Parameters

  [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.

Returns
  true if successful, false otherwise

Examples
  example_detector_distance.c, example_detector_distance_calibration_caching.c, example_detector_distance_with_iq_data_print.c, and ref_app_tank_level.c.