SI114X Class
- ID: si114x
- Name: UV/IR/visible Light Sensor
- Other Names: SI1146, SI1147
- Category: light
- Manufacturer: adafruit
- Link: https://www.adafruit.com/products/1777
- Connection: i2c
This module was tested with the Adafruit* UV Light Sensor
This device is capable of measuring IR and visible ambient light as well. It also supports the ability to use externally attached LEDs to perform proximity detection on 3 separate channels.
Currently, this class only supports the retrieving of the calculated UV index measured by the device, but enough infrastructure is provided to make it easy to enhance this driver in the future to support additional capabilities, including interrupt support.
Item Index
Methods
Properties
- REG_PART_ID
- REG_REV_ID
- REG_SEQ_ID
- REG_INT_CFG
- REG_IRQ_ENABLE
- REG_IRQ_MODE1
- REG_IRQ_MODE2
- REG_HW_KEY
- REG_MEAS_RATE0
- REG_MEAS_RATE1
- REG_PS_LED21
- REG_PS_LED3
- REG_UCOEF0
- REG_UCOEF1
- REG_UCOEF2
- REG_UCOEF3
- REG_PARAM_WR
- REG_COMMAND
- REG_RESPONSE
- REG_IRQ_STATUS
- REG_ALS_VIS_DATA0
- REG_ALS_VIS_DATA1
- REG_ALS_IR_DATA0
- REG_ALS_IR_DATA1
- REG_PS1_DATA0
- REG_PS1_DATA1
- REG_PS2_DATA0
- REG_PS2_DATA1
- REG_PS3_DATA0
- REG_PS3_DATA1
- REG_AUX_UVINDEX0
- REG_AUX_UVINDEX1
- REG_PARAM_READ
- REG_CHIP_STAT
- REG_ANA_IN_KEY0
- REG_ANA_IN_KEY1
- REG_ANA_IN_KEY2
- REG_ANA_IN_KEY3
- PARAM_I2C_ADDDR
- PARAM_CHLIST
- PARAM_PSLED12_SEL
- PARAM_PSLED3_SEL
- PARAM_PS_ENCODING
- PARAM_ALS_ENCODING
- PARAM_PS1_ADCMUX
- PARAM_PS2_ADCMUX
- PARAM_PS3_ADCMUX
- PARAM_PS_ADC_COUNT
- PARAM_PS_ADC_GAIN
- PARAM_PS_ADC_MISC
- PARAM_ALS_IR_ADCMUX
- PARAM_AUX_ADCMUX
- PARAM_ALS_VIS_ADC_COUNT
- PARAM_ALS_VIS_ADC_GAIN
- PARAM_ALS_VIS_ADC_MISC
- PARAM_LED_REC
- PARAM_ALS_IR_ADC_COUNT
- PARAM_ALS_IR_ADX_GAIN
- PARAM_ALS_IR_ADC_MISC
- CMD_NOOP
- CMD_RESET
- CMD_BUSADDR
- CMD_PS_FORCE
- CMD_GET_CAL
- CMD_ALS_FORCE
- CMD_PSALS_FORCE
- CMD_PS_PAUSE
- CMD_ALS_PAUSE
- CMD_PSALS_PAUSE
- CMD_PS_AUTO
- CMD_ALS_AUTO
- CMD_PSALS_AUTO
- CMD_PARAM_QUERY
- CMD_PARAM_SET
- CHLIST_EN_PS1
- CHLIST_EN_PS2
- CHLIST_EN_PS3
- CHLIST_EN_ALS_VIS
- CHLIST_EN_ALS_IR
- CHLIST_EN_AUX
- CHLIST_EN_UV
- ERR_NONE
- ERR_INVALID_SET
- ERR_PS1_ADC_OVER
- ERR_PS2_ADC_OVER
- ERR_PS3_ADC_OVER
- ERR_ALS_VIS_ADC_OVER
- ERR_ALS_IR_ADC_OVER
- ERR_AUX_ADC_OVER
- IRQEN_ALS_IE
- IRQEN_PS1_IE
- IRQEN_PS2_IE
- IRQEN_PS3_IE
Methods
SI114X
-
bus
-
address
SI114X constructor
Parameters:
-
bus
NumberI2C bus to use
-
address
NumberAddress for this device
Returns:
writeByte
-
reg
-
byte
Writes a byte value into a register
Parameters:
-
reg
NumberRegister location to write into
-
byte
NumberByte to write
Returns:
True if successful
readByte
-
reg
Reads a byte value from a register
Parameters:
-
reg
NumberRegister location to read from
Returns:
Value in a specified register
readWord
-
reg
Reads a word value from a register
Parameters:
-
reg
NumberRegister location to read from
Returns:
Value in a specified register
reset
()
Disables interrupts and auto-measuring, issues a device reset, and then sets the hardware key.
setUVCalibration
-
uvcoeff0
-
uvcoeff1
-
uvcoeff2
-
uvcoeff3
Sets UV calibration values. The constructor sets default values for you, so you only need this function if you need different values for your device and situation. If you set new values here, be sure to do so before calling initialize() .
Parameters:
-
uvcoeff0
NumberCoefficient for REG_UCOEF0
-
uvcoeff1
NumberCoefficient for REG_UCOEF1
-
uvcoeff2
NumberCoefficient for REG_UCOEF2
-
uvcoeff3
NumberCoefficient for REG_UCOEF3
writeParam
-
param
-
value
Writes a value to the parameter memory.
Parameters:
-
param
SI114X_PARAM_TSI114X_PARAM_T register to write
-
value
NumberValue to write
readParam
-
param
Reads a value from the parameter memory
Parameters:
-
param
SI114X_PARAM_TSI114X_PARAM_T register to read
Returns:
Value
initialize
()
Resets and initializes the device and starts auto-sampling
update
()
Updates stored values. You should call this before calling getUVIndex()
getUVIndex
()
Number
Reads the currently measured UV index value
Returns:
UV index value