|
Module to control the sensor. More...
Typedefs | |
typedef struct acc_sensor | acc_sensor_t |
Functions | |
acc_sensor_t * | acc_sensor_create (acc_sensor_id_t sensor_id) |
Create a sensor instance. More... | |
void | acc_sensor_destroy (acc_sensor_t *sensor) |
Destroy a sensor instance freeing any resources allocated. More... | |
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. More... | |
bool | acc_sensor_get_cal_info (const acc_cal_result_t *cal_result, acc_cal_info_t *cal_info) |
Gets calibration information from a calibration result. More... | |
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. More... | |
bool | acc_sensor_measure (acc_sensor_t *sensor) |
Start a radar measurement with previously prepared configuration. More... | |
bool | acc_sensor_read (const acc_sensor_t *sensor, void *buffer, uint32_t buffer_size) |
Read out radar data. More... | |
bool | acc_sensor_connected (acc_sensor_id_t sensor_id) |
Check if a sensor is connected and responsive. More... | |
void | acc_sensor_status (const acc_sensor_t *sensor) |
Check the status of the sensor. More... | |
bool | acc_sensor_hibernate_on (acc_sensor_t *sensor) |
Prepare sensor for entering hibernation. More... | |
bool | acc_sensor_hibernate_off (const acc_sensor_t *sensor) |
Restore sensor after exiting hibernation. More... | |
bool | acc_sensor_validate_calibration (const acc_cal_result_t *cal_result) |
Validate calibration result. More... | |
Module to control the sensor.
typedef struct acc_sensor acc_sensor_t |
Definition at line 31 of file acc_sensor.h.
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.
Note that the sensor must be powered on before calling this function. To calibrate the sensor, call this function and wait for sensor interrupt, repeat until calibration is complete (or fails).
[in] | sensor | The sensor instance to calibrate |
[out] | cal_complete | True if calibration is complete False if caller should wait for interrupt and then call again |
[out] | cal_result | The result after a completed calibration |
[in] | buffer | Memory used during calibration. A larger buffer might mean fewer transactions between host and sensor. The buffer will only be used during the calibration. The client has to make sure this buffer is suitably aligned for any built-in type. |
[in] | buffer_size | The size in bytes of the buffer, should be at least buffer_size from acc_rss_get_buffer_size |
bool acc_sensor_connected | ( | acc_sensor_id_t | sensor_id | ) |
Check if a sensor is connected and responsive.
Note that the sensor must be powered on before calling this function.
[in] | sensor_id | The sensor id to be used to communicate with |
acc_sensor_t* acc_sensor_create | ( | acc_sensor_id_t | sensor_id | ) |
Create a sensor instance.
A sensor instance represents a physical radar sensor and handles the communication with it.
Before this function is called the sensor must be powered on and not used in another sensor instance without a power or reset cycle between.
[in] | sensor_id | The sensor id to be used to communicate with |
void acc_sensor_destroy | ( | acc_sensor_t * | sensor | ) |
Destroy a sensor instance freeing any resources allocated.
[in] | sensor | The sensor instance to destroy, can be NULL |
bool acc_sensor_get_cal_info | ( | const acc_cal_result_t * | cal_result, |
acc_cal_info_t * | cal_info | ||
) |
Gets calibration information from a calibration result.
[in] | cal_result | The calibration result |
[out] | cal_info | The calibration information |
bool acc_sensor_hibernate_off | ( | const acc_sensor_t * | sensor | ) |
Restore sensor after exiting hibernation.
Restore sensor after exiting hibernation. Should be invoked after calling acc_hal_integration_sensor_enable()
[in] | sensor | The sensor to unprepare for hibernation |
bool acc_sensor_hibernate_on | ( | acc_sensor_t * | sensor | ) |
Prepare sensor for entering hibernation.
Prepare sensor for entering hibernation. Should be invoked prior to calling acc_hal_integration_sensor_disable()
[in] | sensor | The sensor to prepare for hibernation |
bool acc_sensor_measure | ( | acc_sensor_t * | sensor | ) |
Start a radar measurement with previously prepared configuration.
Note that the following preconditions apply
[in] | sensor | The sensor instance to measure with |
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.
It's possible to reconfigure the sensor by calling the function multiple times.
Note:
[in] | sensor | The sensor instance to prepare |
[in] | config | The configuration to prepare for |
[in] | cal_result | The calibration result to prepare for |
[in] | buffer | Memory used during preparation. A larger buffer might mean fewer transactions between host and sensor. The buffer will only be used during the duration of this call. The client has to make sure this buffer is suitably aligned for any built-in type. |
[in] | buffer_size | The size in bytes of the buffer, should be at least buffer_size from acc_rss_get_buffer_size |
bool acc_sensor_read | ( | const acc_sensor_t * | sensor, |
void * | buffer, | ||
uint32_t | buffer_size | ||
) |
Read out radar data.
Note that the following preconditions apply
[in] | sensor | The sensor to read the radar data from |
[in] | buffer | The buffer to read radar data into. The buffer will only be used during the duration of this call. The client has to make sure this buffer is suitably aligned for any built-in type. |
[in] | buffer_size | The size in bytes of the buffer, should be at least buffer_size from acc_rss_get_buffer_size |
void acc_sensor_status | ( | const acc_sensor_t * | sensor | ) |
Check the status of the sensor.
This function reads out the internal status from the sensor and prints it for debugging purposes. It can for example be called when the function acc_hal_integration_wait_for_sensor_interrupt() fails. Note that the sensor must be powered on before calling this function.
[in] | sensor | The sensor instance to get status from |
bool acc_sensor_validate_calibration | ( | const acc_cal_result_t * | cal_result | ) |
Validate calibration result.
[in] | cal_result | Result of a calibration |