|
|
#include <math.h>#include <stdbool.h>#include <stdint.h>#include <stdio.h>#include <string.h>#include "acc_algorithm.h"#include "acc_config.h"#include "acc_definitions_a121.h"#include "acc_definitions_common.h"#include "acc_hal_integration_a121.h"#include "acc_integration.h"#include "acc_integration_log.h"#include "acc_processing.h"#include "acc_rss_a121.h"#include "acc_sensor.h"#include "ref_app_parking.h"Go to the source code of this file.
Data Structures | |
| struct | signature_t |
| struct | ref_app_parking_handle |
Macros | |
| #define | CAL_ITERATIONS (3U) |
| #define | MAX_AMPLITUDE (46341.0f) |
Functions | |
| static void | set_sensor_config (ref_app_parking_handle_t *handle) |
| Set sensor config using already set parking config. More... | |
| static void | log_config (ref_app_parking_handle_t *handle) |
| Log config. More... | |
| static bool | allocate_application_resources (ref_app_parking_handle_t *handle) |
| Allocate resources for application. More... | |
| static void | initialize_application_resources (ref_app_parking_handle_t *handle) |
| Initialize resources for application using already set parking config. More... | |
| static uint32_t | get_measure_timeout_ms (float update_rate_hz) |
| Get timeout value, in ms, for specified update rate. More... | |
| static float | noise_process (acc_int16_complex_t *noise_data, float *noise_magnitudes, uint16_t noise_data_length) |
| Calculate noise level from noise data. More... | |
| static float | obstruction_noise (acc_int16_complex_t *obs_noise_data, uint16_t obs_noise_data_length) |
| Calculate noise mean from obstruction noise data. More... | |
| static void | obstruction_signature (acc_int16_complex_t *subsweep, float *magnitudes, float *distances, uint16_t length, float noise_level, signature_t *signature) |
| Calculate obstruction signature from obstruction data. More... | |
| static void | car_signature (const float *magnitudes, const float *distances, uint16_t length, signature_t *signature) |
| Calculate car signature from car data. More... | |
| static bool | objects_present (const ref_app_parking_handle_t *handle) |
| Determine if there are any objects present using signature history and thresholds. More... | |
| static bool | same_objects (ref_app_parking_handle_t *handle) |
| Determine if multiple signatures relates to same object. More... | |
| static int | compare_signature (const void *a, const void *b) |
| Function used to compare two signatures for use in qsort. More... | |
| static bool | enter_hibernate (ref_app_parking_handle_t *handle) |
| Make sensor enter hibernate. More... | |
| static bool | exit_hibernate (ref_app_parking_handle_t *handle) |
| Make sensor exit hibernate. More... | |
| void | ref_app_parking_set_config (ref_app_parking_parking_preset_t preset, ref_app_parking_config_t *parking_config) |
| Set parking config according to specified preset. More... | |
| ref_app_parking_handle_t * | ref_app_parking_handle_create (ref_app_parking_config_t *parking_config, acc_sensor_id_t sensor_id) |
| Create parking handle. More... | |
| void | ref_app_parking_handle_destroy (ref_app_parking_handle_t *handle) |
| Destroy parking handle. More... | |
| bool | ref_app_parking_sensor_calibration (ref_app_parking_handle_t *handle) |
| Sensor calibration. More... | |
| bool | ref_app_parking_noise_calibration (ref_app_parking_handle_t *handle) |
| Noise calibration. More... | |
| bool | ref_app_parking_obstruction_calibration (ref_app_parking_handle_t *handle) |
| Obstruction calibration. More... | |
| bool | ref_app_parking_sensor_prepare (ref_app_parking_handle_t *handle) |
| Prepare sensor for measurement. More... | |
| bool | ref_app_parking_measure (ref_app_parking_handle_t *handle, bool hibernate) |
| Perform a sensor measurement. More... | |
| bool | ref_app_parking_handle_indications (ref_app_parking_handle_t *handle, bool *data_reliable) |
| Handle indications from a measurement. More... | |
| void | ref_app_parking_obstruction_process (ref_app_parking_handle_t *handle, bool *obstruction_detected) |
| Do obstruction processing. More... | |
| void | ref_app_parking_process (ref_app_parking_handle_t *handle, bool *car_detected) |
| Do parking processing. More... | |
| #define CAL_ITERATIONS (3U) |
Definition at line 25 of file ref_app_parking.c.
| #define MAX_AMPLITUDE (46341.0f) |
Definition at line 26 of file ref_app_parking.c.
|
static |
Allocate resources for application.
| [in] | handle | The parking handle |
Definition at line 883 of file ref_app_parking.c.
|
static |
Calculate car signature from car data.
| [in] | magnitudes | The car data |
| [in] | distances | Corresponding distance for each point in the car data |
| [in] | length | The length of magnitudes and distances |
| [out] | signature | The calculated signature |
Definition at line 1083 of file ref_app_parking.c.
|
static |
Function used to compare two signatures for use in qsort.
| [in] | a | First signature |
| [in] | b | Second signature |
Definition at line 1167 of file ref_app_parking.c.
|
static |
Make sensor enter hibernate.
| [in] | handle | The parking handle |
Definition at line 1186 of file ref_app_parking.c.
|
static |
Make sensor exit hibernate.
| [in] | handle | The parking handle |
Definition at line 1201 of file ref_app_parking.c.
|
static |
Get timeout value, in ms, for specified update rate.
| [in] | update_rate_hz | The update rate, in Hz |
Definition at line 1017 of file ref_app_parking.c.
|
static |
Initialize resources for application using already set parking config.
| [in] | handle | The parking handle |
Definition at line 970 of file ref_app_parking.c.
|
static |
Log config.
| [in] | handle | The parking handle |
Definition at line 834 of file ref_app_parking.c.
|
static |
Calculate noise level from noise data.
| [in] | noise_data | The noise data |
| [in] | noise_magnitudes | Intermediate step in processing will be stored here |
| [in] | noise_data_length | The length of noise data and magnitudes |
Definition at line 1022 of file ref_app_parking.c.
|
static |
Determine if there are any objects present using signature history and thresholds.
| [in] | handle | The parking handle |
Definition at line 1089 of file ref_app_parking.c.
|
static |
Calculate noise mean from obstruction noise data.
| [in] | obs_noise_data | The obstruction noise data |
| [in] | obs_noise_data_length | The length of obstruction noise data |
Definition at line 1048 of file ref_app_parking.c.
|
static |
Calculate obstruction signature from obstruction data.
| [in] | subsweep | The obstruction data |
| [in] | magnitudes | Intermediate step in processing will be stored here |
| [in] | distances | Corresponding distance for each point in the obstruction data |
| [in] | length | The length of subsweep, magnitudes, and distances |
| [in] | noise_level | The current noise level to compensate for |
| [out] | signature | The calculated signature |
Definition at line 1063 of file ref_app_parking.c.
| ref_app_parking_handle_t* ref_app_parking_handle_create | ( | ref_app_parking_config_t * | parking_config, |
| acc_sensor_id_t | sensor_id | ||
| ) |
Create parking handle.
The handle is used for both control and processing
This function enables the sensor
| [in] | parking_config | The parking config used to create the parking handle |
| [in] | sensor_id | The sensor_id for the sensor to be used |
Definition at line 252 of file ref_app_parking.c.
| void ref_app_parking_handle_destroy | ( | ref_app_parking_handle_t * | handle | ) |
Destroy parking handle.
This function disables the sensor
| [in] | handle | The handle to destroy |
Definition at line 284 of file ref_app_parking.c.
| bool ref_app_parking_handle_indications | ( | ref_app_parking_handle_t * | handle, |
| bool * | data_reliable | ||
| ) |
Handle indications from a measurement.
| [in] | handle | The handle to do a sensor measurement for |
| [out] | data_reliable | Flag to determine if data from measurement is reliable. Se log for more details if false |
Definition at line 597 of file ref_app_parking.c.
| bool ref_app_parking_measure | ( | ref_app_parking_handle_t * | handle, |
| bool | hibernate | ||
| ) |
Perform a sensor measurement.
| [in] | handle | The handle to do a sensor measurement for |
| [in] | hibernate | Hibernate sensor between measurements |
Definition at line 554 of file ref_app_parking.c.
| bool ref_app_parking_noise_calibration | ( | ref_app_parking_handle_t * | handle | ) |
Noise calibration.
| [in] | handle | The handle to calibrate noise for |
Definition at line 390 of file ref_app_parking.c.
| bool ref_app_parking_obstruction_calibration | ( | ref_app_parking_handle_t * | handle | ) |
Obstruction calibration.
Note that the sensor must be free from obstruction when calling this function.
| [in] | handle | The handle to calibrate obstruction for |
Definition at line 445 of file ref_app_parking.c.
| void ref_app_parking_obstruction_process | ( | ref_app_parking_handle_t * | handle, |
| bool * | obstruction_detected | ||
| ) |
Do obstruction processing.
| [in] | handle | The handle to do obstruction processing for |
| [out] | obstruction_detected | true if obstruction detected, false otherwise |
Definition at line 663 of file ref_app_parking.c.
| void ref_app_parking_process | ( | ref_app_parking_handle_t * | handle, |
| bool * | car_detected | ||
| ) |
Do parking processing.
| [in] | handle | The handle to do parking processing for |
| [out] | car_detected | true if car detected, false otherwise |
Definition at line 711 of file ref_app_parking.c.
| bool ref_app_parking_sensor_calibration | ( | ref_app_parking_handle_t * | handle | ) |
Sensor calibration.
| [in] | handle | The handle to calibrate sensor for |
Definition at line 355 of file ref_app_parking.c.
| bool ref_app_parking_sensor_prepare | ( | ref_app_parking_handle_t * | handle | ) |
Prepare sensor for measurement.
| [in] | handle | The handle to prepare sensor for |
Definition at line 537 of file ref_app_parking.c.
| void ref_app_parking_set_config | ( | ref_app_parking_parking_preset_t | preset, |
| ref_app_parking_config_t * | parking_config | ||
| ) |
Set parking config according to specified preset.
| [in] | preset | The preset used to set parking config |
| [out] | parking_config | The parking config to be set |
Definition at line 201 of file ref_app_parking.c.
|
static |
Determine if multiple signatures relates to same object.
| [in] | handle | The parking handle |
Definition at line 1108 of file ref_app_parking.c.
|
static |
Set sensor config using already set parking config.
| [in] | handle | The parking handle |
Definition at line 764 of file ref_app_parking.c.