Line data Source code
1 1 : /* 2 : * Copyright (c) 2023 Kurtis Dinelle 3 : * 4 : * SPDX-License-Identifier: Apache-2.0 5 : */ 6 : 7 : /** 8 : * @file 9 : * @brief Extended public API for AMS's TSL2591 ambient light sensor 10 : * 11 : * This exposes attributes for the TSL2591 which can be used for 12 : * setting the on-chip gain, integration time, and persist filter parameters. 13 : */ 14 : 15 : #ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_TSL2591_H_ 16 : #define ZEPHYR_INCLUDE_DRIVERS_SENSOR_TSL2591_H_ 17 : 18 : #include <zephyr/drivers/sensor.h> 19 : 20 : #ifdef __cplusplus 21 : extern "C" { 22 : #endif 23 : 24 0 : enum sensor_attribute_tsl2591 { 25 : /* Sensor ADC Gain Mode 26 : * Rather than set this value directly, can only be set to operate in one of four modes: 27 : * 28 : * TSL2591_SENSOR_GAIN_LOW 29 : * TSL2591_SENSOR_GAIN_MED 30 : * TSL2591_SENSOR_GAIN_HIGH 31 : * TSL2591_SENSOR_GAIN_MAX 32 : * 33 : * See datasheet for actual typical gain scales these modes correspond to. 34 : */ 35 : SENSOR_ATTR_GAIN_MODE = SENSOR_ATTR_PRIV_START + 1, 36 : 37 : /* Sensor ADC Integration Time (in ms) 38 : * Can only be set to one of six values: 39 : * 40 : * 100, 200, 300, 400, 500, or 600 41 : */ 42 : SENSOR_ATTR_INTEGRATION_TIME, 43 : 44 : /* Sensor ALS Interrupt Persist Filter 45 : * Represents the number of consecutive sensor readings outside of a set threshold 46 : * before triggering an interrupt. Can only be set to one of sixteen values: 47 : * 48 : * 0, 1, 2, 3, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, or 60 49 : * 50 : * Setting this to 0 causes an interrupt to generate every ALS cycle, 51 : * regardless of threshold. 52 : * Setting this to 1 is equivalent to the no-persist interrupt mode. 53 : */ 54 : SENSOR_ATTR_INT_PERSIST 55 : }; 56 : 57 0 : enum sensor_gain_tsl2591 { 58 : TSL2591_SENSOR_GAIN_LOW, 59 : TSL2591_SENSOR_GAIN_MED, 60 : TSL2591_SENSOR_GAIN_HIGH, 61 : TSL2591_SENSOR_GAIN_MAX 62 : }; 63 : 64 : #ifdef __cplusplus 65 : } 66 : #endif 67 : 68 : #endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_TSL2591_H_ */