API Reference
adafruit_tcs3430
CircuitPython driver library for AMS TCS3430 / TCS34303 XYZ tri-stimulus color sensor.
Author(s): Tim Cocks
Implementation Notes
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
# * Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice # * Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
- class adafruit_tcs3430.ALSGain
ALS gain settings for CFG1 register bits 1:0.
Setting
Gain
ALSGain.GAIN_1X1x gain
ALSGain.GAIN_4X4x gain
ALSGain.GAIN_16X16x gain
ALSGain.GAIN_64X64x gain
ALSGain.GAIN_128X128x gain
- class adafruit_tcs3430.CV
Constant-value helper for enum-like classes.
- class adafruit_tcs3430.InterruptPersistence
ALS interrupt persistence filter values for PERS register bits 3:0.
Setting
Description
InterruptPersistence.EVERYEvery ALS cycle
InterruptPersistence.CYCLES_11 consecutive value out of range
InterruptPersistence.CYCLES_22 consecutive values out of range
InterruptPersistence.CYCLES_33 consecutive values out of range
InterruptPersistence.CYCLES_55 consecutive values out of range
InterruptPersistence.CYCLES_1010 consecutive values out of range
InterruptPersistence.CYCLES_1515 consecutive values out of range
InterruptPersistence.CYCLES_2020 consecutive values out of range
InterruptPersistence.CYCLES_2525 consecutive values out of range
InterruptPersistence.CYCLES_3030 consecutive values out of range
InterruptPersistence.CYCLES_3535 consecutive values out of range
InterruptPersistence.CYCLES_4040 consecutive values out of range
InterruptPersistence.CYCLES_4545 consecutive values out of range
InterruptPersistence.CYCLES_5050 consecutive values out of range
InterruptPersistence.CYCLES_5555 consecutive values out of range
InterruptPersistence.CYCLES_6060 consecutive values out of range
- class adafruit_tcs3430.TCS3430(i2c_bus: I2C, address: int = _TCS3430_DEFAULT_ADDR)
CircuitPython driver for the AMS TCS3430 XYZ Color and ALS Sensor.
- Parameters:
- als_enabled
Enable/disable ALS functionality
- property als_gain: int
ALS analogue gain.
Must be an
ALSGainvalue.ALSGain.GAIN_128Xis achieved by setting the hardware gain to 64x and asserting the HGAIN bit in CFG2.ALSGain.GAIN_1XALSGain.GAIN_4XALSGain.GAIN_16XALSGain.GAIN_64XALSGain.GAIN_128X
- property als_interrupt: bool
Trueif the ALS interrupt flag is set (read-only).Use
clear_als_interrupt()to clear the flag.
- als_interrupt_enabled
Enable/disable als interrupt
- als_mux_ir2
ALS MUX setting for IR2 or X channel. True for IR2, False for X.
- property als_saturated: bool
Trueif the ALS data is saturated (read-only).Use
clear_als_saturated()to clear the flag.
- als_threshold_high
The high threshold value for ALS
- als_threshold_low
The low threshold value for ALS
- auto_zero_mode
Enable/disable auto-zero mode
- auto_zero_nth
Auto-zero interval. Run auto-zero every N measurements
- property channels: Tuple[int, int, int, int]
Read the X, Y, Z, and IR1 channels in a single burst.
If the ALS MUX is currently set to IR2 mode, it is temporarily switched back to X mode for the read and then restored.
Returns a tuple
(x, y, z, ir1)of 16-bit unsigned values.
- chip_id
Chip ID
- clear_als_interrupt() None
Clear the ALS interrupt (and all other status flags) by writing 0xFF to the STATUS register.
Note
If the threshold condition still exists and ALS is running, the interrupt will re-fire on the next integration cycle.
- integration_cycles
The number of integration cycles (1-256)
- property integration_time: float
Integration time in milliseconds.
Computed from
integration_cyclesas(cycles + 1) * 2.78. Setting this property writes the closest cycle count back to the ATIME register.
- interrupt_clear_on_read
Enable/disable interrupt clear on reading
- interrupt_persistence
Enable/disable The interrupt persistence functionality
- property ir2: int
Read the IR2 channel value.
This temporarily switches the ALS MUX to IR2, waits one integration period for fresh data, reads CH3, and restores the previous MUX setting.
- power_on
Power on/off the sensor. True for on, False for off.
- rev_id
Revision ID
- saturation_interrupt_enabled
Enable/disable saturation interrupt
- sleep_after_interrupt
Enable/disable sleep after interrupt
- wait_cycles
The number of wait cycles (1-256)
- wait_enabled
Enable/disable wait functionality
- wait_long
Enable/disable longer wait functionality. True to enable 12x time multiplier
- property wait_time: float
Wait time in milliseconds.
Computed from
wait_cyclesas(cycles + 1) * 2.78. Whenwait_longis enabled the actual wait is multiplied by 12. Setting this property writes the closest cycle count back to the WTIME register (it does not account forwait_long).