example_detector_distance_with_iq_data_print.c
Go to the documentation of this file.
1 // Copyright (c) Acconeer AB, 2023-2024
2 // All rights reserved
3 // This file is subject to the terms and conditions defined in the file
4 // 'LICENSES/license_acconeer.txt', (BSD 3-Clause License) which is part
5 // of this source code package.
6 
7 #include <math.h>
8 #include <stdbool.h>
9 #include <stdint.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 
13 #include "acc_definitions_a121.h"
14 #include "acc_detector_distance.h"
17 #include "acc_integration.h"
18 #include "acc_integration_log.h"
19 #include "acc_rss_a121.h"
20 #include "acc_sensor.h"
21 #include "acc_version.h"
22 
23 /** \example example_detector_distance_with_iq_data_print.c
24  * @brief This is an example on how the Detector Distance API can be used
25  * @n
26  * This example executes as follows:
27  * - Retrieve HAL integration
28  * - Initialize distance detector resources:
29  * + Create distance detector configuration
30  * + Update configuration settings
31  * + Create Distance detector handle
32  * + Create buffer for detector calibration data
33  * + Create buffer for sensor data
34  * - Create and calibrate the sensor
35  * - Calibrate the detector
36  * - Measure distances with the detector (loop):
37  * + Prepare sensor with the detector
38  * + Measure and wait until a read can be done
39  * + Print IQ data amplitude
40  * + Process measurement and print the result
41  * + Handle "calibration_needed" indication
42  * - Cleanup:
43  * + Destroy detector configuration
44  * + Destroy detector handle
45  * + Destroy sensor data buffer
46  * + Destroy detector calibration data buffer
47  */
48 
49 typedef enum
50 {
55 
56 #define SENSOR_ID (1U)
57 // 2 seconds should be enough even for long ranges and high signal quality
58 #define SENSOR_TIMEOUT_MS (2000U)
59 
60 typedef struct
61 {
65  void *buffer;
66  uint32_t buffer_size;
69  acc_detector_cal_result_dynamic_t detector_cal_result_dynamic;
71 
72 static void cleanup(distance_detector_resources_t *resources);
73 
74 static void set_config(acc_detector_distance_config_t *detector_config, distance_preset_config_t preset);
75 
77 
79 
81 
83 
87 
89 
90 static void print_iq_data(const acc_config_t *sensor_config,
91  acc_processing_result_t *processing_result,
92  acc_processing_metadata_t *processing_metadata);
93 
94 int acconeer_main(int argc, char *argv[]);
95 
96 int acconeer_main(int argc, char *argv[])
97 {
98  (void)argc;
99  (void)argv;
100  distance_detector_resources_t resources = {0};
101 
102  printf("Acconeer software version %s\n", acc_version_get());
103 
105 
106  if (!acc_rss_hal_register(hal))
107  {
108  return EXIT_FAILURE;
109  }
110 
112  if (resources.config == NULL)
113  {
114  printf("acc_detector_distance_config_create() failed\n");
115  cleanup(&resources);
116  return EXIT_FAILURE;
117  }
118 
120 
121  if (!initialize_detector_resources(&resources))
122  {
123  printf("Initializing detector resources failed\n");
124  cleanup(&resources);
125  return EXIT_FAILURE;
126  }
127 
128  // Print the configuration
129  acc_detector_distance_config_log(resources.handle, resources.config);
130 
131  /* Turn the sensor on */
134 
135  resources.sensor = acc_sensor_create(SENSOR_ID);
136  if (resources.sensor == NULL)
137  {
138  printf("acc_sensor_create() failed\n");
139  cleanup(&resources);
140  return EXIT_FAILURE;
141  }
142 
144 
145  if (!do_sensor_calibration(resources.sensor, &sensor_cal_result, resources.buffer, resources.buffer_size))
146  {
147  printf("Sensor calibration failed\n");
148  cleanup(&resources);
149  return EXIT_FAILURE;
150  }
151 
153  {
154  printf("Detector calibration failed\n");
155  cleanup(&resources);
156  return EXIT_FAILURE;
157  }
158 
159  while (true)
160  {
162 
163  if (!do_detector_get_next(&resources, &sensor_cal_result, &result))
164  {
165  printf("Could not get next result\n");
166  cleanup(&resources);
167  return EXIT_FAILURE;
168  }
169 
170  /* If "calibration needed" is indicated, the sensor needs to be recalibrated and the detector calibration updated */
172  {
173  printf("Sensor recalibration and detector calibration update needed ... \n");
174 
175  if (!do_sensor_calibration(resources.sensor, &sensor_cal_result, resources.buffer, resources.buffer_size))
176  {
177  printf("Sensor calibration failed\n");
178  cleanup(&resources);
179  return EXIT_FAILURE;
180  }
181 
182  /* Once the sensor is recalibrated, the detector calibration should be updated and measuring can continue. */
184  {
185  printf("Detector calibration update failed\n");
186  cleanup(&resources);
187  return EXIT_FAILURE;
188  }
189 
190  printf("Sensor recalibration and detector calibration update done!\n");
191  }
192  else
193  {
195  }
196  }
197 
198  cleanup(&resources);
199 
200  printf("Done!\n");
201 
202  return EXIT_SUCCESS;
203 }
204 
205 static void cleanup(distance_detector_resources_t *resources)
206 {
209 
212 
213  acc_integration_mem_free(resources->buffer);
215 
216  if (resources->sensor != NULL)
217  {
218  acc_sensor_destroy(resources->sensor);
219  }
220 }
221 
223 {
224  // Add configuration of the detector here
225  switch (preset)
226  {
228  // Add configuration of the detector here
229  break;
230 
232  acc_detector_distance_config_start_set(detector_config, 0.25f);
233  acc_detector_distance_config_end_set(detector_config, 3.0f);
240  acc_detector_distance_config_signal_quality_set(detector_config, 15.0f);
242  break;
243 
245  acc_detector_distance_config_start_set(detector_config, 0.25f);
246  acc_detector_distance_config_end_set(detector_config, 3.0f);
253  acc_detector_distance_config_signal_quality_set(detector_config, 20.0f);
255  break;
256  }
257 }
258 
260 {
261  resources->handle = acc_detector_distance_create(resources->config);
262  if (resources->handle == NULL)
263  {
264  printf("acc_detector_distance_create() failed\n");
265  return false;
266  }
267 
268  if (!acc_detector_distance_get_sizes(resources->handle, &(resources->buffer_size), &(resources->detector_cal_result_static_size)))
269  {
270  printf("acc_detector_distance_get_sizes() failed\n");
271  return false;
272  }
273 
274  resources->buffer = acc_integration_mem_alloc(resources->buffer_size);
275  if (resources->buffer == NULL)
276  {
277  printf("sensor buffer allocation failed\n");
278  return false;
279  }
280 
282  if (resources->detector_cal_result_static == NULL)
283  {
284  printf("calibration buffer allocation failed\n");
285  return false;
286  }
287 
288  return true;
289 }
290 
292 {
293  bool status = false;
294  bool cal_complete = false;
295  const uint16_t calibration_retries = 1U;
296 
297  // Random disturbances may cause the calibration to fail. At failure, retry at least once.
298  for (uint16_t i = 0; !status && (i <= calibration_retries); i++)
299  {
300  // Reset sensor before calibration by disabling/enabling it
303 
304  do
305  {
306  status = acc_sensor_calibrate(sensor, &cal_complete, sensor_cal_result, buffer, buffer_size);
307 
308  if (status && !cal_complete)
309  {
311  }
312  } while (status && !cal_complete);
313  }
314 
315  if (status)
316  {
317  /* Reset sensor after calibration by disabling/enabling it */
320  }
321 
322  return status;
323 }
324 
326 {
327  bool done = false;
328  bool status;
329 
330  do
331  {
332  status = acc_detector_distance_calibrate(resources->sensor,
333  resources->handle,
335  resources->buffer,
336  resources->buffer_size,
337  resources->detector_cal_result_static,
339  &resources->detector_cal_result_dynamic,
340  &done);
341 
342  if (status && !done)
343  {
345  }
346  } while (status && !done);
347 
348  return status;
349 }
350 
352 {
353  bool done = false;
354  bool status;
355 
356  do
357  {
359  resources->handle,
361  resources->buffer,
362  resources->buffer_size,
363  &resources->detector_cal_result_dynamic,
364  &done);
365 
366  if (status && !done)
367  {
369  }
370  } while (status && !done);
371 
372  return status;
373 }
374 
378 {
379  bool result_available = false;
380 
381  do
382  {
383  if (!acc_detector_distance_prepare(resources->handle,
384  resources->config,
385  resources->sensor,
387  resources->buffer,
388  resources->buffer_size))
389  {
390  printf("acc_detector_distance_prepare() failed\n");
391  return false;
392  }
393 
394  if (!acc_sensor_measure(resources->sensor))
395  {
396  printf("acc_sensor_measure() failed\n");
397  return false;
398  }
399 
401  {
402  printf("Sensor interrupt timeout\n");
403  return false;
404  }
405 
406  if (!acc_sensor_read(resources->sensor, resources->buffer, resources->buffer_size))
407  {
408  printf("acc_sensor_read() failed\n");
409  return false;
410  }
411 
412  if (!acc_detector_distance_process(resources->handle,
413  resources->buffer,
414  resources->detector_cal_result_static,
415  &resources->detector_cal_result_dynamic,
416  &result_available,
417  result))
418  {
419  printf("acc_detector_distance_process() failed\n");
420  return false;
421  }
422 
423  /**
424  * The function for printing the IQ data must be called every time
425  * the acc_detector_distance_process has been called.
426  */
427  print_iq_data(result->sensor_config, result->processing_result, result->processing_metadata);
428  } while (!result_available);
429 
430  return true;
431 }
432 
434  acc_processing_result_t *processing_result,
435  acc_processing_metadata_t *processing_metadata)
436 {
437  /* Get the iq data frame from the processing result */
438  acc_int16_complex_t *frame = processing_result->frame;
439 
440  /* Get information about the frame from the sensor config */
441  uint16_t sweeps_per_frame = acc_config_sweeps_per_frame_get(sensor_config);
442  uint8_t num_subsweeps = acc_config_num_subsweeps_get(sensor_config);
443  uint16_t sweep_length = processing_metadata->frame_data_length / sweeps_per_frame;
444 
445  printf("BEGIN:Distance(m), [Frame], Amplitude\n");
446 
447  /* Loop over all subsweeps */
448  for (uint8_t subsweep_idx = 0; subsweep_idx < num_subsweeps; subsweep_idx++)
449  {
450  /* Get information about the start point and step length from the sensor config */
451  int32_t start_point = acc_config_subsweep_start_point_get(sensor_config, subsweep_idx);
452  uint16_t step_length = acc_config_subsweep_step_length_get(sensor_config, subsweep_idx);
453 
454  /* Get subsweep offset and length from the processing metadata */
455  uint16_t subsweep_offset = processing_metadata->subsweep_data_offset[subsweep_idx];
456  uint16_t subsweep_length = processing_metadata->subsweep_data_length[subsweep_idx];
457 
458  /* Loop over all points in subsweep */
459  for (uint16_t point_idx = 0; point_idx < subsweep_length; point_idx++)
460  {
461  /* Print the point distance, in meters */
462  float distance = acc_processing_points_to_meter(start_point + point_idx * step_length);
463  printf("%" PRIfloat ", [", ACC_LOG_FLOAT_TO_INTEGER(distance));
464 
465  /* Perform a coherent mean calculation for the point over sweeps per frame */
466  int32_t iq_point_real_acc = 0;
467  int32_t iq_point_imag_acc = 0;
468 
469  /* Loop over all points in sweeps_per_frame */
470  for (uint16_t sweep_idx = 0; sweep_idx < sweeps_per_frame; sweep_idx++)
471  {
472  uint16_t point_offset = sweep_idx * sweep_length + subsweep_offset + point_idx;
473  iq_point_real_acc += frame[point_offset].real;
474  iq_point_imag_acc += frame[point_offset].imag;
475 
476  /* Make sure to print correct sign for imaginary part*/
477  char sign[1] = "+";
478  int16_t imag = frame[point_offset].imag;
479 
480  if (imag < 0)
481  {
482  sign[0] = '-';
483  imag = -imag;
484  }
485 
486  /* Print IQ point*/
487  printf("%" PRIi16 "%s%" PRIi16 "i%s", frame[point_offset].real, sign, imag, ((sweep_idx + 1 == sweeps_per_frame) ? "" : ", "));
488  }
489 
490  iq_point_real_acc = iq_point_real_acc / sweeps_per_frame;
491  iq_point_imag_acc = iq_point_imag_acc / sweeps_per_frame;
492 
493  /* Calculate the absolute value of the IQ point */
494  uint32_t iq_point_abs = (uint32_t)sqrt(iq_point_real_acc * iq_point_real_acc + iq_point_imag_acc * iq_point_imag_acc);
495 
496  /* Print the point absolute value */
497  printf("], %" PRIu32 "\n", iq_point_abs);
498  }
499  }
500 
501  printf("END:Distance(m), [Frame], Amplitude\n");
502 }
503 
505 {
506  printf("%d detected distances", result->num_distances);
507  if (result->num_distances > 0)
508  {
509  printf(": ");
510 
511  for (uint8_t i = 0; i < result->num_distances; i++)
512  {
513  printf("%" PRIfloat " m ", ACC_LOG_FLOAT_TO_INTEGER(result->distances[i]));
514  }
515  }
516 
517  printf("\n");
518 }
acc_hal_integration_sensor_supply_off
void acc_hal_integration_sensor_supply_off(acc_sensor_id_t sensor_id)
Power off sensor supply.
Definition: acc_hal_integration_stm32cube_xm.c:104
acc_rss_a121.h
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_processing_metadata_t::subsweep_data_offset
uint16_t subsweep_data_offset[(4U)]
Definition: acc_processing.h:43
cargo_result_t::calibration_needed
bool calibration_needed
Definition: example_cargo.h:112
acc_detector_distance_config_peak_sorting_set
void acc_detector_distance_config_peak_sorting_set(acc_detector_distance_config_t *config, acc_detector_distance_peak_sorting_t peak_sorting)
Set peak sorting method.
DISTANCE_PRESET_CONFIG_HIGH_ACCURACY
@ DISTANCE_PRESET_CONFIG_HIGH_ACCURACY
Definition: example_detector_distance_with_iq_data_print.c:53
acc_hal_integration_sensor_supply_on
void acc_hal_integration_sensor_supply_on(acc_sensor_id_t sensor_id)
Power on sensor supply.
Definition: acc_hal_integration_stm32cube_xm.c:99
acc_processing_result_t
Result provided by the processing module.
Definition: acc_processing.h:71
do_detector_get_next
static bool do_detector_get_next(distance_detector_resources_t *resources, const acc_cal_result_t *sensor_cal_result, acc_detector_distance_result_t *result)
Definition: example_detector_distance_with_iq_data_print.c:375
do_detector_calibration_update
static bool do_detector_calibration_update(distance_detector_resources_t *resources, const acc_cal_result_t *sensor_cal_result)
Definition: example_detector_distance_with_iq_data_print.c:351
distance_detector_resources_t::detector_cal_result_static_size
uint32_t detector_cal_result_static_size
Definition: i2c_distance_detector.c:39
acc_sensor_read
bool acc_sensor_read(const acc_sensor_t *sensor, void *buffer, uint32_t buffer_size)
Read out radar data.
buffer
void * buffer
Definition: i2c_example_cargo.c:40
acc_version.h
sensor_cal_result
acc_cal_result_t sensor_cal_result
Definition: i2c_example_cargo.c:36
acc_config_num_subsweeps_get
uint8_t acc_config_num_subsweeps_get(const acc_config_t *config)
Get the number of subsweeps to use.
cleanup
static void cleanup(distance_detector_resources_t *resources)
Definition: example_detector_distance_with_iq_data_print.c:205
acc_int16_complex_t
Data type for interger-based representation of complex numbers.
Definition: acc_definitions_common.h:40
ACC_DETECTOR_DISTANCE_PEAK_SORTING_STRONGEST
@ ACC_DETECTOR_DISTANCE_PEAK_SORTING_STRONGEST
Definition: acc_detector_distance_definitions.h:36
distance_detector_resources_t::buffer_size
uint32_t buffer_size
Definition: i2c_distance_detector.c:37
acc_detector_distance_config_threshold_method_set
void acc_detector_distance_config_threshold_method_set(acc_detector_distance_config_t *config, acc_detector_distance_threshold_method_t threshold_method)
Set threshold method.
distance_preset_config_t
distance_preset_config_t
Definition: example_detector_distance_low_power_hibernate.c:47
print_distance_result
static void print_distance_result(const acc_detector_distance_result_t *result)
Definition: example_detector_distance_with_iq_data_print.c:504
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)
acconeer_main
int acconeer_main(int argc, char *argv[])
Assembly test example.
Definition: example_detector_distance_with_iq_data_print.c:96
ACC_CONFIG_PROFILE_5
@ ACC_CONFIG_PROFILE_5
Definition: acc_definitions_a121.h:57
acc_integration.h
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.
do_sensor_calibration
static bool do_sensor_calibration(acc_sensor_t *sensor, acc_cal_result_t *sensor_cal_result, void *buffer, uint32_t buffer_size)
Definition: example_detector_distance_with_iq_data_print.c:291
acc_detector_distance_config_destroy
void acc_detector_distance_config_destroy(acc_detector_distance_config_t *config)
Destroy Distance Detector configuration.
DISTANCE_PRESET_CONFIG_BALANCED
@ DISTANCE_PRESET_CONFIG_BALANCED
Definition: example_detector_distance_with_iq_data_print.c:52
config
cargo_config_t config
Definition: i2c_example_cargo.c:34
acc_hal_rss_integration_get_implementation
const acc_hal_a121_t * acc_hal_rss_integration_get_implementation(void)
Get hal implementation reference.
Definition: acc_hal_integration_stm32cube_xm.c:152
DISTANCE_PRESET_CONFIG_NONE
@ DISTANCE_PRESET_CONFIG_NONE
Definition: example_detector_distance_with_iq_data_print.c:51
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.
distance_detector_resources_t::detector_cal_result_dynamic
acc_detector_cal_result_dynamic_t detector_cal_result_dynamic
Definition: i2c_distance_detector.c:40
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_integration_mem_alloc
void * acc_integration_mem_alloc(size_t size)
Allocate dynamic memory.
Definition: acc_integration_stm32.c:592
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_hal_a121_t
Definition: acc_hal_definitions_a121.h:82
acc_rss_hal_register
bool acc_rss_hal_register(const acc_hal_a121_t *hal)
Register an integration.
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
distance_detector_resources_t::detector_cal_result_static
uint8_t * detector_cal_result_static
Definition: i2c_distance_detector.c:38
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
distance_detector_resources_t
Definition: i2c_distance_detector.c:29
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_config_sweeps_per_frame_get
uint16_t acc_config_sweeps_per_frame_get(const acc_config_t *config)
Get the number of sweeps per frame.
acc_detector_distance_destroy
void acc_detector_distance_destroy(acc_detector_distance_handle_t *handle)
Destroy Distance Detector handle, freeing its resources.
acc_hal_integration_wait_for_sensor_interrupt
bool acc_hal_integration_wait_for_sensor_interrupt(acc_sensor_id_t sensor_id, uint32_t timeout_ms)
Wait for a sensor interrupt.
Definition: acc_hal_integration_stm32cube_xm.c:130
acc_hal_integration_a121.h
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
acc_processing_metadata_t::frame_data_length
uint16_t frame_data_length
Definition: acc_processing.h:39
result
cargo_result_t result
Definition: i2c_example_cargo.c:43
acc_int16_complex_t::real
int16_t real
Definition: acc_definitions_common.h:42
acc_version_get
const char * acc_version_get(void)
Get the version of the Acconeer software.
acc_config_t
struct acc_config acc_config_t
Definition: acc_config.h:24
printf
#define printf
Definition: printf.h:60
acc_config_subsweep_step_length_get
uint16_t acc_config_subsweep_step_length_get(const acc_config_t *config, uint8_t index)
Get the step length in a sweep.
acc_processing_points_to_meter
float acc_processing_points_to_meter(int32_t points)
Convert a distance or step length in points to meter.
detector_cal_result_static_size
static uint32_t detector_cal_result_static_size
Definition: example_detector_distance_calibration_caching.c:71
acc_hal_integration_sensor_enable
void acc_hal_integration_sensor_enable(acc_sensor_id_t sensor_id)
Enable sensor.
Definition: acc_hal_integration_stm32cube_xm.c:109
acc_hal_definitions_a121.h
initialize_detector_resources
static bool initialize_detector_resources(distance_detector_resources_t *resources)
Definition: example_detector_distance_with_iq_data_print.c:259
set_config
static void set_config(acc_detector_distance_config_t *detector_config, distance_preset_config_t preset)
Definition: example_detector_distance_with_iq_data_print.c:222
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.
ref_app_parking_handle::sensor_config
acc_config_t * sensor_config
Definition: ref_app_parking.c:38
do_full_detector_calibration
static bool do_full_detector_calibration(distance_detector_resources_t *resources, const acc_cal_result_t *sensor_cal_result)
Definition: example_detector_distance_with_iq_data_print.c:325
acc_detector_distance_result_t
Distance Detector result returned from acc_detector_distance_process.
Definition: acc_detector_distance.h:48
distance_preset_config_t
distance_preset_config_t
Definition: example_detector_distance_with_iq_data_print.c:49
ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR
@ ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR
Definition: acc_detector_distance_definitions.h:51
distance_detector_resources_t::config
acc_detector_distance_config_t * config
Definition: i2c_distance_detector.c:33
acc_processing_result_t::frame
acc_int16_complex_t * frame
Definition: acc_processing.h:91
acc_hal_integration_sensor_disable
void acc_hal_integration_sensor_disable(acc_sensor_id_t sensor_id)
Disable sensor.
Definition: acc_hal_integration_stm32cube_xm.c:119
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_integration_log.h
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_LOG_FLOAT_TO_INTEGER
#define ACC_LOG_FLOAT_TO_INTEGER(a)
Definition: acc_integration_log.h:26
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.
print_iq_data
static void print_iq_data(const acc_config_t *sensor_config, acc_processing_result_t *processing_result, acc_processing_metadata_t *processing_metadata)
Definition: example_detector_distance_with_iq_data_print.c:433
SENSOR_ID
#define SENSOR_ID
Definition: example_detector_distance_with_iq_data_print.c:56
acc_integration_mem_free
void acc_integration_mem_free(void *ptr)
Free dynamic memory.
Definition: acc_integration_stm32.c:602
acc_int16_complex_t::imag
int16_t imag
Definition: acc_definitions_common.h:43
acc_detector_distance_config_reflector_shape_set
void acc_detector_distance_config_reflector_shape_set(acc_detector_distance_config_t *config, acc_detector_distance_reflector_shape_t reflector_shape)
Set reflector shape.
distance_detector_resources_t::sensor
acc_sensor_t * sensor
Definition: i2c_distance_detector.c:31
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.h
acc_sensor_calibrate
bool acc_sensor_calibrate(acc_sensor_t *sensor, bool *cal_complete, acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size)
Calibrate a sensor.
PRIfloat
#define PRIfloat
Specifier for printing float type using integers.
Definition: acc_integration_log.h:31
distance_detector_resources_t::handle
acc_detector_distance_handle_t * handle
Definition: i2c_distance_detector.c:34
distance_detector_resources_t::buffer
void * buffer
Definition: i2c_distance_detector.c:36
acc_detector_distance_config_t
struct acc_detector_distance_config acc_detector_distance_config_t
Distance Detector configuration.
Definition: acc_detector_distance.h:43
ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_GENERIC
@ ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_GENERIC
Definition: acc_detector_distance_definitions.h:60
acc_detector_distance_config_max_step_length_set
void acc_detector_distance_config_max_step_length_set(acc_detector_distance_config_t *config, uint16_t max_step_length)
Set maximum step length.
acc_sensor_measure
bool acc_sensor_measure(acc_sensor_t *sensor)
Start a radar measurement with previously prepared configuration.
SENSOR_TIMEOUT_MS
#define SENSOR_TIMEOUT_MS
Definition: example_detector_distance_with_iq_data_print.c:58
acc_config_subsweep_start_point_get
int32_t acc_config_subsweep_start_point_get(const acc_config_t *config, uint8_t index)
Get the starting point of the sweep.
acc_sensor_t
struct acc_sensor acc_sensor_t
Definition: acc_sensor.h:31
ACC_CONFIG_PROFILE_3
@ ACC_CONFIG_PROFILE_3
Definition: acc_definitions_a121.h:54
acc_sensor_destroy
void acc_sensor_destroy(acc_sensor_t *sensor)
Destroy a sensor instance freeing any resources allocated.
acc_processing_metadata_t::subsweep_data_length
uint16_t subsweep_data_length[(4U)]
Definition: acc_processing.h:45
acc_definitions_a121.h
acc_sensor_create
acc_sensor_t * acc_sensor_create(acc_sensor_id_t sensor_id)
Create a sensor instance.