Skip to content

Commit 3cde0f7

Browse files
lixuzhanashif
authored andcommitted
sensing: fix doxygen warnings
Add missing doxygen comments in various sensing headers. Signed-off-by: Zhang Lixu <[email protected]>
1 parent a5ea555 commit 3cde0f7

File tree

4 files changed

+266
-106
lines changed

4 files changed

+266
-106
lines changed

include/zephyr/sensing/sensing.h

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,20 @@ extern "C" {
3838
*/
3939
struct sensing_sensor_version {
4040
union {
41-
uint32_t value;
41+
uint32_t value; /**< The version represented as a 32-bit value. */
4242
struct {
43-
uint8_t major;
44-
uint8_t minor;
45-
uint8_t hotfix;
46-
uint8_t build;
43+
uint8_t major; /**< The major version number. */
44+
uint8_t minor; /**< The minor version number. */
45+
uint8_t hotfix; /**< The hotfix version number. */
46+
uint8_t build; /**< The build version number. */
4747
};
4848
};
4949
};
5050

51+
/**
52+
* @brief Macro to create a sensor version value.
53+
*
54+
*/
5155
#define SENSING_SENSOR_VERSION(_major, _minor, _hotfix, _build) \
5256
(FIELD_PREP(GENMASK(31, 24), _major) | \
5357
FIELD_PREP(GENMASK(23, 16), _minor) | \
@@ -83,36 +87,36 @@ struct sensing_sensor_version {
8387
*
8488
*/
8589
enum sensing_sensor_state {
86-
SENSING_SENSOR_STATE_READY = 0,
87-
SENSING_SENSOR_STATE_OFFLINE = 1,
90+
SENSING_SENSOR_STATE_READY = 0, /**< The sensor is ready. */
91+
SENSING_SENSOR_STATE_OFFLINE = 1, /**< The sensor is offline. */
8892
};
8993

9094
/**
9195
* @brief Sensing subsystem sensor config attribute
9296
*
9397
*/
9498
enum sensing_sensor_attribute {
99+
/** The interval attribute of a sensor configuration. */
95100
SENSING_SENSOR_ATTRIBUTE_INTERVAL = 0,
101+
/** The sensitivity attribute of a sensor configuration. */
96102
SENSING_SENSOR_ATTRIBUTE_SENSITIVITY = 1,
103+
/** The latency attribute of a sensor configuration. */
97104
SENSING_SENSOR_ATTRIBUTE_LATENCY = 2,
105+
/** The maximum number of attributes that a sensor configuration can have. */
98106
SENSING_SENSOR_ATTRIBUTE_MAX,
99107
};
100108

101-
102109
/**
103110
* @brief Define Sensing subsystem sensor handle
104111
*
105112
*/
106113
typedef void *sensing_sensor_handle_t;
107114

108-
109115
/**
110116
* @brief Sensor data event receive callback.
111117
*
112118
* @param handle The sensor instance handle.
113-
*
114119
* @param buf The data buffer with sensor data.
115-
*
116120
* @param context User provided context pointer.
117121
*/
118122
typedef void (*sensing_data_event_t)(
@@ -151,41 +155,52 @@ struct sensing_sensor_info {
151155
*
152156
*/
153157
struct sensing_callback_list {
154-
sensing_data_event_t on_data_event;
155-
void *context;
158+
sensing_data_event_t on_data_event; /**< Callback function for a sensor data event. */
159+
void *context; /**< Associated context with on_data_event */
156160
};
161+
157162
/**
158163
* @struct sensing_sensor_config
159164
* @brief Sensing subsystem sensor configure, including interval, sensitivity, latency
160165
*
161166
*/
162167
struct sensing_sensor_config {
163-
enum sensing_sensor_attribute attri;
168+
enum sensing_sensor_attribute attri; /**< Attribute of the sensor configuration. */
164169

165170
/** \ref SENSING_SENSITIVITY_INDEX_ALL */
166-
int8_t data_field;
171+
int8_t data_field; /**< Data field of the sensor configuration. */
167172

168173
union {
174+
/** Interval between two sensor samples in microseconds (us). */
169175
uint32_t interval;
176+
177+
/**
178+
* Sensitivity threshold for reporting new data. A new sensor sample is reported
179+
* only if the difference between it and the previous sample exceeds this
180+
* sensitivity value.
181+
*/
170182
uint32_t sensitivity;
183+
184+
/**
185+
* Maximum duration for batching sensor samples before reporting in
186+
* microseconds (us). This defines how long sensor samples can be
187+
* accumulated before they must be reported.
188+
*/
171189
uint64_t latency;
172190
};
173191
};
174192

175-
176-
/**
177-
* @brief Get all supported sensor instances' information.
178-
*
179-
* This API just returns read only information of sensor instances, pointer info will
180-
* directly point to internal buffer, no need for caller to allocate buffer,
181-
* no side effect to sensor instances.
182-
*
183-
* @param num_sensors Get number of sensor instances.
184-
*
185-
* @param info For receiving sensor instances' information array pointer.
186-
*
187-
* @return 0 on success or negative error value on failure.
188-
*/
193+
/**
194+
* @brief Get all supported sensor instances' information.
195+
*
196+
* This API just returns read only information of sensor instances, pointer info will
197+
* directly point to internal buffer, no need for caller to allocate buffer,
198+
* no side effect to sensor instances.
199+
*
200+
* @param num_sensors Get number of sensor instances.
201+
* @param info For receiving sensor instances' information array pointer.
202+
* @return 0 on success or negative error value on failure.
203+
*/
189204
int sensing_get_sensors(int *num_sensors, const struct sensing_sensor_info **info);
190205

191206
/**
@@ -197,12 +212,9 @@ int sensing_get_sensors(int *num_sensors, const struct sensing_sensor_info **inf
197212
* meanwhile, also register sensing callback list
198213
*
199214
* @param info The sensor info got from \ref sensing_get_sensors
200-
*
201215
* @param cb_list callback list to be registered to sensing, must have a static
202216
* lifetime.
203-
*
204217
* @param handle The opened instance handle, if failed will be set to NULL.
205-
*
206218
* @return 0 on success or negative error value on failure.
207219
*/
208220
int sensing_open_sensor(
@@ -219,12 +231,9 @@ int sensing_open_sensor(
219231
* meanwhile, also register sensing callback list.
220232
*
221233
* @param dev pointer device get from device tree.
222-
*
223234
* @param cb_list callback list to be registered to sensing, must have a static
224235
* lifetime.
225-
*
226236
* @param handle The opened instance handle, if failed will be set to NULL.
227-
*
228237
* @return 0 on success or negative error value on failure.
229238
*/
230239
int sensing_open_sensor_by_dt(
@@ -235,7 +244,6 @@ int sensing_open_sensor_by_dt(
235244
* @brief Close sensor instance.
236245
*
237246
* @param handle The sensor instance handle need to close.
238-
*
239247
* @return 0 on success or negative error value on failure.
240248
*/
241249
int sensing_close_sensor(
@@ -245,11 +253,8 @@ int sensing_close_sensor(
245253
* @brief Set current config items to Sensing subsystem.
246254
*
247255
* @param handle The sensor instance handle.
248-
*
249256
* @param configs The configs to be set according to config attribute.
250-
*
251257
* @param count count of configs.
252-
*
253258
* @return 0 on success or negative error value on failure, not support etc.
254259
*/
255260
int sensing_set_config(
@@ -260,11 +265,8 @@ int sensing_set_config(
260265
* @brief Get current config items from Sensing subsystem.
261266
*
262267
* @param handle The sensor instance handle.
263-
*
264268
* @param configs The configs to be get according to config attribute.
265-
*
266269
* @param count count of configs.
267-
*
268270
* @return 0 on success or negative error value on failure, not support etc.
269271
*/
270272
int sensing_get_config(
@@ -275,7 +277,6 @@ int sensing_get_config(
275277
* @brief Get sensor information from sensor instance handle.
276278
*
277279
* @param handle The sensor instance handle.
278-
*
279280
* @return a const pointer to \ref sensing_sensor_info on success or NULL on failure.
280281
*/
281282
const struct sensing_sensor_info *sensing_get_sensor_info(
@@ -289,5 +290,4 @@ const struct sensing_sensor_info *sensing_get_sensor_info(
289290
* @}
290291
*/
291292

292-
293293
#endif /*ZEPHYR_INCLUDE_SENSING_H_*/

include/zephyr/sensing/sensing_datatypes.h

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
* system/chre/chre_api/include/chre_api/chre/sensor_types.h
4646
*/
4747
struct sensing_sensor_value_header {
48-
/** base timestamp of this data readings, unit is micro seconds */
48+
/** Base timestamp of this data readings, unit is micro seconds */
4949
uint64_t base_timestamp;
50-
/** count of this data readings */
50+
/** Count of this data readings */
5151
uint16_t reading_count;
5252
};
5353

@@ -65,19 +65,28 @@ struct sensing_sensor_value_header {
6565
* q31 version
6666
*/
6767
struct sensing_sensor_value_3d_q31 {
68+
/** Header of the sensor value data structure. */
6869
struct sensing_sensor_value_header header;
69-
int8_t shift;
70+
int8_t shift; /**< The shift value for the q31_t v[3] reading. */
7071
struct {
72+
/** Timestamp delta of the reading. Unit is micro seconds. */
7173
uint32_t timestamp_delta;
7274
union {
75+
/**
76+
* 3D vector of the reading represented as an array.
77+
* For SENSING_SENSOR_TYPE_MOTION_ACCELEROMETER_3D and
78+
* SENSING_SENSOR_TYPE_MOTION_UNCALIB_ACCELEROMETER_3D,
79+
* the unit is Gs (gravitational force).
80+
* For SENSING_SENSOR_TYPE_MOTION_GYROMETER_3D, the unit is degrees.
81+
*/
7382
q31_t v[3];
7483
struct {
75-
q31_t x;
76-
q31_t y;
77-
q31_t z;
84+
q31_t x; /**< X value of the 3D vector. */
85+
q31_t y; /**< Y value of the 3D vector. */
86+
q31_t z; /**< Z value of the 3D vector. */
7887
};
7988
};
80-
} readings[1];
89+
} readings[1]; /**< Array of readings. */
8190
};
8291

8392
/**
@@ -86,11 +95,17 @@ struct sensing_sensor_value_3d_q31 {
8695
* uint32_t version
8796
*/
8897
struct sensing_sensor_value_uint32 {
98+
/** Header of the sensor value data structure. */
8999
struct sensing_sensor_value_header header;
90100
struct {
101+
/** Timestamp delta of the reading. Unit is micro seconds. */
91102
uint32_t timestamp_delta;
103+
/**
104+
* Value of the reading.
105+
* For SENSING_SENSOR_TYPE_LIGHT_AMBIENTLIGHT, the unit is luxs.
106+
*/
92107
uint32_t v;
93-
} readings[1];
108+
} readings[1]; /**< Array of readings. */
94109
};
95110

96111
/**
@@ -99,15 +114,20 @@ struct sensing_sensor_value_uint32 {
99114
* q31 version
100115
*/
101116
struct sensing_sensor_value_q31 {
117+
/** Header of the sensor value data structure. */
102118
struct sensing_sensor_value_header header;
103-
int8_t shift;
119+
int8_t shift; /**< The shift value for the q31_t v reading. */
104120
struct {
121+
/** Timestamp delta of the reading. Unit is micro seconds. */
105122
uint32_t timestamp_delta;
123+
/**
124+
* Value of the reading.
125+
* For SENSING_SENSOR_TYPE_MOTION_HINGE_ANGLE, the unit is degrees.
126+
*/
106127
q31_t v;
107-
} readings[1];
128+
} readings[1]; /**< Array of readings. */
108129
};
109130

110-
111131
/**
112132
* @}
113133
*/

0 commit comments

Comments
 (0)