Go to the documentation of this file.
54 #define SENSOR_ID (1U)
55 #define SENSOR_TIMEOUT_MS (1000U)
56 #define DEFAULT_UPDATE_RATE (1.0f)
93 if (distance_config == NULL)
95 printf(
"acc_detector_distance_config_create() failed\n");
107 if (distance_handle == NULL)
109 printf(
"acc_detector_distance_create() failed\n");
116 printf(
"acc_detector_distance_get_buffer_size() failed\n");
124 printf(
"buffer allocation failed\n");
132 printf(
"buffer allocation failed\n");
143 printf(
"acc_sensor_create() failed\n");
150 bool cal_complete =
false;
170 printf(
"acc_sensor_calibrate() failed\n");
191 &detector_cal_result_dynamic,
207 printf(
"acc_detector_distance_calibrate() failed\n");
218 printf(
"acc_detector_presence_prepare() failed\n");
225 printf(
"acc_sensor_hibernate_on failed\n");
241 printf(
"acc_sensor_hibernate_off failed\n");
247 bool result_available =
false;
253 printf(
"acc_detector_distance_prepare() failed\n");
260 printf(
"acc_sensor_measure failed\n");
267 printf(
"Sensor interrupt timeout\n");
274 printf(
"acc_sensor_read failed\n");
282 &detector_cal_result_dynamic,
286 printf(
"acc_detector_distance_process failed\n");
290 }
while (!result_available);
294 printf(
"acc_sensor_hibernate_on failed\n");
309 printf(
"Application finished OK\n");
323 if (distance_config != NULL)
328 if (distance_handle != NULL)
389 if (
result->num_distances > 0)
393 for (uint8_t i = 0; i <
result->num_distances; i++)
void acc_hal_integration_sensor_supply_off(acc_sensor_id_t sensor_id)
Power off sensor supply.
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.
static void set_config(acc_detector_distance_config_t *detector_config, distance_preset_config_t preset)
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.
void acc_hal_integration_sensor_supply_on(acc_sensor_id_t sensor_id)
Power on sensor supply.
@ DISTANCE_PRESET_CONFIG_NONE
bool acc_sensor_read(const acc_sensor_t *sensor, void *buffer, uint32_t buffer_size)
Read out radar data.
acc_cal_result_t sensor_cal_result
int acconeer_main(int argc, char *argv[])
Assembly test example.
@ ACC_DETECTOR_DISTANCE_PEAK_SORTING_STRONGEST
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.
The result from a completed calibration.
void acc_detector_distance_config_start_set(acc_detector_distance_config_t *config, float start_m)
Set start of measured interval (m)
#define SENSOR_TIMEOUT_MS
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.
void acc_detector_distance_config_destroy(acc_detector_distance_config_t *config)
Destroy Distance Detector configuration.
const acc_hal_a121_t * acc_hal_rss_integration_get_implementation(void)
Get hal implementation reference.
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.
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)
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.
void * acc_integration_mem_alloc(size_t size)
Allocate dynamic memory.
static uint8_t * detector_cal_result_static
@ DISTANCE_PRESET_CONFIG_BALANCED
void acc_integration_set_periodic_wakeup(uint32_t time_msec)
Set up a periodic timer used to wake up the system from sleep.
The result from a completed calibration update.
void acc_detector_distance_config_close_range_leakage_cancellation_set(acc_detector_distance_config_t *config, bool enable)
Enable close range leakage cancellation.
void acc_detector_distance_config_max_profile_set(acc_detector_distance_config_t *config, acc_config_profile_t max_profile)
Set maximum Profile.
void acc_detector_distance_destroy(acc_detector_distance_handle_t *handle)
Destroy Distance Detector handle, freeing its resources.
bool acc_hal_integration_wait_for_sensor_interrupt(acc_sensor_id_t sensor_id, uint32_t timeout_ms)
Wait for a sensor interrupt.
static void print_result(acc_detector_distance_result_t *result)
void acc_detector_distance_config_signal_quality_set(acc_detector_distance_config_t *config, float signal_quality)
Set signal quality (dB)
bool acc_sensor_hibernate_off(const acc_sensor_t *sensor)
Restore sensor after exiting hibernation.
const char * acc_version_get(void)
Get the version of the Acconeer software.
static uint32_t detector_cal_result_static_size
void acc_hal_integration_sensor_enable(acc_sensor_id_t sensor_id)
Enable sensor.
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.
Distance Detector result returned from acc_detector_distance_process.
@ ACC_DETECTOR_DISTANCE_THRESHOLD_METHOD_CFAR
void acc_hal_integration_sensor_disable(acc_sensor_id_t sensor_id)
Disable sensor.
void acc_detector_distance_config_end_set(acc_detector_distance_config_t *config, float end_m)
Set end of measured interval (m)
struct acc_detector_distance_handle acc_detector_distance_handle_t
Distance Detector handle.
bool acc_sensor_hibernate_on(acc_sensor_t *sensor)
Prepare sensor for entering hibernation.
#define ACC_LOG_FLOAT_TO_INTEGER(a)
void acc_sensor_status(const acc_sensor_t *sensor)
Check the status of the sensor.
@ DISTANCE_PRESET_CONFIG_HIGH_ACCURACY
void acc_integration_mem_free(void *ptr)
Free dynamic memory.
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.
void acc_integration_sleep_until_periodic_wakeup(void)
Put the system in sleep until the periodic timer triggers.
#define DEFAULT_UPDATE_RATE
void acc_detector_distance_config_threshold_sensitivity_set(acc_detector_distance_config_t *config, float threshold_sensitivity)
Set threshold sensitivity.
acc_detector_distance_config_t * acc_detector_distance_config_create(void)
Create a Distance Detector configuration.
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.
#define PRIfloat
Specifier for printing float type using integers.
struct acc_detector_distance_config acc_detector_distance_config_t
Distance Detector configuration.
@ ACC_DETECTOR_DISTANCE_REFLECTOR_SHAPE_GENERIC
void acc_detector_distance_config_max_step_length_set(acc_detector_distance_config_t *config, uint16_t max_step_length)
Set maximum step length.
bool acc_sensor_measure(acc_sensor_t *sensor)
Start a radar measurement with previously prepared configuration.
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.