1 /* 2 * Copyright (c) 2019 Actinius 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_DRIVERS_SENSOR_OPT3001_H_ 8 #define ZEPHYR_DRIVERS_SENSOR_OPT3001_H_ 9 10 #include <zephyr/sys/util.h> 11 #include <zephyr/drivers/i2c.h> 12 13 #define OPT3001_REG_RESULT 0x00 14 #define OPT3001_REG_CONFIG 0x01 15 #define OPT3001_REG_MANUFACTURER_ID 0x7E 16 #define OPT3001_REG_DEVICE_ID 0x7F 17 18 #define OPT3001_MANUFACTURER_ID_VALUE 0x5449 19 #define OPT3001_DEVICE_ID_VALUE 0x3001 20 21 #define OPT3001_CONVERSION_MODE_MASK (BIT(10) | BIT(9)) 22 #define OPT3001_CONVERSION_MODE_CONTINUOUS (BIT(10) | BIT(9)) 23 24 #define OPT3001_SAMPLE_EXPONENT_SHIFT 12 25 #define OPT3001_MANTISSA_MASK 0xfff 26 27 struct opt3001_data { 28 uint16_t sample; 29 }; 30 31 struct opt3001_config { 32 struct i2c_dt_spec i2c; 33 }; 34 35 #endif /* _SENSOR_OPT3001_ */ 36