@@ -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,117 @@ 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.
66
74
*/
67
75
#define SENSING_SENSOR_FLAG_REPORT_ON_EVENT BIT(0)
68
76
69
77
/**
70
- * @brief Sensor flag indicating if this sensor is on change reporting data.
78
+ * @brief Sensor flag indicating if this sensor is reporting data on change .
71
79
*
72
80
* Reporting sensor data when the sensor data changes.
73
81
*
74
- * Exclusive with \ref SENSING_SENSOR_FLAG_REPORT_ON_EVENT
82
+ * @note Mutually exclusive with \ref SENSING_SENSOR_FLAG_REPORT_ON_EVENT
75
83
*/
76
84
#define SENSING_SENSOR_FLAG_REPORT_ON_CHANGE BIT(1)
77
85
86
+ /** @} */
87
+
78
88
/**
79
- * @brief SENSING_SENSITIVITY_INDEX_ALL indicating sensitivity of each data field should be set
89
+ * @brief Sentinel index meaning "apply to all data fields".
80
90
*
91
+ * Used with sensitivity configuration where a sensor provides multiple fields in a single sample.
81
92
*/
82
93
#define SENSING_SENSITIVITY_INDEX_ALL -1
83
94
84
95
/**
85
- * @brief Sensing subsystem sensor state.
96
+ * @brief Sensor state.
86
97
*
98
+ * This enumeration defines the possible states of a sensor.
87
99
*/
88
100
enum sensing_sensor_state {
89
101
SENSING_SENSOR_STATE_READY = 0 , /**< The sensor is ready. */
90
102
SENSING_SENSOR_STATE_OFFLINE = 1 , /**< The sensor is offline. */
91
103
};
92
104
93
105
/**
94
- * @brief Sensing subsystem sensor config attribute
106
+ * @brief Sensor configuration attribute.
95
107
*
108
+ * This enumeration defines the possible attributes of a sensor configuration.
96
109
*/
97
110
enum sensing_sensor_attribute {
98
- /** The interval attribute of a sensor configuration. */
111
+ /**
112
+ * Reporting interval between samples, in microseconds (us).
113
+ *
114
+ * See @ref sensing_sensor_config::interval.
115
+ */
99
116
SENSING_SENSOR_ATTRIBUTE_INTERVAL = 0 ,
100
- /** The sensitivity attribute of a sensor configuration. */
117
+
118
+ /**
119
+ * Per-field sensitivity threshold.
120
+ *
121
+ * See @ref sensing_sensor_config::sensitivity.
122
+ */
101
123
SENSING_SENSOR_ATTRIBUTE_SENSITIVITY = 1 ,
102
- /** The latency attribute of a sensor configuration. */
124
+
125
+ /**
126
+ * Maximum batching latency, in microseconds (us).
127
+ *
128
+ * See @ref sensing_sensor_config::latency.
129
+ */
103
130
SENSING_SENSOR_ATTRIBUTE_LATENCY = 2 ,
104
- /** The maximum number of attributes that a sensor configuration can have. */
131
+
132
+ /** Number of supported attributes. */
105
133
SENSING_SENSOR_ATTRIBUTE_MAX ,
106
134
};
107
135
108
136
/**
109
- * @brief Define Sensing subsystem sensor handle
137
+ * @brief Opaque handle to an opened sensor instance.
110
138
*
139
+ * A valid handle is obtained from @ref sensing_open_sensor or @ref sensing_open_sensor_by_dt and
140
+ * must be closed with @ref sensing_close_sensor when no longer needed.
111
141
*/
112
142
typedef void * sensing_sensor_handle_t ;
113
143
114
144
/**
115
- * @brief Sensor data event receive callback.
145
+ * @brief Data event callback signature .
116
146
*
117
- * @param handle The sensor instance handle.
118
- * @param buf The data buffer with sensor data.
119
- * @param context User provided context pointer.
147
+ * The Sensing subsystem invokes this callback to deliver buffered samples for the opened sensor.
148
+ *
149
+ * @param handle Sensor instance handle passed to @ref sensing_open_sensor.
150
+ * @param buf Pointer to a sensor-type-specific sample buffer; see @ref sensing_datatypes and
151
+ * @ref sensing_sensor_types.
152
+ * @param context User context pointer as provided in @ref sensing_callback_list::context.
120
153
*/
121
154
typedef void (* sensing_data_event_t )(
122
155
sensing_sensor_handle_t handle ,
123
156
const void * buf ,
124
157
void * context );
125
158
126
159
/**
127
- * @struct sensing_sensor_info
128
- * @brief Sensor basic constant information
129
- *
160
+ * @brief Read-only description of a sensor instance.
130
161
*/
131
162
struct sensing_sensor_info {
132
163
/** Name of the sensor instance */
@@ -153,9 +184,13 @@ struct sensing_sensor_info {
153
184
* @brief Sensing subsystem event callback list
154
185
*
155
186
*/
187
+
188
+ /**
189
+ * @brief Callback registration for a sensor instance.
190
+ */
156
191
struct sensing_callback_list {
157
192
sensing_data_event_t on_data_event ; /**< Callback function for a sensor data event. */
158
- void * context ; /**< Associated context with on_data_event */
193
+ void * context ; /**< Context that will be passed to the callback. */
159
194
};
160
195
161
196
/**
0 commit comments