Qwiic_VEML_Py
Python for SFE Qwiic VEML
Loading...
Searching...
No Matches
qwiic_veml.QwiicVEML Class Reference
Inheritance diagram for qwiic_veml.QwiicVEML:

Public Member Functions

def __init__ (self, address=None, i2c_driver=None)
 Constructor. More...
 
def is_connected (self)
 Determines if this device is connected. More...
 
def begin (self)
 Initializes this device with default parameters. More...
 
def set_gain (self, gain_val)
 Sets the gain. More...
 
def read_gain (self)
 Gets the gain. More...
 
def set_integ_time (self, time)
 Sets the integration time. More...
 
def read_integ_time (self)
 Gets the integration time. More...
 
def set_protect (self, prot_val)
 Sets the persistence protect number. More...
 
def read_protect (self)
 Gets the persistence protect number. More...
 
def enable_int (self)
 Enables interrupts. More...
 
def disable_int (self)
 Disables interrupts. More...
 
def read_int_setting (self)
 Gets whether interrupts are enabled. More...
 
def shut_down (self)
 Shuts down the device. More...
 
def power_on (self)
 Powers on the device. More...
 
def enable_pow_save (self)
 Enables power saving mode. More...
 
def disable_pow_save (self)
 Disables power saving mode. More...
 
def read_pow_sav_enabled (self)
 Gets whether power saving is enabled. More...
 
def set_pow_sav_mode (self, mode_val)
 Sets the power saving mode. More...
 
def read_pow_sav_mode (self)
 Gets the power saving mode. More...
 
def read_interrupt (self)
 Gets whether an interrupt has triggered. More...
 
def set_int_low_thresh (self, lux_val)
 Sets the low threshold for interrupts. More...
 
def read_low_thresh (self)
 Gets the low threshold for interrupts. More...
 
def set_int_high_thresh (self, lux_val)
 Sets the high threshold for interrupts. More...
 
def read_high_thresh (self)
 Gets the high threshold for interrupts. More...
 
def read_light (self)
 Gets the measured ambient light in lux. More...
 
def read_white_light (self)
 Gets the measured white light in lux. More...
 

Public Attributes

 address
 

Static Public Attributes

 device_name = _DEFAULT_NAME
 
 available_addresses = _AVAILABLE_I2C_ADDRESS
 
int VEML_ENABLE = 0x01
 
int VEML_DISABLE = 0x00
 
int VEML_SHUTDOWN = 0x01
 
int VEML_POWER = 0x00
 
int VEML_NO_INT = 0x00
 
int VEML_INT_HIGH = 0x01
 
int VEML_INT_LOW = 0x02
 
int VEML_UNKNOWN_ERROR = 0xFF
 
int VEML_SETTING_REG = 0x00
 
int VEML_H_THRESH_REG = 0x01
 
int VEML_L_THRESH_REG = 0x02
 
int VEML_POWER_SAVE_REG = 0x03
 
int VEML_AMBIENT_LIGHT_DATA_REG = 0x04
 
int VEML_WHITE_LIGHT_DATA_REG = 0x05
 
int VEML_INTERRUPT_REG = 0x06
 
int VEML_THRESH_MASK = 0x0
 
int VEML_GAIN_MASK = 0xE7FF
 
int VEML_INTEG_MASK = 0xFC3F
 
int VEML_PERS_PROT_MASK = 0xFFCF
 
int VEML_INT_EN_MASK = 0xFFFD
 
int VEML_SD_MASK = 0xFFFE
 
int VEML_POW_SAVE_EN_MASK = 0x06
 
int VEML_POW_SAVE_MASK = 0x01
 
int VEML_INT_MASK = 0xC000
 
int VEML_NO_SHIFT = 0x00
 
int VEML_INT_EN_POS = 0x01
 
int VEML_PSM_POS = 0x01
 
int VEML_PERS_PROT_POS = 0x04
 
int VEML_INTEG_POS = 0x06
 
int VEML_GAIN_POS = 0xB
 
int VEML_INT_POS = 0xE
 
list VEML_EIGHT_HIT = [0.0036, 0.0072, 0.0288, 0.0576]
 
list VEML_FOUR_HIT = [0.0072, 0.0144, 0.0576, 0.1152]
 
list VEML_TWO_HIT = [0.0144, 0.0288, 0.1152, 0.2304]
 
