1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
// Copyright (c) Acconeer AB, 2020-2022
// All rights reserved
/**
* @defgroup service Service
*
* @brief Service API
*
* @defgroup sensor Sensor
* @ingroup service
*
* @brief Module to control the sensor
*
* @{
*/
;
typedef struct acc_sensor acc_sensor_t;
/**
* @brief 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.
*
* @param[in] sensor_id The sensor id to be used to communicate with
*
* @return Sensor instance, NULL if sensor instance was not possible to create
*/
acc_sensor_t *;
/**
* @brief Destroy a sensor instance freeing any resources allocated.
*
* @param[in] sensor The sensor instance to destroy, can be NULL
*/
void ;
/**
* @brief 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).
*
* @param[in] sensor The sensor instance to calibrate
* @param[out] cal_complete True if calibration is complete
False if caller should wait for interrupt and
then call again
* @param[out] cal_result The result after a completed calibration
* @param[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.
* @param[in] buffer_size The size in bytes of the buffer, should be at least buffer_size
from @ref acc_rss_get_buffer_size
* @return true if successful, false otherwise
*/
bool ;
/**
* @brief Gets calibration information from a calibration result
*
* @param[in] cal_result The calibration result
* @param[out] cal_info The calibration information
* @return true if successful, false otherwise
*/
bool ;
/**
* @brief 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
* @ref acc_sensor_measure use @ref 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.
*
* @param[in] sensor The sensor instance to prepare
* @param[in] config The configuration to prepare for
* @param[in] cal_result The calibration result to prepare for
* @param[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.
* @param[in] buffer_size The size in bytes of the buffer, should be at least buffer_size
* from @ref acc_rss_get_buffer_size
* @return true if successful, false otherwise
*/
bool ;
/**
* @brief Start a radar measurement with previously prepared configuration
*
* Note that the following preconditions apply
* - The sensor must be powered on
* - @ref acc_sensor_calibrate must have been called
* - @ref acc_sensor_prepare must have been called
*
* @param[in] sensor The sensor instance to measure with
* @return true if successful, false otherwise
*/
bool ;
/**
* @brief Read out radar data
*
* Note that the following preconditions apply
* - The sensor must be powered on
* - @ref acc_sensor_measure must be called before each call to this function
* - The sensor interrupt must be active
*
* @param[in] sensor The sensor to read the radar data from
* @param[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.
* @param[in] buffer_size The size in bytes of the buffer, should be at least buffer_size
* from @ref acc_rss_get_buffer_size
* @return true if successful, false otherwise
*/
bool ;
/**
* @brief Check if a sensor is connected and responsive
*
* Note that the sensor must be powered on before calling this function.
*
* @param[in] sensor_id The sensor id to be used to communicate with
* @return true if it is possible to communicate with the sensor
*/
bool ;
/**
* @brief 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 @ref acc_hal_integration_wait_for_sensor_interrupt()
* fails. Note that the sensor must be powered on before calling this function.
*
* @param[in] sensor The sensor instance to get status from
*/
void ;
/**
* @brief Prepare sensor for entering hibernation
*
* Prepare sensor for entering hibernation.
* Should be invoked prior to calling @ref acc_hal_integration_sensor_disable()
*
* @param[in] sensor The sensor to prepare for hibernation
* @return True if prepare was successful
*/
bool ;
/**
* @brief Restore sensor after exiting hibernation
*
* Restore sensor after exiting hibernation.
* Should be invoked after calling @ref acc_hal_integration_sensor_enable()
*
* @param[in] sensor The sensor to unprepare for hibernation
* @return True if unprepare was successful
*/
bool ;
/**
* @brief Validate calibration result
*
* @param[in] cal_result Result of a calibration
*
* @return True if calibration is valid
*/
bool ;
/**
* @}
*/