@@ -32,7 +32,6 @@ extern "C" {
32
32
#endif
33
33
34
34
/**
35
- * @struct sensing_sensor_version
36
35
* @brief Sensor Version
37
36
*/
38
37
struct sensing_sensor_version {
@@ -48,85 +47,119 @@ struct sensing_sensor_version {
48
47
};
49
48
50
49
/**
51
- * @brief Macro to create a sensor version value.
50
+ * @brief Build a packed @ref sensing_sensor_version value.
52
51
*
52
+ * @param _major Major version.
53
+ * @param _minor Minor version.
54
+ * @param _hotfix Hotfix version.
55
+ * @param _build Build number.
56
+ * @return 32-bit packed version value
53
57
*/
54
58
#define SENSING_SENSOR_VERSION (_major , _minor , _hotfix , _build ) \
55
59
(FIELD_PREP(GENMASK(31, 24), _major) | \
56
60
FIELD_PREP(GENMASK(23, 16), _minor) | \
57
61
FIELD_PREP(GENMASK(15, 8), _hotfix) | \
58
62
FIELD_PREP(GENMASK(7, 0), _build))
59
63
64
+ /**
65
+ * @name Sensor reporting flags
66
+ * @{
67
+ */
60
68
61
69
/**
62
- * @brief Sensor flag indicating if this sensor is on event reporting data.
70
+ * @brief Sensor flag indicating if this sensor is reporting data on event .
63
71
*
64
72
* Reporting sensor data when the sensor event occurs, such as a motion detect sensor reporting
65
73
* a motion or motionless detected event.
74
+ *
75
+ * @note Mutually exclusive with \ref SENSING_SENSOR_FLAG_REPORT_ON_CHANGE
66
76
*/
67
77
#define SENSING_SENSOR_FLAG_REPORT_ON_EVENT BIT(0)
68
78
69
79
/**
70
- * @brief Sensor flag indicating if this sensor is on change reporting data.
80
+ * @brief Sensor flag indicating if this sensor is reporting data on change .
71
81
*
72
82
* Reporting sensor data when the sensor data changes.
73
83
*
74
- * Exclusive with \ref SENSING_SENSOR_FLAG_REPORT_ON_EVENT
84
+ * @note Mutually exclusive with \ref SENSING_SENSOR_FLAG_REPORT_ON_EVENT
75
85
*/
76
86
#define SENSING_SENSOR_FLAG_REPORT_ON_CHANGE BIT(1)
77
87
88
+ /** @} */
89
+
78
90
/**
79
- * @brief SENSING_SENSITIVITY_INDEX_ALL indicating sensitivity of each data field should be set
91
+ * @brief Sentinel index meaning "apply to all data fields".
80
92
*
93
+ * Used with sensitivity configuration where a sensor provides multiple fields in a single sample.
81
94
*/
82
95
#define SENSING_SENSITIVITY_INDEX_ALL -1
83
96
84
97
/**
85
- * @brief Sensing subsystem sensor state.
98
+ * @brief Sensor state.
86
99
*
100
+ * This enumeration defines the possible states of a sensor.
87
101
*/
88
102
enum sensing_sensor_state {
89
103
SENSING_SENSOR_STATE_READY = 0 , /**< The sensor is ready. */
90
104
SENSING_SENSOR_STATE_OFFLINE = 1 , /**< The sensor is offline. */
91
105
};
92
106
93
107
/**
94
- * @brief Sensing subsystem sensor config attribute
108
+ * @brief Sensor configuration attribute.
95
109
*
110
+ * This enumeration defines the possible attributes of a sensor configuration.
96
111
*/
97
112
enum sensing_sensor_attribute {
98
- /** The interval attribute of a sensor configuration. */
113
+ /**
114
+ * Reporting interval between samples, in microseconds (us).
115
+ *
116
+ * See @ref sensing_sensor_config::interval.
117
+ */
99
118
SENSING_SENSOR_ATTRIBUTE_INTERVAL = 0 ,
100
- /** The sensitivity attribute of a sensor configuration. */
119
+
120
+ /**
121
+ * Per-field sensitivity threshold.
122
+ *
123
+ * See @ref sensing_sensor_config::sensitivity.
124
+ */
101
125
SENSING_SENSOR_ATTRIBUTE_SENSITIVITY = 1 ,
102
- /** The latency attribute of a sensor configuration. */
126
+
127
+ /**
128
+ * Maximum batching latency, in microseconds (us).
129
+ *
130
+ * See @ref sensing_sensor_config::latency.
131
+ */
103
132
SENSING_SENSOR_ATTRIBUTE_LATENCY = 2 ,
104
- /** The maximum number of attributes that a sensor configuration can have. */
133
+
134
+ /** Number of supported attributes. */
105
135
SENSING_SENSOR_ATTRIBUTE_MAX ,
106
136
};
107
137
108
138
/**
109
- * @brief Define Sensing subsystem sensor handle
139
+ * @brief Opaque handle to an opened sensor instance.
110
140
*
141
+ * A valid handle is obtained from @ref sensing_open_sensor or @ref sensing_open_sensor_by_dt and
142
+ * must be closed with @ref sensing_close_sensor when no longer needed.
111
143
*/
112
144
typedef void * sensing_sensor_handle_t ;
113
145
114
146
/**
115
- * @brief Sensor data event receive callback.
147
+ * @brief Data event callback signature .
116
148
*
117
- * @param handle The sensor instance handle.
118
- * @param buf The data buffer with sensor data.
119
- * @param context User provided context pointer.
149
+ * The Sensing subsystem invokes this callback to deliver buffered samples for the opened sensor.
150
+ *
151
+ * @param handle Sensor instance handle passed to @ref sensing_open_sensor.
152
+ * @param buf Pointer to a sensor-type-specific sample buffer; see @ref sensing_datatypes and
153
+ * @ref sensing_sensor_types.
154
+ * @param context User context pointer as provided in @ref sensing_callback_list::context.
120
155
*/
121
156
typedef void (* sensing_data_event_t )(
122
157
sensing_sensor_handle_t handle ,
123
158
const void * buf ,
124
159
void * context );
125
160
126
161
/**
127
- * @struct sensing_sensor_info
128
- * @brief Sensor basic constant information
129
- *
162
+ * @brief Read-only description of a sensor instance.
130
163
*/
131
164
struct sensing_sensor_info {
132
165
/** Name of the sensor instance */
@@ -153,9 +186,13 @@ struct sensing_sensor_info {
153
186
* @brief Sensing subsystem event callback list
154
187
*
155
188
*/
189
+
190
+ /**
191
+ * @brief Callback registration for a sensor instance.
192
+ */
156
193
struct sensing_callback_list {
157
194
sensing_data_event_t on_data_event ; /**< Callback function for a sensor data event. */
158
- void * context ; /**< Associated context with on_data_event */
195
+ void * context ; /**< Context that will be passed to the callback. */
159
196
};
160
197
161
198
/**
0 commit comments