This is a simplified API that can be used to easier get started The implementation of this API is provided as source code which can be examined and modified in order to suit your needs.
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#define SENSOR_CALIBRATION_TIMEOUT_MS 500
#define SENSOR_MEASURE_TIMEOUT_MS 1000
{
bool cal_status;
bool cal_complete = false;
do
{
if (cal_status && !cal_complete)
{
}
} while (cal_status && !cal_complete);
return cal_status;
}
{
return radar->
config != NULL ? true :
false;
}
{
{
}
{
}
{
}
{
}
}
{
{
fprintf(stderr, "Failed to create processing\n");
goto fail;
}
{
fprintf(stderr, "acc_rss_get_buffer_size() failed\n");
goto fail;
}
{
fprintf(stderr, "acc_rss_get_buffer_size() failed\n");
goto fail;
}
{
fprintf(stderr, "Failed to create sensor\n");
goto fail;
}
{
fprintf(stderr, "calibration failed\n");
goto fail;
}
{
fprintf(stderr, "acc_sensor_prepare failed\n");
goto fail;
}
return true;
fail:
{
}
{
}
{
}
return false;
}
{
{
fprintf(stderr, "acc_sensor_measure failed\n");
goto fail;
}
{
fprintf(stderr, "Sensor interrupt timeout\n");
goto fail;
}
{
fprintf(stderr, "acc_sensor_read failed\n");
goto fail;
}
return true;
fail:
return false;
}
bool acc_control_helper_get_next(acc_control_helper_t *radar)
Perform a radar measurement and wait for the result.
void acc_hal_integration_sensor_supply_off(acc_sensor_id_t sensor_id)
Power off sensor supply.
acc_sensor_id_t sensor_id
void acc_processing_destroy(acc_processing_t *handle)
Destroy a processing instance identified with the provided processing handle.
void acc_hal_integration_sensor_supply_on(acc_sensor_id_t sensor_id)
Power on sensor supply.
acc_processing_t * processing
bool acc_sensor_read(const acc_sensor_t *sensor, void *buffer, uint32_t buffer_size)
Read out radar data.
void acc_config_destroy(acc_config_t *config)
Destroy a configuration freeing any resources allocated.
#define SENSOR_MEASURE_TIMEOUT_MS
void acc_processing_execute(acc_processing_t *handle, void *buffer, acc_processing_result_t *result)
Process the data according to the configuration used in create.
acc_config_t * acc_config_create(void)
Create a configuration.
void * acc_integration_mem_alloc(size_t size)
Allocate dynamic memory.
acc_processing_metadata_t proc_meta
bool acc_hal_integration_wait_for_sensor_interrupt(acc_sensor_id_t sensor_id, uint32_t timeout_ms)
Wait for a sensor interrupt.
static bool acc_control_helper_calibrate(acc_control_helper_t *radar)
void acc_control_helper_destroy(acc_control_helper_t *radar)
Destroy a helper instance.
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.
acc_cal_result_t cal_result
uint32_t acc_sensor_id_t
Type representing a sensor ID.
void acc_sensor_status(const acc_sensor_t *sensor)
Check the status of the sensor.
bool acc_sensor_prepare(acc_sensor_t *sensor, const acc_config_t *config, const acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size)
Prepare a sensor to do a measurement.
void acc_integration_mem_free(void *ptr)
Free dynamic memory.
#define SENSOR_CALIBRATION_TIMEOUT_MS
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.
acc_processing_t * acc_processing_create(const acc_config_t *config, acc_processing_metadata_t *processing_metadata)
Create a processing instance with the provided configuration.
acc_processing_result_t proc_result
bool acc_control_helper_activate(acc_control_helper_t *radar)
Activate the sensor.
void acc_sensor_destroy(acc_sensor_t *sensor)
Destroy a sensor instance freeing any resources allocated.
bool acc_control_helper_create(acc_control_helper_t *radar, acc_sensor_id_t sensor_id)
Create a helper instance.
acc_sensor_t * acc_sensor_create(acc_sensor_id_t sensor_id)
Create a sensor instance.