Zephyr API 3.6.99
Loading...
Searching...
No Matches
veml7700.h File Reference

Go to the source code of this file.

Macros

#define VEML7700_ALS_GAIN_ELEM_COUNT   4
 Number of enumerators in enum veml7700_als_gain.
 
#define VEML7700_ALS_IT_ELEM_COUNT   6
 Number of enumerators in enum veml7700_als_it.
 
#define VEML7700_ALS_INT_LOW_MASK   BIT(15)
 Bit mask to check for the low threshold interrupt flag.
 
#define VEML7700_ALS_INT_HIGH_MASK   BIT(14)
 Bit mask to check for the high threshold interrupt flag.
 

Enumerations

enum  veml7700_als_gain { VEML7700_ALS_GAIN_1 = 0x00 , VEML7700_ALS_GAIN_2 = 0x01 , VEML7700_ALS_GAIN_1_8 = 0x02 , VEML7700_ALS_GAIN_1_4 = 0x03 }
 VEML7700 gain options for ambient light measurements. More...
 
enum  veml7700_als_it {
  VEML7700_ALS_IT_25 , VEML7700_ALS_IT_50 , VEML7700_ALS_IT_100 , VEML7700_ALS_IT_200 ,
  VEML7700_ALS_IT_400 , VEML7700_ALS_IT_800
}
 VEML7700 integration time options for ambient light measurements. More...
 
enum  veml7700_int_mode {
  VEML7700_INT_DISABLED = 0xFF , VEML7700_ALS_PERS_1 = 0x00 , VEML7700_ALS_PERS_2 = 0x01 , VEML7700_ALS_PERS_4 = 0x02 ,
  VEML7700_ALS_PERS_8 = 0x03
}
 VEML7700 ALS interrupt persistence protect number options. More...
 
enum  sensor_attribute_veml7700 { SENSOR_ATTR_VEML7700_GAIN = SENSOR_ATTR_PRIV_START , SENSOR_ATTR_VEML7700_ITIME , SENSOR_ATTR_VEML7700_INT_MODE }
 VEML7700 specific sensor attributes. More...
 
enum  sensor_channel_veml7700 { SENSOR_CHAN_VEML7700_RAW_COUNTS = SENSOR_CHAN_PRIV_START , SENSOR_CHAN_VEML7700_WHITE_RAW_COUNTS , SENSOR_CHAN_VEML7700_INTERRUPT }
 VEML7700 specific sensor channels. More...
 

Macro Definition Documentation

◆ VEML7700_ALS_GAIN_ELEM_COUNT

#define VEML7700_ALS_GAIN_ELEM_COUNT   4

Number of enumerators in enum veml7700_als_gain.

◆ VEML7700_ALS_INT_HIGH_MASK

#define VEML7700_ALS_INT_HIGH_MASK   BIT(14)

Bit mask to check for the high threshold interrupt flag.

See SENSOR_ATTR_VEML7700_INT_MODE and SENSOR_CHAN_VEML7700_INTERRUPT

◆ VEML7700_ALS_INT_LOW_MASK

#define VEML7700_ALS_INT_LOW_MASK   BIT(15)

Bit mask to check for the low threshold interrupt flag.

See SENSOR_ATTR_VEML7700_INT_MODE and SENSOR_CHAN_VEML7700_INTERRUPT

◆ VEML7700_ALS_IT_ELEM_COUNT

#define VEML7700_ALS_IT_ELEM_COUNT   6

Number of enumerators in enum veml7700_als_it.

Enumeration Type Documentation

◆ sensor_attribute_veml7700

VEML7700 specific sensor attributes.

For high and low threshold window settings (ALS_WH and ALS_WL) use the generic attributes SENSOR_ATTR_UPPER_THRESH and SENSOR_ATTR_LOWER_THRESH with 16-bit unsigned integer values. Both threshold settings are in lux and converted by the driver to a value compatible with the sensor. This conversion depends on the current gain and integration time settings. So a change in gain or integration time usually requires an update of threshold window settings. To get the correct threshold values into the sensor update the thresholds -after- a change of gain or integration time.

All attributes must be set for the SENSOR_CHAN_LIGHT channel.

Enumerator
SENSOR_ATTR_VEML7700_GAIN 

Gain setting for ALS measurements (ALS_GAIN).

Use enum veml7700_als_gain for attribute values.

SENSOR_ATTR_VEML7700_ITIME 

Integration time setting for ALS measurements (ALS_IT).

Use enum veml7700_als_it for attribute values.

SENSOR_ATTR_VEML7700_INT_MODE 

Enable or disable use of ALS interrupt (ALS_INT_EN and ALS_PERS).

Please mind that the VEML7700 does not have an interrupt pin. That's why this driver does not implement any asynchronous notification mechanism. Such notifications would require to periodically query the sensor for it's interrupt state and then trigger an event based on that state. It's up to the user to query the interrupt state manually using sensor_channel_fetch_chan() on the SENSOR_CHAN_VEML7700_INTERRUPT channel or using sensor_channel_fetch().

Use enum veml7700_int_mode for attribute values.

◆ sensor_channel_veml7700

VEML7700 specific sensor channels.

Enumerator
SENSOR_CHAN_VEML7700_RAW_COUNTS 

Channel for raw ALS sensor values.

This channel represents the raw measurement counts provided by the sensors ALS register. It is useful for estimating the high/low threshold window attributes for the sensors interrupt handling.

You cannot fetch this channel explicitly. Instead, this channel's value is fetched implicitly using SENSOR_CHAN_LIGHT. Trying to call sensor_channel_fetch_chan() with this enumerator as an argument will result in a -ENOTSUP.

SENSOR_CHAN_VEML7700_WHITE_RAW_COUNTS 

Channel for white light sensor values.

This channel is the White Channel count output of the sensor. The white channel can be used to correct for light sources with strong infrared content in the 750-800nm spectrum.

SENSOR_CHAN_VEML7700_INTERRUPT 

This channel is used to query the ALS interrupt state (ALS_INT).

In order for this channel to provide any meaningful data you need to enable the ALS interrupt mode using the SENSOR_ATTR_VEML7700_INT_MODE custom sensor attribute.

It's important to note that the sensor resets it's interrupt state after retrieving it.

◆ veml7700_als_gain

VEML7700 gain options for ambient light measurements.

Enumerator
VEML7700_ALS_GAIN_1 
VEML7700_ALS_GAIN_2 
VEML7700_ALS_GAIN_1_8 
VEML7700_ALS_GAIN_1_4 

◆ veml7700_als_it

VEML7700 integration time options for ambient light measurements.

Enumerator
VEML7700_ALS_IT_25 
VEML7700_ALS_IT_50 
VEML7700_ALS_IT_100 
VEML7700_ALS_IT_200 
VEML7700_ALS_IT_400 
VEML7700_ALS_IT_800 

◆ veml7700_int_mode

VEML7700 ALS interrupt persistence protect number options.

Enumerator
VEML7700_INT_DISABLED 
VEML7700_ALS_PERS_1 
VEML7700_ALS_PERS_2 
VEML7700_ALS_PERS_4 
VEML7700_ALS_PERS_8