Go to the documentation of this file.
43 #define SENSOR_ID (1U)
44 #define SENSOR_TIMEOUT_MS (1000U)
45 #define NBR_CONFIGS (2U)
46 #define NBR_ITERATIONS_PER_CONFIG (20U)
63 uint32_t nbr_configs);
88 .reset_filters_on_prepare =
true,
99 .reset_filters_on_prepare =
true,
115 if (presence_config[cfg] == NULL)
117 printf(
"acc_detector_presence_config_create() failed\n");
127 uint32_t current_buffer_size = 0;
130 if (presence_handle[cfg] == NULL)
132 printf(
"acc_detector_presence_create() failed\n");
139 printf(
"acc_detector_presence_get_buffer_size() failed\n");
153 printf(
"buffer allocation failed\n");
164 printf(
"acc_sensor_create() failed\n");
170 bool cal_complete =
false;
177 if (status && !cal_complete)
181 }
while (status && !cal_complete);
185 printf(
"acc_sensor_calibrate() failed\n");
202 printf(
"acc_detector_presence_prepare() failed\n");
211 printf(
"acc_sensor_measure failed\n");
218 printf(
"Sensor interrupt timeout\n");
225 printf(
"acc_sensor_read failed\n");
232 printf(
"acc_detector_presence_process failed\n");
249 printf(
"Application finished OK\n");
258 uint32_t nbr_configs)
263 for (uint32_t cfg = 0U; cfg < nbr_configs; cfg++)
265 if (presence_config[cfg] != NULL)
268 presence_config[cfg] = NULL;
271 if (presence_handle[cfg] != NULL)
274 presence_handle[cfg] = NULL;
301 printf(
"%s - Intra presence score: %d, Inter presence score: %d, Distance (mm): %d\n",
305 (
int)(
result->presence_distance * 1000.0f));
307 printf(
"%s - Depthwise Intra Presence Scores: \t", config_name);
308 for (uint16_t i = 0; i <
result->depthwise_presence_scores_length; i++)
311 printf(
"%5i", (
int)(
result->depthwise_intra_presence_scores[i] * 1000));
315 printf(
"%s - Depthwise Inter Presence Scores: \t", config_name);
316 for (uint16_t i = 0; i <
result->depthwise_presence_scores_length; i++)
319 printf(
"%5i", (
int)(
result->depthwise_inter_presence_scores[i] * 1000));
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.
void acc_detector_presence_destroy(acc_detector_presence_handle_t *presence_handle)
Destroy a presence detector identified with the provided handle.
bool acc_sensor_read(const acc_sensor_t *sensor, void *buffer, uint32_t buffer_size)
Read out radar data.
#define NBR_ITERATIONS_PER_CONFIG
The result from a completed calibration.
bool reset_filters_on_prepare
void acc_detector_presence_config_frame_rate_set(acc_detector_presence_config_t *presence_config, float frame_rate)
Set the frame rate.
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.
float inter_presence_score
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.
Presence detector results container.
int acconeer_main(int argc, char *argv[])
Assembly test example.
void acc_detector_presence_config_destroy(acc_detector_presence_config_t *presence_config)
Destroy a presence detector configuration.
bool acc_hal_integration_wait_for_sensor_interrupt(acc_sensor_id_t sensor_id, uint32_t timeout_ms)
Wait for a sensor interrupt.
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.
const char * acc_version_get(void)
Get the version of the Acconeer software.
void acc_hal_integration_sensor_enable(acc_sensor_id_t sensor_id)
Enable sensor.
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.
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.
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.
float intra_presence_score
void acc_hal_integration_sensor_disable(acc_sensor_id_t sensor_id)
Disable sensor.
struct acc_detector_presence_config acc_detector_presence_config_t
struct example_config example_config_t
static void cleanup(acc_detector_presence_handle_t **presence_handle, acc_detector_presence_config_t **presence_config, acc_sensor_t *sensor, void *buffer, uint32_t nbr_configs)
#define SENSOR_TIMEOUT_MS
void acc_integration_mem_free(void *ptr)
Free dynamic memory.
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.
struct acc_detector_presence_handle acc_detector_presence_handle_t
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_t * acc_detector_presence_config_create(void)
Create a configuration for a presence detector.
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.
bool acc_sensor_measure(acc_sensor_t *sensor)
Start a radar measurement with previously prepared configuration.
static void print_result(acc_detector_presence_result_t *result, const char *config_name)
struct acc_sensor acc_sensor_t
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.