Typedefs | Functions
Sensor
Service

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...

## Detailed Description

Module to control the sensor.

## Typedef Documentation

## ◆ acc_sensor_t

typedef struct acc_sensor acc_sensor_t

Definition at line 31 of file acc_sensor.h.

## Function Documentation

## ◆ acc_sensor_calibrate()

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).

Parameters

  [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

Returns
  true if successful, false otherwise

Examples
  acc_control_helper.c, example_detector_distance.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, example_detector_presence.c, example_detector_presence_low_power_hibernate.c, example_detector_presence_low_power_off.c, example_detector_presence_multiple_configurations.c, example_service.c, example_service_low_power_sensor_disable.c, example_service_low_power_sensor_hibernate.c, example_service_multiple_configurations.c, example_service_sensor_disable.c, example_service_sensor_hibernate.c, example_service_sensor_off.c, example_service_subsweeps.c, and ref_app_tank_level.c.

## ◆ acc_sensor_connected()

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.

Parameters

  [in] | sensor_id | The sensor id to be used to communicate with

Returns
  true if it is possible to communicate with the sensor

## ◆ acc_sensor_create()

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.

Parameters

  [in] | sensor_id | The sensor id to be used to communicate with

Returns
  Sensor instance, NULL if sensor instance was not possible to create

Examples
  acc_control_helper.c, example_detector_distance.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, example_detector_presence.c, example_detector_presence_low_power_hibernate.c, example_detector_presence_low_power_off.c, example_detector_presence_multiple_configurations.c, example_service.c, example_service_low_power_sensor_disable.c, example_service_low_power_sensor_hibernate.c, example_service_multiple_configurations.c, example_service_sensor_disable.c, example_service_sensor_hibernate.c, example_service_sensor_off.c, example_service_subsweeps.c, and ref_app_tank_level.c.

## ◆ acc_sensor_destroy()

void acc_sensor_destroy | ( | acc_sensor_t * | sensor | ) |

Destroy a sensor instance freeing any resources allocated.

Parameters

  [in] | sensor | The sensor instance to destroy, can be NULL

Examples
  acc_control_helper.c, example_detector_distance.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, example_detector_presence.c, example_detector_presence_low_power_hibernate.c, example_detector_presence_low_power_off.c, example_detector_presence_multiple_configurations.c, example_service.c, example_service_low_power_sensor_disable.c, example_service_low_power_sensor_hibernate.c, example_service_multiple_configurations.c, example_service_sensor_disable.c, example_service_sensor_hibernate.c, example_service_sensor_off.c, example_service_subsweeps.c, and ref_app_tank_level.c.

## ◆ acc_sensor_get_cal_info()

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.

Parameters

  [in] | cal_result | The calibration result
  [out] | cal_info | The calibration information

Returns
  true if successful, false otherwise

## ◆ acc_sensor_hibernate_off()

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()

Parameters

  [in] | sensor | The sensor to unprepare for hibernation

Returns
  True if unprepare was successful

Examples
  example_detector_distance_low_power_hibernate.c, example_detector_presence_low_power_hibernate.c, example_service_low_power_sensor_hibernate.c, and example_service_sensor_hibernate.c.

## ◆ acc_sensor_hibernate_on()

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()

Parameters

  [in] | sensor | The sensor to prepare for hibernation

Returns
  True if prepare was successful

Examples
  example_detector_distance_low_power_hibernate.c, example_detector_presence_low_power_hibernate.c, example_service_low_power_sensor_hibernate.c, and example_service_sensor_hibernate.c.

## ◆ acc_sensor_measure()

bool acc_sensor_measure | ( | acc_sensor_t * | sensor | ) |

Start a radar measurement with previously prepared configuration.

Note that the following preconditions apply

- The sensor must be powered on
- acc_sensor_calibrate must have been called
- acc_sensor_prepare must have been called

Parameters

  [in] | sensor | The sensor instance to measure with

Returns
  true if successful, false otherwise

Examples
  acc_control_helper.c, example_detector_distance.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, example_detector_presence.c, example_detector_presence_low_power_hibernate.c, example_detector_presence_low_power_off.c, example_detector_presence_multiple_configurations.c, example_service.c, example_service_low_power_sensor_disable.c, example_service_low_power_sensor_hibernate.c, example_service_multiple_configurations.c, example_service_sensor_disable.c, example_service_sensor_hibernate.c, example_service_sensor_off.c, example_service_subsweeps.c, and ref_app_tank_level.c.

## ◆ acc_sensor_prepare()

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:

- The sensor must be powered on when calling this function.
- The sensor must not be measuring when calling this function, if previous call was acc_sensor_measure use acc_hal_integration_wait_for_sensor_interrupt to wait for measurement to complete.
- Reconfiguring is not supported when double buffering is active, however enabling double buffering through reconfiguration is.

Parameters

  [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

Returns
  true if successful, false otherwise

Examples
  acc_control_helper.c, example_service.c, example_service_low_power_sensor_disable.c, example_service_low_power_sensor_hibernate.c, example_service_multiple_configurations.c, example_service_sensor_disable.c, example_service_sensor_hibernate.c, example_service_sensor_off.c, and example_service_subsweeps.c.

## ◆ acc_sensor_read()

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

- The sensor must be powered on
- acc_sensor_measure must be called before each call to this function
- The sensor interrupt must be active

Parameters

  [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

Returns
  true if successful, false otherwise

Examples
  acc_control_helper.c, example_detector_distance.c, example_detector_distance_low_power_hibernate.c, example_detector_distance_low_power_off.c, example_detector_distance_with_iq_data_print.c, example_detector_presence.c, example_detector_presence_low_power_hibernate.c, example_detector_presence_low_power_off.c, example_detector_presence_multiple_configurations.c, example_service.c, example_service_low_power_sensor_disable.c, example_service_low_power_sensor_hibernate.c, example_service_multiple_configurations.c, example_service_sensor_disable.c, example_service_sensor_hibernate.c, example_service_sensor_off.c, example_service_subsweeps.c, and ref_app_tank_level.c.

## ◆ acc_sensor_status()

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.

Parameters

  [in] | sensor | The sensor instance to get status from

Examples
  acc_control_helper.c, example_detector_distance_low_power_hibernate.c, example_detector_presence_low_power_hibernate.c, example_service.c, example_service_low_power_sensor_disable.c, example_service_low_power_sensor_hibernate.c, example_service_multiple_configurations.c, example_service_sensor_disable.c, example_service_sensor_hibernate.c, example_service_sensor_off.c, example_service_subsweeps.c, and ref_app_tank_level.c.

## ◆ acc_sensor_validate_calibration()

bool acc_sensor_validate_calibration | ( | const acc_cal_result_t * | cal_result | ) |

Validate calibration result.

Parameters

  [in] | cal_result | Result of a calibration

Returns
  True if calibration is valid