Skip to content

Commit 453cba7

Browse files
committed
include: drivers: sensor: improve docs for veml6031
complete doxygen docs for this sensor Signed-off-by: Benjamin Cabé <[email protected]>
1 parent 2e48903 commit 453cba7

File tree

1 file changed

+63
-46
lines changed

1 file changed

+63
-46
lines changed

include/zephyr/drivers/sensor/veml6031.h

Lines changed: 63 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,89 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_VEML6031_H_
8-
#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_VEML6031_H_
9-
10-
#ifdef __cplusplus
11-
extern "C" {
12-
#endif
13-
147
/**
15-
* @brief ALS integration time settings in veml6031_it
8+
* @file
9+
* @brief Header file for extended sensor API of VEML6031 sensor
10+
* @ingroup veml6031_interface
1611
*/
17-
#define VEML6031_IT_COUNT 8
1812

19-
/**
20-
* @brief Effective photodiode size in enum veml6031_size.
21-
*/
22-
#define VEML6031_DIV4_COUNT 2
13+
#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_VEML6031_H_
14+
#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_VEML6031_H_
2315

2416
/**
25-
* @brief Gain selections in enum veml6031_gain.
17+
* @defgroup veml6031_interface VEML6031
18+
* @ingroup sensor_interface_ext
19+
* @brief Vishay VEML6031 High Accuracy Ambient Light Sensor
20+
* @{
2621
*/
27-
#define VEML6031_GAIN_COUNT 4
22+
23+
#ifdef __cplusplus
24+
extern "C" {
25+
#endif
2826

2927
/**
3028
* @brief VEML6031 integration time options for ambient light measurements.
29+
*
30+
* Possible values for @ref SENSOR_ATTR_VEML6031_IT custom attribute.
3131
*/
3232
enum veml6031_it {
33-
VEML6031_IT_3_125,
34-
VEML6031_IT_6_25,
35-
VEML6031_IT_12_5,
36-
VEML6031_IT_25,
37-
VEML6031_IT_50,
38-
VEML6031_IT_100,
39-
VEML6031_IT_200,
40-
VEML6031_IT_400,
33+
VEML6031_IT_3_125, /**< 3.125 ms */
34+
VEML6031_IT_6_25, /**< 6.25 ms */
35+
VEML6031_IT_12_5, /**< 12.5 ms */
36+
VEML6031_IT_25, /**< 25 ms */
37+
VEML6031_IT_50, /**< 50 ms */
38+
VEML6031_IT_100, /**< 100 ms */
39+
VEML6031_IT_200, /**< 200 ms */
40+
VEML6031_IT_400, /**< 400 ms */
41+
/** @cond INTERNAL_HIDDEN */
42+
VEML6031_IT_COUNT,
43+
/** @endcond */
4144
};
4245

4346
/**
4447
* @brief VEML6031 size options for ambient light measurements.
48+
*
49+
* Possible values for @ref SENSOR_ATTR_VEML6031_DIV4 custom attribute.
4550
*/
4651
enum veml6031_div4 {
47-
VEML6031_SIZE_4_4 = 0x00, /* 0b0 */
48-
VEML6031_SIZE_1_4 = 0x01, /* 0b1 */
52+
VEML6031_SIZE_4_4 = 0x00, /**< 4/4 photodiode size */
53+
VEML6031_SIZE_1_4 = 0x01, /**< 1/4 photodiode size */
54+
/** @cond INTERNAL_HIDDEN */
55+
VEML6031_DIV4_COUNT = 2,
56+
/** @endcond */
4957
};
5058

5159
/**
5260
* @brief VEML6031 gain options for ambient light measurements.
5361
*/
5462
enum veml6031_gain {
55-
VEML6031_GAIN_1 = 0x00, /* 0b00 */
56-
VEML6031_GAIN_2 = 0x01, /* 0b01 */
57-
VEML6031_GAIN_0_66 = 0x02, /* 0b10 */
58-
VEML6031_GAIN_0_5 = 0x03, /* 0b11 */
63+
VEML6031_GAIN_1 = 0x00, /**< 1x gain */
64+
VEML6031_GAIN_2 = 0x01, /**< 2x gain */
65+
VEML6031_GAIN_0_66 = 0x02, /**< 0.66x gain */
66+
VEML6031_GAIN_0_5 = 0x03, /**< 0.5x gain */
67+
/** @cond INTERNAL_HIDDEN */
68+
VEML6031_GAIN_COUNT = 4,
69+
/** @endcond */
5970
};
6071

6172
/**
6273
* @brief VEML6031 ALS interrupt persistence protect number options.
74+
*
75+
* Possible values for @ref SENSOR_ATTR_VEML6031_PERS custom attribute.
6376
*/
6477
enum veml6031_pers {
65-
VEML6031_PERS_1 = 0x00, /* 0b00 */
66-
VEML6031_PERS_2 = 0x01, /* 0b01 */
67-
VEML6031_PERS_4 = 0x02, /* 0b10 */
68-
VEML6031_PERS_8 = 0x03, /* 0b11 */
78+
VEML6031_PERS_1 = 0x00, /**< 1 measurement */
79+
VEML6031_PERS_2 = 0x01, /**< 2 measurements */
80+
VEML6031_PERS_4 = 0x02, /**< 4 measurements */
81+
VEML6031_PERS_8 = 0x03, /**< 8 measurements */
6982
};
7083

7184
/**
72-
* @brief VEML6031 specific sensor attributes.
85+
* @brief Custom sensor attributes for VEML6031 sensor.
7386
*
7487
* For high and low threshold window settings (ALS_WH_L, ALS_WH_H, ALS_WL_L and
75-
* ALS_WL_H) use the generic attributes <tt>SENSOR_ATTR_UPPER_THRESH</tt> and
76-
* <tt>SENSOR_ATTR_LOWER_THRESH</tt> with 16-bit unsigned integer values. Both
88+
* ALS_WL_H) use the generic attributes @ref SENSOR_ATTR_UPPER_THRESH and
89+
* @ref SENSOR_ATTR_LOWER_THRESH with 16-bit unsigned integer values. Both
7790
* threshold settings are in lux and converted by the driver to a value
7891
* compatible with the sensor. This conversion depends on the current gain,
7992
* integration time and effective photodiode size settings. So a change in
@@ -82,15 +95,15 @@ enum veml6031_pers {
8295
* into the sensor update the thresholds -after- a change of gain or
8396
* integration time.
8497
*
85-
* All attributes must be set for the <tt>SENSOR_CHAN_LIGHT</tt> channel.
98+
* All attributes must be set for the @ref SENSOR_CHAN_LIGHT channel.
8699
*
87-
* When the sensor goes into saturation <tt>-E2BIG</tt> is returned. This
100+
* When the sensor goes into saturation @c -E2BIG is returned. This
88101
* happens when the maximum value <tt>0xFFFF</tt> is returned as raw ALS value.
89102
* In this case it's up to the user to reduce one or more of the following
90103
* attributes to come back into the optimal measurement range of the sensor:
91-
* <tt>SENSOR_ATTR_VEML6031_GAIN</tt> (gain)
92-
* <tt>SENSOR_ATTR_VEML6031_IT</tt> (integration time)
93-
* <tt>SENSOR_ATTR_VEML6031_DIV4</tt> (effective photodiode size)
104+
* - @ref SENSOR_ATTR_VEML6031_GAIN (gain)
105+
* - @ref SENSOR_ATTR_VEML6031_IT (integration time)
106+
* - @ref SENSOR_ATTR_VEML6031_DIV4 (effective photodiode size)
94107
*/
95108
enum sensor_attribute_veml6031 {
96109
/**
@@ -120,7 +133,7 @@ enum sensor_attribute_veml6031 {
120133
};
121134

122135
/**
123-
* @brief VEML6031 specific sensor channels.
136+
* @brief Custom sensor channels for VEML6031 sensor.
124137
*/
125138
enum sensor_channel_veml6031 {
126139
/**
@@ -136,9 +149,9 @@ enum sensor_channel_veml6031 {
136149
* handling.
137150
*
138151
* It cannot be fetched directly. Instead, this channel's value is
139-
* fetched implicitly using <tt>SENSOR_CHAN_LIGHT</tt>. Trying to call
140-
* <tt>sensor_channel_fetch_chan()</tt> with this enumerator as an
141-
* argument will result in a <tt>-ENOTSUP</tt>.
152+
* fetched implicitly using @ref SENSOR_CHAN_LIGHT. Trying to call
153+
* @ref sensor_sample_fetch_chan with this enumerator as an
154+
* argument will result in a @c -ENOTSUP.
142155
*/
143156
SENSOR_CHAN_VEML6031_ALS_RAW_COUNTS = SENSOR_CHAN_PRIV_START,
144157

@@ -147,7 +160,7 @@ enum sensor_channel_veml6031 {
147160
*
148161
* This channel is the raw IR Channel count output of the sensor. About
149162
* fetching the same as for
150-
* <tt>SENSOR_CHAN_VEML6031_ALS_RAW_COUNTS</tt> applies.
163+
* @ref SENSOR_CHAN_VEML6031_ALS_RAW_COUNTS applies.
151164
*/
152165
SENSOR_CHAN_VEML6031_IR_RAW_COUNTS,
153166
};
@@ -156,4 +169,8 @@ enum sensor_channel_veml6031 {
156169
}
157170
#endif
158171

172+
/**
173+
* @}
174+
*/
175+
159176
#endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_VEML6031_H_ */

0 commit comments

Comments
 (0)