example_detector_presence_with_iq_data_print.c
Go to the documentation of this file.
1 // Copyright (c) Acconeer AB, 2022-2025
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_definitions_common.h"
15 #include "acc_detector_presence.h"
18 #include "acc_integration.h"
19 #include "acc_integration_log.h"
20 #include "acc_rss_a121.h"
21 #include "acc_sensor.h"
22 
23 #include "acc_version.h"
24 
25 /** \example example_detector_presence_with_iq_data_print.c
26  * @brief This is an example on how the Detector Presence API can be used
27  * @n
28  * The example executes as follows:
29  * - Create a presence configuration
30  * - Create a sensor instance
31  * - Create a detector instance
32  * - Calibrate the sensor
33  * - Prepare the detector
34  * - Perform a sensor measurement and read out the data
35  * - Process the measurement and get detector result
36  * - Print the result
37  * - Destroy the configuration
38  * - Destroy the detector instance
39  * - Destroy the sensor instance
40  */
41 
42 typedef enum
43 {
50 
51 #define SENSOR_ID (1U)
52 #define SENSOR_TIMEOUT_MS (2000U)
53 
54 #define DEFAULT_PRESET_CONFIG PRESENCE_PRESET_CONFIG_MEDIUM_RANGE
55 
56 static bool do_sensor_calibration(acc_sensor_t *sensor, acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size);
57 
59 
61 
62 static void cleanup(acc_detector_presence_handle_t *presence_handle,
63  acc_detector_presence_config_t *presence_config,
65  void *buffer);
66 
67 static void set_config(acc_detector_presence_config_t *presence_config, presence_preset_config_t preset);
68 
69 int acconeer_main(int argc, char *argv[]);
70 
71 int acconeer_main(int argc, char *argv[])
72 {
73  (void)argc;
74  (void)argv;
75  acc_detector_presence_config_t *presence_config = NULL;
76  acc_detector_presence_handle_t *presence_handle = NULL;
78  acc_sensor_t *sensor = NULL;
79  void *buffer = NULL;
80  uint32_t buffer_size = 0U;
81 
82  printf("Acconeer software version %s\n", acc_version_get());
83 
85 
86  if (!acc_rss_hal_register(hal))
87  {
88  return EXIT_FAILURE;
89  }
90 
91  presence_config = acc_detector_presence_config_create();
92  if (presence_config == NULL)
93  {
94  printf("acc_detector_presence_config_create() failed\n");
95  cleanup(presence_handle, presence_config, sensor, buffer);
96  return EXIT_FAILURE;
97  }
98 
99  set_config(presence_config, DEFAULT_PRESET_CONFIG);
100 
101  // Print the configuration
102  acc_detector_presence_config_log(presence_config);
103 
104  presence_handle = acc_detector_presence_create(presence_config, &metadata);
105  if (presence_handle == NULL)
106  {
107  printf("acc_detector_presence_create() failed\n");
108  cleanup(presence_handle, presence_config, sensor, buffer);
109  return EXIT_FAILURE;
110  }
111 
112  if (!acc_detector_presence_get_buffer_size(presence_handle, &buffer_size))
113  {
114  printf("acc_detector_presence_get_buffer_size() failed\n");
115  cleanup(presence_handle, presence_config, sensor, buffer);
116  return EXIT_FAILURE;
117  }
118 
120  if (buffer == NULL)
121  {
122  printf("buffer allocation failed\n");
123  cleanup(presence_handle, presence_config, sensor, buffer);
124  return EXIT_FAILURE;
125  }
126 
129 
131  if (sensor == NULL)
132  {
133  printf("acc_sensor_create() failed\n");
134  cleanup(presence_handle, presence_config, sensor, buffer);
135  return EXIT_FAILURE;
136  }
137 
138  acc_cal_result_t cal_result;
139 
140  if (!do_sensor_calibration(sensor, &cal_result, buffer, buffer_size))
141  {
142  printf("do_sensor_calibration() failed\n");
143  cleanup(presence_handle, presence_config, sensor, buffer);
144  return EXIT_FAILURE;
145  }
146 
147  if (!acc_detector_presence_prepare(presence_handle, presence_config, sensor, &cal_result, buffer, buffer_size))
148  {
149  printf("acc_detector_presence_prepare() failed\n");
150  cleanup(presence_handle, presence_config, sensor, buffer);
151  return EXIT_FAILURE;
152  }
153 
154  while (true)
155  {
157 
159  {
160  printf("acc_sensor_measure failed\n");
161  cleanup(presence_handle, presence_config, sensor, buffer);
162  return EXIT_FAILURE;
163  }
164 
166  {
167  printf("Sensor interrupt timeout\n");
168  cleanup(presence_handle, presence_config, sensor, buffer);
169  return EXIT_FAILURE;
170  }
171 
173  {
174  printf("acc_sensor_read failed\n");
175  cleanup(presence_handle, presence_config, sensor, buffer);
176  return EXIT_FAILURE;
177  }
178 
179  if (!acc_detector_presence_process(presence_handle, buffer, &result))
180  {
181  printf("acc_detector_presence_process failed\n");
182  cleanup(presence_handle, presence_config, sensor, buffer);
183  return EXIT_FAILURE;
184  }
185 
187  print_iq_data(&result, &metadata);
188 
189  if (result.processing_result.data_saturated)
190  {
191  printf("Data saturated. The detector result is not reliable.\n");
192  }
193 
194  if (result.processing_result.frame_delayed)
195  {
196  printf("Frame delayed. Could not read data fast enough.\n");
197  printf("Try lowering the frame rate or call 'acc_sensor_read' more frequently.\n");
198  }
199 
200  /* If "calibration_needed" is indicated, the sensor needs to be recalibrated. */
201  if (result.processing_result.calibration_needed)
202  {
203  printf("Sensor recalibration needed ... \n");
204 
205  if (!do_sensor_calibration(sensor, &cal_result, buffer, buffer_size))
206  {
207  printf("do_sensor_calibration() failed\n");
208  cleanup(presence_handle, presence_config, sensor, buffer);
209  return EXIT_FAILURE;
210  }
211 
212  printf("Sensor recalibration done!\n");
213 
214  /* Before measuring again, the sensor needs to be prepared through the detector. */
215  if (!acc_detector_presence_prepare(presence_handle, presence_config, sensor, &cal_result, buffer, buffer_size))
216  {
217  printf("acc_detector_presence_prepare() failed\n");
218  cleanup(presence_handle, presence_config, sensor, buffer);
219  return EXIT_FAILURE;
220  }
221  }
222  }
223 
224  cleanup(presence_handle, presence_config, sensor, buffer);
225 
226  printf("Application finished OK\n");
227 
228  return EXIT_SUCCESS;
229 }
230 
231 static void cleanup(acc_detector_presence_handle_t *presence_handle,
232  acc_detector_presence_config_t *presence_config,
234  void *buffer)
235 {
238 
239  if (presence_config != NULL)
240  {
241  acc_detector_presence_config_destroy(presence_config);
242  }
243 
244  if (presence_handle != NULL)
245  {
246  acc_detector_presence_destroy(presence_handle);
247  }
248 
249  if (sensor != NULL)
250  {
252  }
253 
254  if (buffer != NULL)
255  {
257  }
258 }
259 
260 static bool do_sensor_calibration(acc_sensor_t *sensor, acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size)
261 {
262  bool status = false;
263  bool cal_complete = false;
264  const uint16_t calibration_retries = 1U;
265 
266  // Random disturbances may cause the calibration to fail. At failure, retry at least once.
267  for (uint16_t i = 0; !status && (i <= calibration_retries); i++)
268  {
269  // Reset sensor before calibration by disabling/enabling it
272 
273  do
274  {
275  status = acc_sensor_calibrate(sensor, &cal_complete, cal_result, buffer, buffer_size);
276 
277  if (status && !cal_complete)
278  {
280  }
281  } while (status && !cal_complete);
282  }
283 
284  if (status)
285  {
286  /* Reset sensor after calibration by disabling/enabling it */
289  }
290 
291  return status;
292 }
293 
295 {
296  /* Get the iq data frame from the processing result */
297  acc_int16_complex_t *frame = result->processing_result.frame;
298 
299  /* Get information about the frame from the sensor config */
300  uint16_t sweeps_per_frame = acc_config_sweeps_per_frame_get(metadata->sensor_config);
301  uint8_t num_subsweeps = acc_config_num_subsweeps_get(metadata->sensor_config);
302  uint16_t sweep_length = metadata->processing_metadata->frame_data_length / sweeps_per_frame;
303 
304  printf("BEGIN:Distance(m), [Frame], Amplitude\n");
305 
306  /* Loop over all subsweeps */
307  for (uint8_t subsweep_idx = 0; subsweep_idx < num_subsweeps; subsweep_idx++)
308  {
309  /* Get information about the start point and step length from the sensor config */
310  int32_t start_point = acc_config_subsweep_start_point_get(metadata->sensor_config, subsweep_idx);
311  uint16_t step_length = acc_config_subsweep_step_length_get(metadata->sensor_config, subsweep_idx);
312 
313  /* Get subsweep offset and length from the processing metadata */
314  uint16_t subsweep_offset = metadata->processing_metadata->subsweep_data_offset[subsweep_idx];
315  uint16_t subsweep_length = metadata->processing_metadata->subsweep_data_length[subsweep_idx];
316 
317  /* Loop over all points in subsweep */
318  for (uint16_t point_idx = 0; point_idx < subsweep_length; point_idx++)
319  {
320  /* Print the point distance, in meters */
321  float distance = acc_processing_points_to_meter(start_point + point_idx * step_length);
322  printf("%" PRIfloat ", [", ACC_LOG_FLOAT_TO_INTEGER(distance));
323 
324  /* Perform a coherent mean calculation for the point over sweeps per frame */
325  int32_t iq_point_real_acc = 0;
326  int32_t iq_point_imag_acc = 0;
327 
328  /* Loop over all points in sweeps_per_frame */
329  for (uint16_t sweep_idx = 0; sweep_idx < sweeps_per_frame; sweep_idx++)
330  {
331  uint16_t point_offset = sweep_idx * sweep_length + subsweep_offset + point_idx;
332  iq_point_real_acc += frame[point_offset].real;
333  iq_point_imag_acc += frame[point_offset].imag;
334 
335  /* Make sure to print correct sign for imaginary part */
336  char sign[1] = "+";
337  int16_t imag = frame[point_offset].imag;
338 
339  if (imag < 0)
340  {
341  sign[0] = '-';
342  imag = -imag;
343  }
344 
345  /* Print IQ point*/
346  printf("%" PRIi16 "%s%" PRIi16 "i%s", frame[point_offset].real, sign, imag, ((sweep_idx + 1 == sweeps_per_frame) ? "" : ", "));
347  }
348 
349  iq_point_real_acc = iq_point_real_acc / sweeps_per_frame;
350  iq_point_imag_acc = iq_point_imag_acc / sweeps_per_frame;
351 
352  /* Calculate the absolute value of the IQ point */
353  uint32_t iq_point_abs = (uint32_t)sqrt(iq_point_real_acc * iq_point_real_acc + iq_point_imag_acc * iq_point_imag_acc);
354 
355  /* Print the point absolute value */
356  printf("], %" PRIu32 "\n", iq_point_abs);
357  }
358  }
359 
360  printf("END:Distance(m), [Frame], Amplitude\n");
361 }
362 
364 {
366  {
367  printf("Motion\n");
368  }
369  else
370  {
371  printf("No motion\n");
372  }
373 
374  // Score and distance are multiplied by 1000 to avoid printing floats
375  printf("Intra presence score: %d, Inter presence score: %d, Distance (mm): %d\n",
376  (int)(result->intra_presence_score * 1000.0f),
377  (int)(result->inter_presence_score * 1000.0f),
378  (int)(result->presence_distance * 1000.0f));
379 }
380 
382 {
383  switch (preset)
384  {
386  // Add configuration of the detector here
387  break;
388 
390  acc_detector_presence_config_start_set(presence_config, 0.06f);
391  acc_detector_presence_config_end_set(presence_config, 1.0f);
393  acc_detector_presence_config_signal_quality_set(presence_config, 30.0f);
396  acc_detector_presence_config_frame_rate_set(presence_config, 10.0f);
410 
411  break;
412 
414  acc_detector_presence_config_start_set(presence_config, 0.3f);
415  acc_detector_presence_config_end_set(presence_config, 2.5f);
417  acc_detector_presence_config_signal_quality_set(presence_config, 20.0f);
420  acc_detector_presence_config_frame_rate_set(presence_config, 12.0f);
434 
435  break;
436 
438  acc_detector_presence_config_start_set(presence_config, 5.0f);
439  acc_detector_presence_config_end_set(presence_config, 7.5f);
441  acc_detector_presence_config_signal_quality_set(presence_config, 10.0f);
444  acc_detector_presence_config_frame_rate_set(presence_config, 12.0f);
458 
459  break;
460 
462  acc_detector_presence_config_start_set(presence_config, 0.38f);
463  acc_detector_presence_config_end_set(presence_config, 0.67f);
465  acc_detector_presence_config_signal_quality_set(presence_config, 20.0f);
467  acc_detector_presence_config_auto_profile_set(presence_config, false);
470  acc_detector_presence_config_hwaas_set(presence_config, 8);
472  acc_detector_presence_config_frame_rate_set(presence_config, 0.7f);
486 
487  break;
488  }
489 }
acc_detector_presence_config_inter_detection_set
void acc_detector_presence_config_inter_detection_set(acc_detector_presence_config_t *presence_config, bool enable)
Set inter-frame presence detection.
acc_detector_presence_config_sweeps_per_frame_set
void acc_detector_presence_config_sweeps_per_frame_set(acc_detector_presence_config_t *presence_config, uint16_t sweeps_per_frame)
Set the number of sweeps per frame.
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_processing_metadata_t::subsweep_data_offset
uint16_t subsweep_data_offset[(4U)]
Definition: acc_processing.h:43
print_result
static void print_result(acc_detector_presence_result_t *result)
Definition: example_detector_presence_with_iq_data_print.c:363
cargo_result_t::calibration_needed
bool calibration_needed
Definition: example_cargo.h:112
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_detector_presence_destroy
void acc_detector_presence_destroy(acc_detector_presence_handle_t *presence_handle)
Destroy a presence detector identified with the provided handle.
acc_detector_presence_config_hwaas_set
void acc_detector_presence_config_hwaas_set(acc_detector_presence_config_t *presence_config, uint16_t hwaas)
Set the hardware accelerated average samples (HWAAS)
PRESENCE_PRESET_CONFIG_LONG_RANGE
@ PRESENCE_PRESET_CONFIG_LONG_RANGE
Definition: example_detector_presence_with_iq_data_print.c:47
cleanup
static void cleanup(acc_detector_presence_handle_t *presence_handle, acc_detector_presence_config_t *presence_config, acc_sensor_t *sensor, void *buffer)
Definition: example_detector_presence_with_iq_data_print.c:231
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
acc_detector_presence_config_inter_frame_deviation_time_const_set
void acc_detector_presence_config_inter_frame_deviation_time_const_set(acc_detector_presence_config_t *presence_config, float inter_frame_deviation_time_const)
Set the time constant of the low pass filter for the inter-frame deviation between fast and slow.
acc_config_num_subsweeps_get
uint8_t acc_config_num_subsweeps_get(const acc_config_t *config)
Get the number of subsweeps to use.
acc_detector_presence_config_auto_profile_set
void acc_detector_presence_config_auto_profile_set(acc_detector_presence_config_t *presence_config, bool enable)
Enable automatic selection of profile based on start point of measurement.
PRESENCE_PRESET_CONFIG_LOW_POWER_WAKEUP
@ PRESENCE_PRESET_CONFIG_LOW_POWER_WAKEUP
Definition: example_detector_presence_with_iq_data_print.c:48
acc_int16_complex_t
Data type for interger-based representation of complex numbers.
Definition: acc_definitions_common.h:40
acc_cal_result_t
The result from a completed calibration.
Definition: acc_definitions_a121.h:30
acc_detector_presence_config_frame_rate_set
void acc_detector_presence_config_frame_rate_set(acc_detector_presence_config_t *presence_config, float frame_rate)
Set the frame rate.
ACC_CONFIG_IDLE_STATE_DEEP_SLEEP
@ ACC_CONFIG_IDLE_STATE_DEEP_SLEEP
Definition: acc_definitions_a121.h:73
ACC_CONFIG_PROFILE_5
@ ACC_CONFIG_PROFILE_5
Definition: acc_definitions_a121.h:57
SENSOR_ID
#define SENSOR_ID
Definition: example_detector_presence_with_iq_data_print.c:51
acc_integration.h
acc_detector_presence_get_buffer_size
bool acc_detector_presence_get_buffer_size(const acc_detector_presence_handle_t *presence_handle, uint32_t *buffer_size)
Get the buffer size needed for the provided presence detector handle.
cargo_result_t::inter_presence_score
float inter_presence_score
Definition: example_cargo.h:137
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
acc_detector_presence_config_intra_detection_threshold_set
void acc_detector_presence_config_intra_detection_threshold_set(acc_detector_presence_config_t *presence_config, float intra_detection_threshold)
Set the detection threshold for the intra-frame presence detection.
acc_integration_mem_alloc
void * acc_integration_mem_alloc(size_t size)
Allocate dynamic memory.
Definition: acc_integration_stm32.c:592
presence_preset_config_t
presence_preset_config_t
Definition: example_detector_presence_with_iq_data_print.c:42
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
acc_detector_presence_result_t
Presence detector results container.
Definition: acc_detector_presence.h:46
buffer_size
uint32_t buffer_size
Definition: i2c_example_cargo.c:41
acc_detector_presence_metadata_t::sensor_config
const acc_config_t * sensor_config
Definition: acc_detector_presence.h:126
acc_detector_presence_config_inter_frame_presence_timeout_set
void acc_detector_presence_config_inter_frame_presence_timeout_set(acc_detector_presence_config_t *presence_config, uint16_t inter_frame_presence_timeout)
Set the inter-frame presence timeout in seconds.
sensor
acc_sensor_t * sensor
Definition: i2c_example_cargo.c:33
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_presence_config_destroy
void acc_detector_presence_config_destroy(acc_detector_presence_config_t *presence_config)
Destroy a presence detector configuration.
acc_detector_presence_metadata_t
Definition: acc_detector_presence.h:88
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
PRESENCE_PRESET_CONFIG_SHORT_RANGE
@ PRESENCE_PRESET_CONFIG_SHORT_RANGE
Definition: example_detector_presence_with_iq_data_print.c:45
acc_hal_integration_a121.h
acc_detector_presence_config_end_set
void acc_detector_presence_config_end_set(acc_detector_presence_config_t *presence_config, float end)
Set the end point of measurement interval in meters.
acc_detector_presence_config_intra_output_time_const_set
void acc_detector_presence_config_intra_output_time_const_set(acc_detector_presence_config_t *presence_config, float intra_output_time_const)
Set the time constant for the output in the intra-frame part.
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.
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.
SENSOR_TIMEOUT_MS
#define SENSOR_TIMEOUT_MS
Definition: example_detector_presence_with_iq_data_print.c:52
acc_processing_points_to_meter
float acc_processing_points_to_meter(int32_t points)
Convert a distance or step length in points to meter.
acconeer_main
int acconeer_main(int argc, char *argv[])
Assembly test example.
Definition: example_detector_presence_with_iq_data_print.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_detector_presence_config_inter_frame_idle_state_set
void acc_detector_presence_config_inter_frame_idle_state_set(acc_detector_presence_config_t *presence_config, acc_config_idle_state_t idle_state)
Set inter frame idle state.
acc_hal_definitions_a121.h
acc_detector_presence_process
bool acc_detector_presence_process(acc_detector_presence_handle_t *presence_handle, void *buffer, acc_detector_presence_result_t *result)
Process the data according to the configuration used in acc_detector_presence_config_create.
acc_detector_presence_config_inter_output_time_const_set
void acc_detector_presence_config_inter_output_time_const_set(acc_detector_presence_config_t *presence_config, float inter_output_time_const)
Set the time constant for the output in the inter-frame part.
acc_detector_presence_config_reset_filters_on_prepare_set
void acc_detector_presence_config_reset_filters_on_prepare_set(acc_detector_presence_config_t *presence_config, bool enable)
Set if the presence filters should reset on prepare.
PRESENCE_PRESET_CONFIG_MEDIUM_RANGE
@ PRESENCE_PRESET_CONFIG_MEDIUM_RANGE
Definition: example_detector_presence_with_iq_data_print.c:46
acc_detector_presence_prepare
bool acc_detector_presence_prepare(const acc_detector_presence_handle_t *presence_handle, acc_detector_presence_config_t *presence_config, acc_sensor_t *sensor, const acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size)
Prepare the detector to do a measurement.
acc_detector_presence_config_intra_detection_set
void acc_detector_presence_config_intra_detection_set(acc_detector_presence_config_t *presence_config, bool enable)
Set intra-frame presence detection.
cargo_result_t::intra_presence_score
float intra_presence_score
Definition: example_cargo.h:140
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_presence_config_t
struct acc_detector_presence_config acc_detector_presence_config_t
Definition: acc_detector_presence.h:41
presence_preset_config_t
presence_preset_config_t
Definition: example_detector_presence_low_power_hibernate.c:45
acc_integration_log.h
acc_detector_presence_config_inter_frame_slow_cutoff_set
void acc_detector_presence_config_inter_frame_slow_cutoff_set(acc_detector_presence_config_t *presence_config, float inter_frame_slow_cutoff)
Set the cutoff frequency of the low pass filter for the slow filtered absolute sweep mean.
acc_detector_presence_metadata_t::processing_metadata
acc_processing_metadata_t * processing_metadata
Definition: acc_detector_presence.h:131
ACC_LOG_FLOAT_TO_INTEGER
#define ACC_LOG_FLOAT_TO_INTEGER(a)
Definition: acc_integration_log.h:26
print_iq_data
static void print_iq_data(acc_detector_presence_result_t *result, acc_detector_presence_metadata_t *metadata)
Definition: example_detector_presence_with_iq_data_print.c:294
DEFAULT_PRESET_CONFIG
#define DEFAULT_PRESET_CONFIG
Definition: example_detector_presence_with_iq_data_print.c:54
acc_detector_presence_config_log
void acc_detector_presence_config_log(acc_detector_presence_config_t *presence_config)
Print a configuration to the log.
do_sensor_calibration
static bool do_sensor_calibration(acc_sensor_t *sensor, acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size)
Definition: example_detector_presence_with_iq_data_print.c:260
acc_detector_presence_config_profile_set
void acc_detector_presence_config_profile_set(acc_detector_presence_config_t *presence_config, acc_config_profile_t profile)
Set a profile.
PRESENCE_PRESET_CONFIG_NONE
@ PRESENCE_PRESET_CONFIG_NONE
Definition: example_detector_presence_with_iq_data_print.c:44
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_definitions_common.h
acc_detector_presence_create
acc_detector_presence_handle_t * acc_detector_presence_create(acc_detector_presence_config_t *presence_config, acc_detector_presence_metadata_t *metadata)
Create a presence detector with the provided configuration.
acc_detector_presence_handle_t
struct acc_detector_presence_handle acc_detector_presence_handle_t
Definition: acc_detector_presence.h:34
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.
acc_detector_presence_config_create
acc_detector_presence_config_t * acc_detector_presence_config_create(void)
Create a configuration for a presence detector.
PRIfloat
#define PRIfloat
Specifier for printing float type using integers.
Definition: acc_integration_log.h:31
cargo_result_t::presence_detected
bool presence_detected
Definition: example_cargo.h:134
acc_detector_presence_config_signal_quality_set
void acc_detector_presence_config_signal_quality_set(acc_detector_presence_config_t *presence_config, float signal_quality)
Set signal quality.
acc_detector_presence_config_start_set
void acc_detector_presence_config_start_set(acc_detector_presence_config_t *presence_config, float start)
Set the start point of measurement interval in meters.
acc_detector_presence.h
acc_detector_presence_config_inter_detection_threshold_set
void acc_detector_presence_config_inter_detection_threshold_set(acc_detector_presence_config_t *presence_config, float inter_detection_threshold)
Set the detection threshold for the inter-frame presence detection.
acc_sensor_measure
bool acc_sensor_measure(acc_sensor_t *sensor)
Start a radar measurement with previously prepared configuration.
acc_detector_presence_config_auto_step_length_set
void acc_detector_presence_config_auto_step_length_set(acc_detector_presence_config_t *presence_config, bool enable)
Enable automatic selection of step length based on the profile.
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.
set_config
static void set_config(acc_detector_presence_config_t *presence_config, presence_preset_config_t preset)
Definition: example_detector_presence_with_iq_data_print.c:381
acc_sensor_t
struct acc_sensor acc_sensor_t
Definition: acc_sensor.h:31
acc_detector_presence_config_intra_frame_time_const_set
void acc_detector_presence_config_intra_frame_time_const_set(acc_detector_presence_config_t *presence_config, float intra_frame_time_const)
Set the time constant for the depthwise filtering in the intra-frame part.
acc_detector_presence_config_automatic_subsweeps_set
void acc_detector_presence_config_automatic_subsweeps_set(acc_detector_presence_config_t *presence_config, bool automatic_subsweeps)
Set if automatic subsweeps should be used.
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_detector_presence_config_frame_rate_app_driven_set
void acc_detector_presence_config_frame_rate_app_driven_set(acc_detector_presence_config_t *presence_config, bool enable)
Set if the application should maintain the requested frame rate.
acc_detector_presence_config_inter_frame_fast_cutoff_set
void acc_detector_presence_config_inter_frame_fast_cutoff_set(acc_detector_presence_config_t *presence_config, float inter_frame_fast_cutoff)
Set the cutoff frequency of the low pass filter for the fast filtered absolute sweep mean.
acc_sensor_create
acc_sensor_t * acc_sensor_create(acc_sensor_id_t sensor_id)
Create a sensor instance.