Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
opt4048.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Darshan Maru <darshanmaru1411@gmail.com>
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
14
15#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_OPT4048_H_
16#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_OPT4048_H_
17
18#include <stdint.h>
19#include <zephyr/device.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
33#define OPT4048_FLAG_L 0x01
35#define OPT4048_FLAG_H 0x02
37#define OPT4048_FLAG_CONVERSION_READY 0x04
39#define OPT4048_FLAG_OVERLOAD 0x08
41
74
120
143
162
178
220
264
279int opt4048_get_flags(const struct device *dev, uint8_t *flags);
280
281#ifdef __cplusplus
282}
283#endif
284
285#endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_OPT4048_H_ */
APIs and macros for the Zephyr device model.
@ SENSOR_ATTR_PRIV_START
This and higher values are sensor specific.
Definition sensor.h:452
@ SENSOR_CHAN_PRIV_START
This and higher values are sensor specific.
Definition sensor.h:253
int opt4048_get_flags(const struct device *dev, uint8_t *flags)
Read the status flags of the OPT4048.
opt4048_fault_count
Number of consecutive faults required to set the threshold flags.
Definition opt4048.h:149
@ OPT4048_FAULT_COUNT_8
8 consecutive faults.
Definition opt4048.h:160
@ OPT4048_FAULT_COUNT_4
4 consecutive faults.
Definition opt4048.h:157
@ OPT4048_FAULT_COUNT_1
1 fault.
Definition opt4048.h:151
@ OPT4048_FAULT_COUNT_2
2 consecutive faults.
Definition opt4048.h:154
opt4048_conversion_time
Conversion time per channel of the OPT4048.
Definition opt4048.h:83
@ OPT4048_CONVERSION_TIME_6_5MS
6.5 milliseconds.
Definition opt4048.h:97
@ OPT4048_CONVERSION_TIME_25MS
25 milliseconds.
Definition opt4048.h:103
@ OPT4048_CONVERSION_TIME_200MS
200 milliseconds.
Definition opt4048.h:112
@ OPT4048_CONVERSION_TIME_12_7MS
12.7 milliseconds.
Definition opt4048.h:100
@ OPT4048_CONVERSION_TIME_1MS
1 millisecond.
Definition opt4048.h:88
@ OPT4048_CONVERSION_TIME_600US
600 microseconds.
Definition opt4048.h:85
@ OPT4048_CONVERSION_TIME_1_8MS
1.8 milliseconds.
Definition opt4048.h:91
@ OPT4048_CONVERSION_TIME_50MS
50 milliseconds.
Definition opt4048.h:106
@ OPT4048_CONVERSION_TIME_800MS
800 milliseconds.
Definition opt4048.h:118
@ OPT4048_CONVERSION_TIME_400MS
400 milliseconds.
Definition opt4048.h:115
@ OPT4048_CONVERSION_TIME_3_4MS
3.4 milliseconds.
Definition opt4048.h:94
@ OPT4048_CONVERSION_TIME_100MS
100 milliseconds.
Definition opt4048.h:109
opt4048_mode
Operating mode of the OPT4048.
Definition opt4048.h:130
@ OPT4048_MODE_POWERDOWN
Power-down, no measurements.
Definition opt4048.h:132
@ OPT4048_MODE_AUTO_ONESHOT
Forced auto-range one-shot.
Definition opt4048.h:135
@ OPT4048_MODE_ONESHOT
One-shot.
Definition opt4048.h:138
@ OPT4048_MODE_CONTINUOUS
Continuous.
Definition opt4048.h:141
sensor_attribute_opt4048
Driver-specific sensor attribute identifiers for the OPT4048.
Definition opt4048.h:233
@ SENSOR_ATTR_OPT4048_INT_LATCH
Interrupt latch: 1 = latched window mode, 0 = transparent hysteresis.
Definition opt4048.h:247
@ SENSOR_ATTR_OPT4048_INT_DIRECTION
INT pin direction: 1 = output, 0 = input (hardware one-shot trigger).
Definition opt4048.h:253
@ SENSOR_ATTR_OPT4048_THRESHOLD_CHANNEL
Channel (0 to 3) used by the threshold logic.
Definition opt4048.h:259
@ SENSOR_ATTR_OPT4048_RANGE
Full-scale range, see opt4048_range.
Definition opt4048.h:235
@ SENSOR_ATTR_OPT4048_MODE
Operating mode, see opt4048_mode.
Definition opt4048.h:241
@ SENSOR_ATTR_OPT4048_FAULT_COUNT
Consecutive fault count, see opt4048_fault_count.
Definition opt4048.h:244
@ SENSOR_ATTR_OPT4048_CONVERSION_TIME
Conversion time per channel, see opt4048_conversion_time.
Definition opt4048.h:238
@ SENSOR_ATTR_OPT4048_INT_CONFIG
INT pin function, see opt4048_int_cfg.
Definition opt4048.h:256
@ SENSOR_ATTR_OPT4048_INT_POLARITY
INT pin polarity: 0 = active low, 1 = active high.
Definition opt4048.h:250
@ SENSOR_ATTR_OPT4048_QUICK_WAKE
Quick wake-up from standby in one-shot modes: 1 = enabled.
Definition opt4048.h:262
opt4048_int_cfg
Function of the INT pin of the OPT4048.
Definition opt4048.h:168
@ OPT4048_INT_CFG_SMBUS_ALERT
Threshold interrupt / SMBus alert.
Definition opt4048.h:170
@ OPT4048_INT_CFG_DATA_READY_ALL
Pulse after all four channels were converted.
Definition opt4048.h:176
@ OPT4048_INT_CFG_DATA_READY_NEXT
Pulse after every channel conversion.
Definition opt4048.h:173
sensor_channel_opt4048
Driver-specific sensor channel identifiers for the OPT4048.
Definition opt4048.h:189
@ SENSOR_CHAN_OPT4048_CIE_X
CIE 1931 chromaticity coordinate x (0 to 1).
Definition opt4048.h:212
@ SENSOR_CHAN_OPT4048_Y
CIE tristimulus Y, computed with the conversion matrix.
Definition opt4048.h:206
@ SENSOR_CHAN_OPT4048_RAW_CH2
CH2 (Z filter, peak 460 nm), linearised ADC codes.
Definition opt4048.h:197
@ SENSOR_CHAN_OPT4048_RAW_CH3
CH3 (W wide band channel), linearised ADC codes.
Definition opt4048.h:200
@ SENSOR_CHAN_OPT4048_RAW_CH1
CH1 (Y filter, peak 550 nm), linearised ADC codes.
Definition opt4048.h:194
@ SENSOR_CHAN_OPT4048_RAW_CH0
CH0 (X filter, peak 600 nm), linearised ADC codes.
Definition opt4048.h:191
@ SENSOR_CHAN_OPT4048_CCT
Correlated color temperature (CCT), in Kelvin.
Definition opt4048.h:218
@ SENSOR_CHAN_OPT4048_CIE_Y
CIE 1931 chromaticity coordinate y (0 to 1).
Definition opt4048.h:215
@ SENSOR_CHAN_OPT4048_Z
CIE tristimulus Z, computed with the conversion matrix.
Definition opt4048.h:209
@ SENSOR_CHAN_OPT4048_X
CIE tristimulus X, computed with the conversion matrix.
Definition opt4048.h:203
opt4048_range
Full-scale light range of the OPT4048.
Definition opt4048.h:49
@ OPT4048_RANGE_4K_LUX
4.5 klux full-scale range.
Definition opt4048.h:54
@ OPT4048_RANGE_9K_LUX
9 klux full-scale range.
Definition opt4048.h:57
@ OPT4048_RANGE_72K_LUX
72 klux full-scale range.
Definition opt4048.h:66
@ OPT4048_RANGE_2K_LUX
2.2 klux full-scale range.
Definition opt4048.h:51
@ OPT4048_RANGE_18K_LUX
18 klux full-scale range.
Definition opt4048.h:60
@ OPT4048_RANGE_36K_LUX
36 klux full-scale range.
Definition opt4048.h:63
@ OPT4048_RANGE_AUTO
Automatic range selection.
Definition opt4048.h:72
@ OPT4048_RANGE_144K_LUX
144 klux full-scale range.
Definition opt4048.h:69
flags
Definition parser.h:86
Main header file for sensor driver API.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:607