Go to the documentation of this file.
22 #define SENSOR_ID (1U)
23 #define SENSOR_TIMEOUT_MS (1000U)
79 if (hand_motion_detection_config == NULL)
81 printf(
"hand_motion_detection_config_create() failed\n");
91 printf(
"hand_motion_detection_handle_create() failed\n");
100 printf(
"acc_rss_get_buffer_size() failed\n");
108 printf(
"buffer allocation failed\n");
119 printf(
"acc_sensor_create() failed\n");
126 printf(
"do_sensor_calibration() failed\n");
136 printf(
"hand_motion_detection_prepare() failed\n");
143 printf(
"acc_sensor_measure failed\n");
151 printf(
"Sensor interrupt timeout\n");
159 printf(
"acc_sensor_read failed\n");
167 printf(
"enter_hibernate failed\n");
177 &hand_motion_detection_result,
184 printf(
"handle_indications() failed\n");
198 printf(
"exit_hibernate failed\n");
205 printf(
"Application finished OK\n");
239 bool cal_complete =
false;
240 const uint16_t calibration_retries = 1U;
243 for (uint16_t i = 0; !status && (i <= calibration_retries); i++)
253 if (status && !cal_complete)
257 }
while (status && !cal_complete);
280 *data_reliable =
true;
282 if (
result->proc_result.data_saturated)
284 *data_reliable =
false;
286 printf(
"Data saturated. Try to reduce the sensor gain.\n");
289 if (
result->proc_result.frame_delayed)
291 printf(
"Frame delayed. Could not read data fast enough.\n");
292 printf(
"Try lowering the frame rate or call 'acc_sensor_read' more frequently.\n");
297 printf(
"The current calibration is not valid for the current temperature.\n");
298 printf(
"Re-calibrating sensor...\n");
302 printf(
"exit_hibernate failed\n");
310 printf(
"do_sensor_calibration() failed\n");
316 printf(
"Sensor recalibration done!\n");
324 printf(
"hand_motion_detection_prepare() failed\n");
333 printf(
"enter_hibernate failed\n");
338 *data_reliable =
false;
340 printf(
"The sensor was successfully re-calibrated.\n");
350 if (
result->algo_result_available)
352 printf(
"Detection state: ");
354 switch (
result->algo_result.detection_state)
375 printf(
"acc_sensor_hibernate_on failed\n");
391 printf(
"acc_sensor_hibernate_off failed\n");
static void cleanup(acc_sensor_t *sensor, void *buffer, hand_motion_detection_config_t *config, hand_motion_detection_handle_t *handle)
Frees any allocated resources.
void acc_hal_integration_sensor_supply_off(acc_sensor_id_t sensor_id)
Power off sensor supply.
void acc_hal_integration_sensor_supply_on(acc_sensor_id_t sensor_id)
Power on sensor supply.
bool hand_motion_detection_prepare(hand_motion_detection_handle_t *handle, acc_sensor_t *sensor, const acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size, bool force_prepare)
Prepare hand motion.
static bool enter_hibernate(acc_sensor_t *sensor)
bool acc_sensor_read(const acc_sensor_t *sensor, void *buffer, uint32_t buffer_size)
Read out radar data.
hand_motion_detection_config_t * hand_motion_detection_config_create(void)
Create a hand motion configuration.
The result from a completed calibration.
void hand_motion_detection_config_destroy(hand_motion_detection_config_t *config)
Destroy a hand motion configuration.
@ HAND_MOTION_DETECTION_STATE_RETENTION
hand_motion_detection_handle_t * hand_motion_detection_handle_create(const hand_motion_detection_config_t *hand_motion_detection_config, acc_sensor_id_t sensor_id)
Create a hand_motion handle.
static void print_hand_motion_detection_result(const hand_motion_detection_result_t *result)
Print a processor result in a human-readable format.
const acc_hal_a121_t * acc_hal_rss_integration_get_implementation(void)
Get hal implementation reference.
void * acc_integration_mem_alloc(size_t size)
Allocate dynamic memory.
bool acc_hal_integration_wait_for_sensor_interrupt(acc_sensor_id_t sensor_id, uint32_t timeout_ms)
Wait for a sensor interrupt.
int acconeer_main(int argc, char *argv[])
Assembly test example.
@ HAND_MOTION_DETECTION_APP_MODE_PRESENCE
bool acc_sensor_hibernate_off(const acc_sensor_t *sensor)
Restore sensor after exiting hibernation.
void hand_motion_detection_process(hand_motion_detection_handle_t *handle, void *buffer, hand_motion_detection_result_t *hand_motion_detection_result)
Process Sparse IQ data.
const char * acc_version_get(void)
Get the version of the Acconeer software.
@ HAND_MOTION_DETECTION_PRESET_FAUCET
void acc_hal_integration_sensor_enable(acc_sensor_id_t sensor_id)
Enable sensor.
void acc_hal_integration_sensor_disable(acc_sensor_id_t sensor_id)
Disable sensor.
@ HAND_MOTION_DETECTION_STATE_DETECTION
static bool do_sensor_calibration(acc_sensor_t *sensor, acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size)
Performs sensor calibration (with retry)
bool hand_motion_detection_get_buffer_size(hand_motion_detection_handle_t *handle, uint32_t *buffer_size)
Get buffer size needed.
bool acc_sensor_hibernate_on(acc_sensor_t *sensor)
Prepare sensor for entering hibernation.
static bool exit_hibernate(acc_sensor_t *sensor)
static bool handle_indications(hand_motion_detection_handle_t *handle, hand_motion_detection_result_t *result, acc_sensor_t *sensor, acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size, bool *data_reliable)
Handle sensor indications.
void acc_sensor_status(const acc_sensor_t *sensor)
Check the status of the sensor.
@ HAND_MOTION_DETECTION_STATE_NO_DETECTION
void hand_motion_detection_handle_destroy(hand_motion_detection_handle_t *handle)
Destroy a hand_motion handle.
void acc_integration_mem_free(void *ptr)
Free dynamic memory.
void acc_integration_sleep_until_periodic_wakeup(void)
Put the system in sleep until the periodic timer triggers.
void hand_motion_detection_set_config(hand_motion_detection_preset_t preset, hand_motion_detection_config_t *config)
Set config specified by the preset.
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.
bool acc_sensor_measure(acc_sensor_t *sensor)
Start a radar measurement with previously prepared configuration.
struct acc_sensor acc_sensor_t
void hand_motion_detection_config_log(hand_motion_detection_handle_t *handle)
Print configuration.
#define SENSOR_TIMEOUT_MS
void acc_sensor_destroy(acc_sensor_t *sensor)
Destroy a sensor instance freeing any resources allocated.
acc_sensor_t * acc_sensor_create(acc_sensor_id_t sensor_id)
Create a sensor instance.
Configuration for hand_motion.