diff --git a/adafruit_vcnl4200.py b/adafruit_vcnl4200.py index f47d7b1..a3f5a46 100644 --- a/adafruit_vcnl4200.py +++ b/adafruit_vcnl4200.py @@ -150,16 +150,20 @@ class Adafruit_VCNL4200: als_persistance = RWBits(2, _ALS_CONF, 2) # ALS persistence bits als_low_threshold = UnaryStruct(_ALS_THDL, " None: self.i2c_device = I2CDevice(i2c, addr) @@ -181,8 +185,10 @@ def __init__(self, i2c: I2C, addr: int = _I2C_ADDRESS) -> None: self.als_low_threshold = 0 self.als_high_threshold = 0xFFFF self.set_interrupt(enabled=False, white_channel=False) + self.prox_duty = PS_DUTY["1_160"] self.prox_shutdown = False self.prox_integration_time = PS_IT["1T"] + self.prox_persistence = PS_PERS["1"] except Exception as error: raise RuntimeError(f"Failed to initialize: {error}") from error @@ -195,3 +201,11 @@ def set_interrupt(self, enabled, white_channel): return True except OSError: return False + + def trigger_prox(self): + """Triggers a single proximity measurement manually in active force mode.""" + try: + self._prox_trigger = True + return True + except OSError: + return False diff --git a/docs/conf.py b/docs/conf.py index 3801704..08dbfc7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,7 +25,7 @@ # Uncomment the below if you use native CircuitPython modules such as # digitalio, micropython and busio. List the modules you use. Without it, the # autodoc module docs will fail to generate with a warning. -# autodoc_mock_imports = ["digitalio", "busio"] +autodoc_mock_imports = ["busio", "adafruit_register", "adafruit_bus_device"] autodoc_preserve_defaults = True