@@ -104,6 +104,23 @@ class VEML7700:
104104 ALS_800MS ,
105105 ]
106106
107+ # Power saving mode settings
108+ PSM_500 = const (0x0 )
109+ PSM_1000 = const (0x1 )
110+ PSM_2000 = const (0x2 )
111+ PSM_4000 = const (0x3 )
112+
113+ # Power saving mode value integers
114+ psm_values = {
115+ PSM_500 : 500 ,
116+ PSM_1000 : 1000 ,
117+ PSM_2000 : 2000 ,
118+ PSM_4000 : 4000 ,
119+ }
120+
121+ # Convenience list of power saving mode settings
122+ psm_settings = [PSM_500 , PSM_1000 , PSM_2000 , PSM_4000 ]
123+
107124 # ALS - Ambient light sensor high resolution output data
108125 light = ROUnaryStruct (0x04 , "<H" )
109126 """Ambient light data.
@@ -207,6 +224,13 @@ class VEML7700:
207224 light_interrupt_low = ROBit (0x06 , 15 , register_width = 2 )
208225 """Ambient light low threshold interrupt flag. Triggered when low threshold exceeded."""
209226
227+ # Power saving register
228+ light_psm = RWBits (2 , 0x03 , 1 , register_width = 2 )
229+ """Power saving mode setting. Power saving settings are 500, 1000, 2000, 4000 ms.
230+ Settings options are: PSM_500, PSM_1000, PSM_2000, PSM_4000"""
231+ light_psm_en = RWBit (0x03 , 0 , register_width = 2 )
232+ """Power saving mode enable setting. When ``True``, power saving mode is enabled."""
233+
210234 def __init__ (self , i2c_bus : I2C , address : int = 0x10 ) -> None :
211235 self .i2c_device = i2cdevice .I2CDevice (i2c_bus , address )
212236 for _ in range (3 ):
@@ -362,3 +386,9 @@ def wait_autolux(self, wait_time: float) -> None:
362386 minimum_wait_time = self .integration_time_value () / 1000
363387 actual_wait_time = max (minimum_wait_time , wait_time )
364388 time .sleep (actual_wait_time )
389+
390+ @property
391+ def psm_value (self ) -> int :
392+ """Power saving mode value in integer form. Used for calculating refresh time."""
393+ psm = self .light_psm
394+ return self .psm_values [psm ]
0 commit comments