list VEML_ONE_HIT = [0.0288, 0.0576, 0.2304, 0.4608]
 
list VEML_FIFTY_IT = [0.0576, 0.1152, 0.4608, 0.9216]
 
list VEML_TWENTY_FIVE_IT = [0.1152, 0.2304, 0.9216, 1.8432]
 
float VEML_GAIN_1_8 = 0.125
 
float VEML_GAIN_1_4 = 0.25
 
float VEML_GAIN_1 = 1.0
 
float VEML_GAIN_2 = 2.0
 
int VEML_INTEG_TIME_800 = 800
 
int VEML_INTEG_TIME_400 = 400
 
int VEML_INTEG_TIME_200 = 200
 
int VEML_INTEG_TIME_100 = 100
 
int VEML_INTEG_TIME_50 = 50
 
int VEML_INTEG_TIME_25 = 25
 

Properties

 connected = property(is_connected)
 

Constructor & Destructor Documentation

◆ __init__()

def qwiic_veml.QwiicVEML.__init__ (   self,
  address = None,
  i2c_driver = None 
)

Constructor.

Parameters
int,optionaladdress: The I2C address to use for the device If not provided, the default address is used
I2CDriver,optionali2c_driver: An existing i2c driver object If not provided, a driver object is created

Member Function Documentation

◆ begin()

def qwiic_veml.QwiicVEML.begin (   self)

Initializes this device with default parameters.

Returns
bool Returns True if successful, otherwise False

◆ disable_int()

def qwiic_veml.QwiicVEML.disable_int (   self)

Disables interrupts.

◆ disable_pow_save()

def qwiic_veml.QwiicVEML.disable_pow_save (   self)

Disables power saving mode.

◆ enable_int()

def qwiic_veml.QwiicVEML.enable_int (   self)

Enables interrupts.

◆ enable_pow_save()

def qwiic_veml.QwiicVEML.enable_pow_save (   self)

Enables power saving mode.

◆ is_connected()

def qwiic_veml.QwiicVEML.is_connected (   self)

Determines if this device is connected.

Returns
bool True if connected, otherwise False

◆ power_on()

def qwiic_veml.QwiicVEML.power_on (   self)

Powers on the device.

◆ read_gain()

def qwiic_veml.QwiicVEML.read_gain (   self)

Gets the gain.

Returns
float Gain, possible values: 1/8, 1/4, 1, and 2

◆ read_high_thresh()

def qwiic_veml.QwiicVEML.read_high_thresh (   self)

Gets the high threshold for interrupts.

Returns
float High threshold in lux

◆ read_int_setting()

def qwiic_veml.QwiicVEML.read_int_setting (   self)

Gets whether interrupts are enabled.

Returns
bool True if interrupts are enabled, otherwise False

◆ read_integ_time()

def qwiic_veml.QwiicVEML.read_integ_time (   self)

Gets the integration time.

Returns
int Integration time, ms

◆ read_interrupt()

def qwiic_veml.QwiicVEML.read_interrupt (   self)

Gets whether an interrupt has triggered.

Returns
int Interrupt, can be the following: VEML_NO_INT, VEML_INT_HIGH, or VEML_INT_LOW (or VEML_UNKOWN_ERROR on error)

◆ read_light()

def qwiic_veml.QwiicVEML.read_light (   self)

Gets the measured ambient light in lux.

Returns
float Measure ambient light in lux

◆ read_low_thresh()

def qwiic_veml.QwiicVEML.read_low_thresh (   self)

Gets the low threshold for interrupts.

Returns
float Low threshold in lux

◆ read_pow_sav_enabled()

def qwiic_veml.QwiicVEML.read_pow_sav_enabled (   self)

Gets whether power saving is enabled.

Returns
bool True if power saving is enabled, otherwise False

◆ read_pow_sav_mode()

def qwiic_veml.QwiicVEML.read_pow_sav_mode (   self)

Gets the power saving mode.

See datasheet for the effects of each value

Returns
int Power saving mode number, can be 1-4 (or VEML_UNKOWN_ERROR on error)

◆ read_protect()

def qwiic_veml.QwiicVEML.read_protect (   self)

Gets the persistence protect number.

Returns
int Protect number (or VEML_UNKOWN_ERROR on error)

◆ read_white_light()

def qwiic_veml.QwiicVEML.read_white_light (   self)

Gets the measured white light in lux.

