Go to the documentation of this file.
49 #define SENSOR_ID (1U)
50 #define SENSOR_TIMEOUT_MS (1000U)
51 #define DEFAULT_UPDATE_RATE (1.0f)
61 void *calibration_buffer);
78 void *calibration_buffer = NULL;
79 uint32_t buffer_size = 0U;
80 uint32_t calibration_buffer_size = 0U;
92 if (distance_config == NULL)
94 printf(
"acc_detector_distance_config_create() failed\n");
95 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
106 if (distance_handle == NULL)
108 printf(
"acc_detector_distance_create() failed\n");
109 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
115 printf(
"acc_detector_distance_get_buffer_size() failed\n");
116 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
123 printf(
"buffer allocation failed\n");
124 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
129 if (calibration_buffer == NULL)
131 printf(
"buffer allocation failed\n");
132 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
142 printf(
"acc_sensor_create() failed\n");
143 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
149 bool cal_complete =
false;
156 if (status && !cal_complete)
160 }
while (status && !cal_complete);
164 printf(
"acc_sensor_calibrate() failed\n");
165 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
184 calibration_buffer_size,
190 printf(
"acc_detector_distance_calibrate() failed\n");
191 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
203 bool result_available =
false;
210 printf(
"acc_detector_distance_prepare() failed\n");
211 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
217 printf(
"acc_sensor_measure failed\n");
218 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
224 printf(
"Sensor interrupt timeout\n");
225 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
231 printf(
"acc_sensor_read failed\n");
232 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
238 printf(
"acc_detector_distance_process failed\n");
239 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
242 }
while (!result_available);
251 cleanup(distance_handle, distance_config, sensor, buffer, calibration_buffer);
253 printf(
"Application finished OK\n");
263 void *calibration_buffer)
268 if (distance_config != NULL)
273 if (distance_handle != NULL)
288 if (calibration_buffer != NULL)
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 acc_sensor_read(const acc_sensor_t *sensor, void *buffer, uint32_t buffer_size)
Read out radar data.
#define SENSOR_TIMEOUT_MS
void acc_detector_distance_config_start_set(acc_detector_distance_config_t *config, float start_m)
Set the start of measured interval in meters.
static void set_config(acc_detector_distance_config_t *distance_config)
bool acc_detector_distance_get_buffer_sizes(const acc_detector_distance_handle_t *handle, uint32_t *buffer_size, uint32_t *calibration_buffer_size)
Get the buffer sizes needed given the provided detector handle.
acc_detector_distance_handle_t * acc_detector_distance_create(const acc_detector_distance_config_t *config)
Create a distance detector with the provided configuration.
static void print_result(acc_detector_distance_result_t *result)
static void cleanup(acc_detector_distance_handle_t *distance_handle, acc_detector_distance_config_t *distance_config, acc_sensor_t *sensor, void *buffer, void *calibration_buffer)
void acc_detector_distance_config_destroy(acc_detector_distance_config_t *config)
Destroy a configuration for a distance detector.
const acc_hal_a121_t * acc_hal_rss_integration_get_implementation(void)
Get hal implementation reference.
bool acc_detector_distance_process(acc_detector_distance_handle_t *handle, void *buffer, void *calibration_buffer, bool *result_available, acc_detector_distance_result_t *result)
Process the data according to the configuration used in acc_detector_distance_config_create.
void * acc_integration_mem_alloc(size_t size)
Allocate dynamic memory.
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, void *calibration_buffer, uint32_t calibration_buffer_size, bool *calibration_complete)
Do a detector calibration.
void acc_integration_set_periodic_wakeup(uint32_t time_msec)
Set up a periodic timer used to wake up the system from sleep.
void acc_detector_distance_destroy(acc_detector_distance_handle_t *handle)
Destroy the 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.
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_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.
int acconeer_main(int argc, char *argv[])
Assembly test example.
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 the end of measured interval in meters.
struct acc_detector_distance_handle acc_detector_distance_handle_t
#define ACC_LOG_FLOAT_TO_INTEGER(a)
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.
#define DEFAULT_UPDATE_RATE
acc_detector_distance_config_t * acc_detector_distance_config_create(void)
Create a configuration for a distance detector.
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
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.