Go to the documentation of this file.
23 #define SENSOR_ID (1U)
24 #define SENSOR_TIMEOUT_MS (1000U)
71 if (app_config == NULL)
73 printf(
"waste_level_app_config_create() failed\n");
87 printf(
"waste_level_handle_create() failed\n");
93 if (processing == NULL)
95 printf(
"acc_processing_create() failed\n");
102 printf(
"acc_rss_get_buffer_size() failed\n");
110 printf(
"buffer allocation failed\n");
121 printf(
"acc_sensor_create() failed\n");
128 printf(
"do_sensor_calibration_and_prepare() failed\n");
138 printf(
"acc_sensor_measure failed\n");
146 printf(
"Sensor interrupt timeout\n");
154 printf(
"acc_sensor_read failed\n");
164 printf(
"The current calibration is not valid for the current temperature.\n");
165 printf(
"The sensor needs to be re-calibrated.\n");
169 printf(
"do_sensor_calibration_and_prepare() failed\n");
175 printf(
"The sensor was successfully re-calibrated.\n");
179 printf(
"Data is saturated. Try to reduce the sensor gain\n");
191 printf(
"Application finished OK\n");
210 if (processing != NULL)
220 if (app_config != NULL)
234 bool cal_complete =
false;
236 const uint16_t calibration_retries = 1U;
239 for (uint16_t i = 0; !status && (i <= calibration_retries); i++)
249 if (status && !cal_complete)
253 }
while (status && !cal_complete);
276 printf(
"No level found\n");
void acc_hal_integration_sensor_supply_off(acc_sensor_id_t sensor_id)
Power off sensor supply.
#define SENSOR_TIMEOUT_MS
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.
waste_level_handle_t * waste_level_handle_create(const waste_level_app_config_t *app_config)
Create a waste level handle.
Result provided by the processing module.
bool acc_sensor_read(const acc_sensor_t *sensor, void *buffer, uint32_t buffer_size)
Read out radar data.
static void print_waste_level_result(const waste_level_result_t *result)
Print a processor result in a human-readable format.
The result from a completed calibration.
void waste_level_handle_destroy(waste_level_handle_t *handle)
Destroy a waste level handle.
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.
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.
void waste_level_app_config_destroy(waste_level_app_config_t *app_config)
Destroy a waste level app config.
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.
struct acc_config acc_config_t
@ WASTE_LEVEL_PRESET_PLASTIC_WASTE_BIN
int acconeer_main(int argc, char *argv[])
Assembly test example.
void acc_hal_integration_sensor_enable(acc_sensor_id_t sensor_id)
Enable sensor.
acc_config_t * sensor_config
void waste_level_process(waste_level_handle_t *handle, const waste_level_app_config_t *app_config, const acc_processing_metadata_t *metadata, const acc_int16_complex_t *frame, waste_level_result_t *waste_level_result)
Process Sparse IQ data.
acc_int16_complex_t * frame
void acc_hal_integration_sensor_disable(acc_sensor_id_t sensor_id)
Disable sensor.
struct acc_processing_handle acc_processing_t
#define ACC_LOG_FLOAT_TO_INTEGER(a)
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.
void acc_config_log(const acc_config_t *config)
Print a configuration to the log.
static bool do_sensor_calibration_and_prepare(acc_sensor_t *sensor, acc_config_t *config, void *buffer, uint32_t buffer_size)
Performs sensor calibration (with retry) and sensor prepare.
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.
waste_level_app_config_t * waste_level_app_config_create(void)
Create a waste level app config (includes an acc_config_t)
void waste_level_app_config_set_preset(waste_level_preset_t preset, waste_level_app_config_t *app_config)
Apply a preset to an app config.
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.
void waste_level_processing_config_log(const waste_level_processing_config_t *config)
Log a waste level config.
struct acc_sensor acc_sensor_t
static void cleanup(acc_processing_t *processing, acc_sensor_t *sensor, void *buffer, waste_level_handle_t *handle, waste_level_app_config_t *app_config)
Frees any allocated resources.
void acc_sensor_destroy(acc_sensor_t *sensor)
Destroy a sensor instance freeing any resources allocated.
waste_level_processing_config_t processing_config
acc_sensor_t * acc_sensor_create(acc_sensor_id_t sensor_id)
Create a sensor instance.