Returns
float Measure white light in lux

◆ set_gain()

def qwiic_veml.QwiicVEML.set_gain (   self,
  gain_val 
)

Sets the gain.

Parameters
gain_valGain, possible values: 1/8, 1/4, 1, and 2 :type: float

◆ set_int_high_thresh()

def qwiic_veml.QwiicVEML.set_int_high_thresh (   self,
  lux_val 
)

Sets the high threshold for interrupts.

Parameters
floatlux_val: High threshold in lux

◆ set_int_low_thresh()

def qwiic_veml.QwiicVEML.set_int_low_thresh (   self,
  lux_val 
)

Sets the low threshold for interrupts.

Parameters
floatlux_val: Low threshold in lux

◆ set_integ_time()

def qwiic_veml.QwiicVEML.set_integ_time (   self,
  time 
)

Sets the integration time.

Parameters
inttime: Integration time in ms, possible values: 25, 50, 100, 200, 400, and 800

◆ set_pow_sav_mode()

def qwiic_veml.QwiicVEML.set_pow_sav_mode (   self,
  mode_val 
)

Sets the power saving mode.

See datasheet for the effects of each value

Parameters
intmode_val: Power saving mode number, can be 1-4

◆ set_protect()

def qwiic_veml.QwiicVEML.set_protect (   self,
  prot_val 
)

Sets the persistence protect number.

Parameters
intprot_val: Protect number

◆ shut_down()

def qwiic_veml.QwiicVEML.shut_down (   self)

Shuts down the device.

Member Data Documentation

◆ address

qwiic_veml.QwiicVEML.address

◆ available_addresses

qwiic_veml.QwiicVEML.available_addresses = _AVAILABLE_I2C_ADDRESS
static

◆ device_name

qwiic_veml.QwiicVEML.device_name = _DEFAULT_NAME
static

◆ VEML_AMBIENT_LIGHT_DATA_REG

int qwiic_veml.QwiicVEML.VEML_AMBIENT_LIGHT_DATA_REG = 0x04
static

◆ VEML_DISABLE

int qwiic_veml.QwiicVEML.VEML_DISABLE = 0x00
static

◆ VEML_EIGHT_HIT

list qwiic_veml.QwiicVEML.VEML_EIGHT_HIT = [0.0036, 0.0072, 0.0288, 0.0576]
static

◆ VEML_ENABLE

int qwiic_veml.QwiicVEML.VEML_ENABLE = 0x01
static

◆ VEML_FIFTY_IT

list qwiic_veml.QwiicVEML.VEML_FIFTY_IT = [0.0576, 0.1152, 0.4608, 0.9216]
static

◆ VEML_FOUR_HIT

list qwiic_veml.QwiicVEML.VEML_FOUR_HIT = [0.0072, 0.0144, 0.0576, 0.1152]
static

◆ VEML_GAIN_1

float qwiic_veml.QwiicVEML.VEML_GAIN_1 = 1.0
static

◆ VEML_GAIN_1_4

float qwiic_veml.QwiicVEML.VEML_GAIN_1_4 = 0.25
static

◆ VEML_GAIN_1_8

float qwiic_veml.QwiicVEML.VEML_GAIN_1_8 = 0.125
static

◆ VEML_GAIN_2

float qwiic_veml.QwiicVEML.VEML_GAIN_2 = 2.0
static

◆ VEML_GAIN_MASK

int qwiic_veml.QwiicVEML.VEML_GAIN_MASK = 0xE7FF
static

◆ VEML_GAIN_POS

int qwiic_veml.QwiicVEML.VEML_GAIN_POS = 0xB
static

◆ VEML_H_THRESH_REG

int qwiic_veml.QwiicVEML.VEML_H_THRESH_REG = 0x01
static

◆ VEML_INT_EN_MASK

int qwiic_veml.QwiicVEML.VEML_INT_EN_MASK = 0xFFFD
static

◆ VEML_INT_EN_POS

int qwiic_veml.QwiicVEML.VEML_INT_EN_POS = 0x01
static

◆ VEML_INT_HIGH

int qwiic_veml.QwiicVEML.VEML_INT_HIGH = 0x01
static

◆ VEML_INT_LOW

int qwiic_veml.QwiicVEML.VEML_INT_LOW = 0x02
static

◆ VEML_INT_MASK

int qwiic_veml.QwiicVEML.VEML_INT_MASK = 0xC000
static

