example_detector_distance_low_power_hibernate.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 <stdbool.h>
8 #include <stdint.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11
12 #include "acc_definitions_a121.h"
13 #include "acc_definitions_common.h"
14 #include "acc_detector_distance.h"
15 #include "acc_hal_definitions_a121.h"
16 #include "acc_hal_integration_a121.h"
17 #include "acc_integration.h"
18 #include "acc_integration_log.h"
19 #include "acc_rss_a121.h"
20 #include "acc_sensor.h"
21
22 #include "acc_version.h"
23
24 /** \example example_detector_distance_low_power_hibernate.c
25 * @brief This is an example on how to put the sensor in hibernation and the system in a low power state between measurements
26 * @n
27 * The example executes as follows:
28 * - Create a distance configuration
29 * - Create a sensor instance
30 * - Enable sensor
31 * - Create a detector instance
32 * - Calibrate the sensor
33 * - Calibrate the detector
34 * - Enter hibernation
35 * - Loop forever:
36 * - Exit hibernation
37 * - Prepare the detector
38 * - Perform a sensor measurement and read out the data
39 * - Enter hibernation
40 * - Process the measurement and get detector result
41 * - Put the system in deep sleep for a specified amount of time
42 * - Destroy the configuration
43 * - Destroy the detector instance
44 * - Destroy the sensor instance
45 */
46
47 typedef enum
48 {
49 DISTANCE_PRESET_CONFIG_NONE = 0,
50 DISTANCE_PRESET_CONFIG_BALANCED,
51 DISTANCE_PRESET_CONFIG_HIGH_ACCURACY,
52 } distance_preset_config_t;
53
54 #define SENSOR_ID (1U)
55 #define SENSOR_TIMEOUT_MS (1000U)
56 #define DEFAULT_UPDATE_RATE (1.0f)
57
58 static void print_result(acc_detector_distance_result_t *result);
59
60 static void cleanup(acc_detector_distance_handle_t *distance_handle,
61 acc_detector_distance_config_t *distance_config,
62 acc_sensor_t *sensor,
63 void *buffer,
64 uint8_t *detector_cal_result_static);
65
66 static void set_config(acc_detector_distance_config_t *detector_config, distance_preset_config_t preset);
67
68 int acconeer_main(int argc, char *argv[]);
69
70 int acconeer_main(int argc, char *argv[])
71 {
72 (void)argc;
73 (void)argv;
74 acc_detector_distance_config_t *distance_config = NULL;
75 acc_detector_distance_handle_t *distance_handle = NULL;
76 acc_sensor_t *sensor = NULL;
77 void *buffer = NULL;
78 uint8_t *detector_cal_result_static = NULL;
79 uint32_t buffer_size = 0U;
80 uint32_t detector_cal_result_static_size = 0U;
81 acc_detector_cal_result_dynamic_t detector_cal_result_dynamic = {0};
82
83 printf("Acconeer software version %s\n", acc_version_get());
84
85 const acc_hal_a121_t *hal = acc_hal_rss_integration_get_implementation();
86
87 if (!acc_rss_hal_register(hal))
88 {
89 return EXIT_FAILURE;
90 }
91
92 distance_config = acc_detector_distance_config_create();
93 if (distance_config == NULL)
94 {
95 printf("acc_detector_distance_config_create() failed\n");
96 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
97 return EXIT_FAILURE;
98 }
99
100 set_config(distance_config, DISTANCE_PRESET_CONFIG_BALANCED);
101
102 uint32_t sleep_time_ms = (uint32_t)(1000.0f / DEFAULT_UPDATE_RATE);
103
104 acc_integration_set_periodic_wakeup(sleep_time_ms);
105
106 distance_handle = acc_detector_distance_create(distance_config);
107 if (distance_handle == NULL)
108 {
109 printf("acc_detector_distance_create() failed\n");
110 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
111 return EXIT_FAILURE;
112 }
113
114 if (!acc_detector_distance_get_sizes(distance_handle, &buffer_size, &detector_cal_result_static_size))
115 {
116 printf("acc_detector_distance_get_buffer_size() failed\n");
117 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
118 return EXIT_FAILURE;
119 }
120
121 buffer = acc_integration_mem_alloc(buffer_size);
122 if (buffer == NULL)
123 {
124 printf("buffer allocation failed\n");
125 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
126 return EXIT_FAILURE;
127 }
128
129 detector_cal_result_static = acc_integration_mem_alloc(detector_cal_result_static_size);
130 if (detector_cal_result_static == NULL)
131 {
132 printf("buffer allocation failed\n");
133 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
134 return EXIT_FAILURE;
135 }
136
137 acc_hal_integration_sensor_supply_on(SENSOR_ID);
138 acc_hal_integration_sensor_enable(SENSOR_ID);
139
140 sensor = acc_sensor_create(SENSOR_ID);
141 if (sensor == NULL)
142 {
143 printf("acc_sensor_create() failed\n");
144 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
145 return EXIT_FAILURE;
146 }
147
148 // Calibrate sensor
149 bool status;
150 bool cal_complete = false;
151 acc_cal_result_t sensor_cal_result;
152
153 do
154 {
155 status = acc_sensor_calibrate(sensor, &cal_complete, &sensor_cal_result, buffer, buffer_size);
156
157 if (cal_complete)
158 {
159 break;
160 }
161
162 if (status)
163 {
164 status = acc_hal_integration_wait_for_sensor_interrupt(SENSOR_ID, SENSOR_TIMEOUT_MS);
165 }
166 } while (status);
167
168 if (!status)
169 {
170 printf("acc_sensor_calibrate() failed\n");
171 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
172 return EXIT_FAILURE;
173 }
174
175 /* Reset sensor after calibration by disabling/enabling it */
176 acc_hal_integration_sensor_disable(SENSOR_ID);
177 acc_hal_integration_sensor_enable(SENSOR_ID);
178
179 // Calibrate detector
180 bool done = false;
181
182 do
183 {
184 status = acc_detector_distance_calibrate(sensor,
185 distance_handle,
186 &sensor_cal_result,
187 buffer,
188 buffer_size,
189 detector_cal_result_static,
190 detector_cal_result_static_size,
191 &detector_cal_result_dynamic,
192 &done);
193
194 if (done)
195 {
196 break;
197 }
198
199 if (status)
200 {
201 status = acc_hal_integration_wait_for_sensor_interrupt(SENSOR_ID, SENSOR_TIMEOUT_MS);
202 }
203 } while (status);
204
205 if (!status)
206 {
207 printf("acc_detector_distance_calibrate() failed\n");
208 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
209 return EXIT_FAILURE;
210 }
211
212 acc_hal_integration_sensor_disable(SENSOR_ID);
213
214 acc_hal_integration_sensor_enable(SENSOR_ID);
215
216 if (!acc_detector_distance_prepare(distance_handle, distance_config, sensor, &sensor_cal_result, buffer, buffer_size))
217 {
218 printf("acc_detector_presence_prepare() failed\n");
219 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
220 return EXIT_FAILURE;
221 }
222
223 if (!acc_sensor_hibernate_on(sensor))
224 {
225 printf("acc_sensor_hibernate_on failed\n");
226 acc_sensor_status(sensor);
227 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
228 return EXIT_FAILURE;
229 }
230
231 acc_hal_integration_sensor_disable(SENSOR_ID);
232
233 while (true)
234 {
235 acc_detector_distance_result_t result;
236
237 acc_hal_integration_sensor_enable(SENSOR_ID);
238
239 if (!acc_sensor_hibernate_off(sensor))
240 {
241 printf("acc_sensor_hibernate_off failed\n");
242 acc_sensor_status(sensor);
243 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
244 return EXIT_FAILURE;
245 }
246
247 bool result_available = false;
248
249 do
250 {
251 if (!acc_detector_distance_prepare(distance_handle, distance_config, sensor, &sensor_cal_result, buffer, buffer_size))
252 {
253 printf("acc_detector_distance_prepare() failed\n");
254 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
255 return EXIT_FAILURE;
256 }
257
258 if (!acc_sensor_measure(sensor))
259 {
260 printf("acc_sensor_measure failed\n");
261 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
262 return EXIT_FAILURE;
263 }
264
265 if (!acc_hal_integration_wait_for_sensor_interrupt(SENSOR_ID, SENSOR_TIMEOUT_MS))
266 {
267 printf("Sensor interrupt timeout\n");
268 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
269 return EXIT_FAILURE;
270 }
271
272 if (!acc_sensor_read(sensor, buffer, buffer_size))
273 {
274 printf("acc_sensor_read failed\n");
275 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
276 return EXIT_FAILURE;
277 }
278
279 if (!acc_detector_distance_process(distance_handle,
280 buffer,
281 detector_cal_result_static,
282 &detector_cal_result_dynamic,
283 &result_available,
284 &result))
285 {
286 printf("acc_detector_distance_process failed\n");
287 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
288 return EXIT_FAILURE;
289 }
290 } while (!result_available);
291
292 if (!acc_sensor_hibernate_on(sensor))
293 {
294 printf("acc_sensor_hibernate_on failed\n");
295 acc_sensor_status(sensor);
296 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
297 return EXIT_FAILURE;
298 }
299
300 acc_hal_integration_sensor_disable(SENSOR_ID);
301
302 print_result(&result);
303
304 acc_integration_sleep_until_periodic_wakeup();
305 }
306
307 cleanup(distance_handle, distance_config, sensor, buffer, detector_cal_result_static);
308
309 printf("Application finished OK\n");
310
311 return EXIT_SUCCESS;
312 }
313
314 static void cleanup(acc_detector_distance_handle_t *distance_handle,
315 acc_detector_distance_config_t *distance_config,
316 acc_sensor_t *sensor,
317 void *buffer,
318 uint8_t *detector_cal_result_static)
319 {
320 acc_hal_integration_sensor_disable(SENSOR_ID);
321 acc_hal_integration_sensor_supply_off(SENSOR_ID);
322
323 if (distance_config != NULL)
324 {
325 acc_detector_distance_config_destroy(distance_config);
326 }
327
328 if (distance_handle != NULL)
329 {
330 acc_detector_distance_destroy(distance_handle);
331 }
332
333 if (sensor != NULL)
334 {
335 acc_sensor_destroy(sensor);
336 }
337
338 if (buffer != NULL)
339 {
340 acc_integration_mem_free(buffer);
341 }
342
343 if (detector_cal_result_static != NULL)
344 {
345 acc_integration_mem_free(detector_cal_result_static);
346 }
347 }
348
349 static void set_config(acc_detector_distance_config_t *detector_config, distance_preset_config_t preset)
350 {
351 // Add configuration of the detector here
352 switch (preset)
353 {
354 case DISTANCE_PRESET_CONFIG_NONE:
355 // Add configuration of the detector here
356 break;
357
358 case DISTANCE_PRESET_CONFIG_BALANCED:
359 acc_detector_distance_config_start_set(detector_config, 0.25f);
360 acc_detector_distance_config_end_set(detector_config, 3.0f);
361 acc_detector_distance_config_max_step_length_set(detector_config, 0U);
362 acc_detector_distance_config_max_profile_set(detector_config, ACC_CONFIG_PROFILE_5);
363 acc_detector_distance_config_reflector_shape_set(detector_config, ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_GENERIC);
364 acc_detector_distance_config_peak_sorting_set(detector_config, ACC_DETECTOR_DISTANCE_PEAK_SORTING_STRONGEST);
365 acc_detector_distance_config_threshold_method_set(detector_config, ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR);
366 acc_detector_distance_config_threshold_sensitivity_set(detector_config, 0.5f);
367 acc_detector_distance_config_signal_quality_set(detector_config, 15.0f);
368 acc_detector_distance_config_close_range_leakage_cancellation_set(detector_config, false);
369 break;
370
371 case DISTANCE_PRESET_CONFIG_HIGH_ACCURACY:
372 acc_detector_distance_config_start_set(detector_config, 0.25f);
373 acc_detector_distance_config_end_set(detector_config, 3.0f);
374 acc_detector_distance_config_max_step_length_set(detector_config, 2U);
375 acc_detector_distance_config_max_profile_set(detector_config, ACC_CONFIG_PROFILE_3);
376 acc_detector_distance_config_reflector_shape_set(detector_config, ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_GENERIC);
377 acc_detector_distance_config_peak_sorting_set(detector_config, ACC_DETECTOR_DISTANCE_PEAK_SORTING_STRONGEST);
378 acc_detector_distance_config_threshold_method_set(detector_config, ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR);
379 acc_detector_distance_config_threshold_sensitivity_set(detector_config, 0.5f);
380 acc_detector_distance_config_signal_quality_set(detector_config, 20.0f);
381 acc_detector_distance_config_close_range_leakage_cancellation_set(detector_config, false);
382 break;
383 }
384 }
385
386 static void print_result(acc_detector_distance_result_t *result)
387 {
388 printf("%d detected distances", result->num_distances);
389 if (result->num_distances > 0)
390 {
391 printf(": ");
392
393 for (uint8_t i = 0; i < result->num_distances; i++)
394 {
395 printf("%" PRIfloat "m ", ACC_LOG_FLOAT_TO_INTEGER(result->distances[i]));
396 }
397 }
398
399 printf("\n");
400 }
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.
set_config
static void set_config(acc_detector_distance_config_t *detector_config, distance_preset_config_t preset)
Definition: example_detector_distance_low_power_hibernate.c:349
acc_detector_distance_config_peak_sorting_set
void acc_detector_distance_config_peak_sorting_set(acc_detector_distance_config_t *config, acc_detector_distance_peak_sorting_t peak_sorting)
Set peak sorting method.
acc_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
DISTANCE_PRESET_CONFIG_NONE
@ DISTANCE_PRESET_CONFIG_NONE
Definition: example_detector_distance_low_power_hibernate.c:49
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
acconeer_main
int acconeer_main(int argc, char *argv[])
Assembly test example.
Definition: example_detector_distance_low_power_hibernate.c:70
ACC_DETECTOR_DISTANCE_PEAK_SORTING_STRONGEST
@ ACC_DETECTOR_DISTANCE_PEAK_SORTING_STRONGEST
Definition: acc_detector_distance_definitions.h:36
acc_detector_distance_config_threshold_method_set
void acc_detector_distance_config_threshold_method_set(acc_detector_distance_config_t *config, acc_detector_distance_threshold_method_t threshold_method)
Set threshold method.
distance_preset_config_t
distance_preset_config_t
Definition: example_detector_distance_low_power_hibernate.c:47
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)
SENSOR_TIMEOUT_MS
#define SENSOR_TIMEOUT_MS
Definition: example_detector_distance_low_power_hibernate.c:55
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.
acc_detector_distance_config_destroy
void acc_detector_distance_config_destroy(acc_detector_distance_config_t *config)
Destroy Distance Detector configuration.
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_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.
cleanup
static void cleanup(acc_detector_distance_handle_t *distance_handle, acc_detector_distance_config_t *distance_config, acc_sensor_t *sensor, void *buffer, uint8_t *detector_cal_result_static)
Definition: example_detector_distance_low_power_hibernate.c:314
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
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
SENSOR_ID
#define SENSOR_ID
Definition: example_detector_distance_low_power_hibernate.c:54
DISTANCE_PRESET_CONFIG_BALANCED
@ DISTANCE_PRESET_CONFIG_BALANCED
Definition: example_detector_distance_low_power_hibernate.c:50
acc_rss_hal_register
bool acc_rss_hal_register(const acc_hal_a121_t *hal)
Register an integration.
acc_integration_set_periodic_wakeup
void acc_integration_set_periodic_wakeup(uint32_t time_msec)
Set up a periodic timer used to wake up the system from sleep.
Definition: acc_integration_stm32.c:496
acc_sensor.h
buffer_size
uint32_t buffer_size
Definition: i2c_example_cargo.c:41
acc_detector_cal_result_dynamic_t
The result from a completed calibration update.
Definition: acc_detector_distance_definitions.h:23
acc_detector_distance_config_close_range_leakage_cancellation_set
void acc_detector_distance_config_close_range_leakage_cancellation_set(acc_detector_distance_config_t *config, bool enable)
Enable close range leakage cancellation.
sensor
acc_sensor_t * sensor
Definition: i2c_example_cargo.c:33
acc_detector_distance_config_max_profile_set
void acc_detector_distance_config_max_profile_set(acc_detector_distance_config_t *config, acc_config_profile_t max_profile)
Set maximum Profile.
acc_detector_distance_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
print_result
static void print_result(acc_detector_distance_result_t *result)
Definition: example_detector_distance_low_power_hibernate.c:386
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)
acc_sensor_hibernate_off
bool acc_sensor_hibernate_off(const acc_sensor_t *sensor)
Restore sensor after exiting hibernation.
result
cargo_result_t result
Definition: i2c_example_cargo.c:43
acc_version_get
const char * acc_version_get(void)
Get the version of the Acconeer software.
printf
#define printf
Definition: printf.h:60
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
acc_detector_distance_prepare
bool acc_detector_distance_prepare(const acc_detector_distance_handle_t *handle, const acc_detector_distance_config_t *config, acc_sensor_t *sensor, const acc_cal_result_t *sensor_cal_result, void *buffer, uint32_t buffer_size)
Prepare the Detector for measurements.
acc_detector_distance_result_t
Distance Detector result returned from acc_detector_distance_process.
Definition: acc_detector_distance.h:48
ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR
@ ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR
Definition: acc_detector_distance_definitions.h:51
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_sensor_hibernate_on
bool acc_sensor_hibernate_on(acc_sensor_t *sensor)
Prepare sensor for entering hibernation.
ACC_LOG_FLOAT_TO_INTEGER
#define ACC_LOG_FLOAT_TO_INTEGER(a)
Definition: acc_integration_log.h:26
acc_sensor_status
void acc_sensor_status(const acc_sensor_t *sensor)
Check the status of the sensor.
DISTANCE_PRESET_CONFIG_HIGH_ACCURACY
@ DISTANCE_PRESET_CONFIG_HIGH_ACCURACY
Definition: example_detector_distance_low_power_hibernate.c:51
acc_integration_mem_free
void acc_integration_mem_free(void *ptr)
Free dynamic memory.
Definition: acc_integration_stm32.c:602
acc_detector_distance_config_reflector_shape_set
void acc_detector_distance_config_reflector_shape_set(acc_detector_distance_config_t *config, acc_detector_distance_reflector_shape_t reflector_shape)
Set reflector shape.
acc_integration_sleep_until_periodic_wakeup
void acc_integration_sleep_until_periodic_wakeup(void)
Put the system in sleep until the periodic timer triggers.
Definition: acc_integration_stm32.c:552
acc_definitions_common.h
DEFAULT_UPDATE_RATE
#define DEFAULT_UPDATE_RATE
Definition: example_detector_distance_low_power_hibernate.c:56
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
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.
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_definitions_a121.h
acc_sensor_create
acc_sensor_t * acc_sensor_create(acc_sensor_id_t sensor_id)
Create a sensor instance.