◆ VEML_INT_POS

int qwiic_veml.QwiicVEML.VEML_INT_POS = 0xE
static

◆ VEML_INTEG_MASK

int qwiic_veml.QwiicVEML.VEML_INTEG_MASK = 0xFC3F
static

◆ VEML_INTEG_POS

int qwiic_veml.QwiicVEML.VEML_INTEG_POS = 0x06
static

◆ VEML_INTEG_TIME_100

int qwiic_veml.QwiicVEML.VEML_INTEG_TIME_100 = 100
static

◆ VEML_INTEG_TIME_200

int qwiic_veml.QwiicVEML.VEML_INTEG_TIME_200 = 200
static

◆ VEML_INTEG_TIME_25

int qwiic_veml.QwiicVEML.VEML_INTEG_TIME_25 = 25
static

◆ VEML_INTEG_TIME_400

int qwiic_veml.QwiicVEML.VEML_INTEG_TIME_400 = 400
static

◆ VEML_INTEG_TIME_50

int qwiic_veml.QwiicVEML.VEML_INTEG_TIME_50 = 50
static

◆ VEML_INTEG_TIME_800

int qwiic_veml.QwiicVEML.VEML_INTEG_TIME_800 = 800
static

◆ VEML_INTERRUPT_REG

int qwiic_veml.QwiicVEML.VEML_INTERRUPT_REG = 0x06
static

◆ VEML_L_THRESH_REG

int qwiic_veml.QwiicVEML.VEML_L_THRESH_REG = 0x02
static

◆ VEML_NO_INT

int qwiic_veml.QwiicVEML.VEML_NO_INT = 0x00
static

◆ VEML_NO_SHIFT

int qwiic_veml.QwiicVEML.VEML_NO_SHIFT = 0x00
static

◆ VEML_ONE_HIT

list qwiic_veml.QwiicVEML.VEML_ONE_HIT = [0.0288, 0.0576, 0.2304, 0.4608]
static

◆ VEML_PERS_PROT_MASK

int qwiic_veml.QwiicVEML.VEML_PERS_PROT_MASK = 0xFFCF
static

◆ VEML_PERS_PROT_POS

int qwiic_veml.QwiicVEML.VEML_PERS_PROT_POS = 0x04
static

◆ VEML_POW_SAVE_EN_MASK

int qwiic_veml.QwiicVEML.VEML_POW_SAVE_EN_MASK = 0x06
static

◆ VEML_POW_SAVE_MASK

int qwiic_veml.QwiicVEML.VEML_POW_SAVE_MASK = 0x01
static

◆ VEML_POWER

int qwiic_veml.QwiicVEML.VEML_POWER = 0x00
static

◆ VEML_POWER_SAVE_REG

int qwiic_veml.QwiicVEML.VEML_POWER_SAVE_REG = 0x03
static

◆ VEML_PSM_POS

int qwiic_veml.QwiicVEML.VEML_PSM_POS = 0x01
static

◆ VEML_SD_MASK

int qwiic_veml.QwiicVEML.VEML_SD_MASK = 0xFFFE
static

◆ VEML_SETTING_REG

int qwiic_veml.QwiicVEML.VEML_SETTING_REG = 0x00
static

◆ VEML_SHUTDOWN

int qwiic_veml.QwiicVEML.VEML_SHUTDOWN = 0x01
static

◆ VEML_THRESH_MASK

int qwiic_veml.QwiicVEML.VEML_THRESH_MASK = 0x0
static

◆ VEML_TWENTY_FIVE_IT

list qwiic_veml.QwiicVEML.VEML_TWENTY_FIVE_IT = [0.1152, 0.2304, 0.9216, 1.8432]
static

◆ VEML_TWO_HIT

list qwiic_veml.QwiicVEML.VEML_TWO_HIT = [0.0144, 0.0288, 0.1152, 0.2304]
static

◆ VEML_UNKNOWN_ERROR

int qwiic_veml.QwiicVEML.VEML_UNKNOWN_ERROR = 0xFF
static

◆ VEML_WHITE_LIGHT_DATA_REG

int qwiic_veml.QwiicVEML.VEML_WHITE_LIGHT_DATA_REG = 0x05
static

Property Documentation

◆ connected

qwiic_veml.QwiicVEML.connected = property(is_connected)
static

The documentation for this class was generated from the following file: