UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

SI114X Class

Module: si114x

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.
si114x.jpg

Item Index

Methods

SI114X

(
  • bus
  • address
)
Number

SI114X constructor

Parameters:

  • bus Number

    I2C bus to use

  • address Number

    Address for this device

Returns:

Number:

writeByte

(
  • reg
  • byte
)
Boolean

Writes a byte value into a register

Parameters:

  • reg Number

    Register location to write into

  • byte Number

    Byte to write

Returns:

Boolean:

True if successful

readByte

(
  • reg
)
Number

Reads a byte value from a register

Parameters:

  • reg Number

    Register location to read from

Returns:

Number:

Value in a specified register

readWord

(
  • reg
)
Number

Reads a word value from a register

Parameters:

  • reg Number

    Register location to read from

Returns:

Number:

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 Number

    Coefficient for REG_UCOEF0

  • uvcoeff1 Number

    Coefficient for REG_UCOEF1

  • uvcoeff2 Number

    Coefficient for REG_UCOEF2

  • uvcoeff3 Number

    Coefficient for REG_UCOEF3

writeParam

(
  • param
  • value
)

Writes a value to the parameter memory.

Parameters:

  • param SI114X_PARAM_T

    SI114X_PARAM_T register to write

  • value Number

    Value to write

readParam

(
  • param
)
Number

Reads a value from the parameter memory

Parameters:

  • param SI114X_PARAM_T

    SI114X_PARAM_T register to read

Returns:

Number:

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:

Number:

UV index value

Properties

REG_PART_ID

Enum SI114X_REG_T

REG_REV_ID

Enum SI114X_REG_T

REG_SEQ_ID

Enum SI114X_REG_T

REG_INT_CFG

Enum SI114X_REG_T

REG_IRQ_ENABLE

Enum SI114X_REG_T

REG_IRQ_MODE1

Enum SI114X_REG_T

REG_IRQ_MODE2

Enum SI114X_REG_T

REG_HW_KEY

Enum SI114X_REG_T

REG_MEAS_RATE0

Enum SI114X_REG_T

REG_MEAS_RATE1

Enum SI114X_REG_T

REG_PS_LED21

Enum SI114X_REG_T

REG_PS_LED3

Enum SI114X_REG_T

REG_UCOEF0

Enum SI114X_REG_T

REG_UCOEF1

Enum SI114X_REG_T

REG_UCOEF2

Enum SI114X_REG_T

REG_UCOEF3

Enum SI114X_REG_T

REG_PARAM_WR

Enum SI114X_REG_T

REG_COMMAND

Enum SI114X_REG_T

REG_RESPONSE

Enum SI114X_REG_T

REG_IRQ_STATUS

Enum SI114X_REG_T

REG_ALS_VIS_DATA0

Enum SI114X_REG_T

REG_ALS_VIS_DATA1

Enum SI114X_REG_T

REG_ALS_IR_DATA0

Enum SI114X_REG_T

REG_ALS_IR_DATA1

Enum SI114X_REG_T

REG_PS1_DATA0

Enum SI114X_REG_T

REG_PS1_DATA1

Enum SI114X_REG_T

REG_PS2_DATA0

Enum SI114X_REG_T

REG_PS2_DATA1

Enum SI114X_REG_T

REG_PS3_DATA0

Enum SI114X_REG_T

REG_PS3_DATA1

Enum SI114X_REG_T

REG_AUX_UVINDEX0

Enum SI114X_REG_T

REG_AUX_UVINDEX1

Enum SI114X_REG_T

REG_PARAM_READ

Enum SI114X_REG_T

REG_CHIP_STAT

Enum SI114X_REG_T

REG_ANA_IN_KEY0

Enum SI114X_REG_T

REG_ANA_IN_KEY1

Enum SI114X_REG_T

REG_ANA_IN_KEY2

Enum SI114X_REG_T

REG_ANA_IN_KEY3

Enum SI114X_REG_T

PARAM_I2C_ADDDR

Enum SI114X_PARAM_T

PARAM_CHLIST

Enum SI114X_PARAM_T

PARAM_PSLED12_SEL

Enum SI114X_PARAM_T

PARAM_PSLED3_SEL

Enum SI114X_PARAM_T

PARAM_PS_ENCODING

Enum SI114X_PARAM_T

PARAM_ALS_ENCODING

Enum SI114X_PARAM_T

PARAM_PS1_ADCMUX

Enum SI114X_PARAM_T

PARAM_PS2_ADCMUX

Enum SI114X_PARAM_T

PARAM_PS3_ADCMUX

Enum SI114X_PARAM_T

PARAM_PS_ADC_COUNT

Enum SI114X_PARAM_T

PARAM_PS_ADC_GAIN

Enum SI114X_PARAM_T

PARAM_PS_ADC_MISC

Enum SI114X_PARAM_T

PARAM_ALS_IR_ADCMUX

Enum SI114X_PARAM_T

PARAM_AUX_ADCMUX

Enum SI114X_PARAM_T

PARAM_ALS_VIS_ADC_COUNT

Enum SI114X_PARAM_T

PARAM_ALS_VIS_ADC_GAIN

Enum SI114X_PARAM_T

PARAM_ALS_VIS_ADC_MISC

Enum SI114X_PARAM_T

PARAM_LED_REC

Enum SI114X_PARAM_T

PARAM_ALS_IR_ADC_COUNT

Enum SI114X_PARAM_T

PARAM_ALS_IR_ADX_GAIN

Enum SI114X_PARAM_T

PARAM_ALS_IR_ADC_MISC

Enum SI114X_PARAM_T

CMD_NOOP

Enum SI114X_CMD_T

CMD_RESET

Enum SI114X_CMD_T

CMD_BUSADDR

Enum SI114X_CMD_T

CMD_PS_FORCE

Enum SI114X_CMD_T

CMD_GET_CAL

Enum SI114X_CMD_T

CMD_ALS_FORCE

Enum SI114X_CMD_T

CMD_PSALS_FORCE

Enum SI114X_CMD_T

CMD_PS_PAUSE

Enum SI114X_CMD_T

CMD_ALS_PAUSE

Enum SI114X_CMD_T

CMD_PSALS_PAUSE

Enum SI114X_CMD_T

CMD_PS_AUTO

Enum SI114X_CMD_T

CMD_ALS_AUTO

Enum SI114X_CMD_T

CMD_PSALS_AUTO

Enum SI114X_CMD_T

CMD_PARAM_QUERY

Enum SI114X_CMD_T

CMD_PARAM_SET

Enum SI114X_CMD_T

CHLIST_EN_PS1

Enum SI114X_CHLIST_BITS_T

CHLIST_EN_PS2

Enum SI114X_CHLIST_BITS_T

CHLIST_EN_PS3

Enum SI114X_CHLIST_BITS_T

CHLIST_EN_ALS_VIS

Enum SI114X_CHLIST_BITS_T

CHLIST_EN_ALS_IR

Enum SI114X_CHLIST_BITS_T

CHLIST_EN_AUX

Enum SI114X_CHLIST_BITS_T

CHLIST_EN_UV

Enum SI114X_CHLIST_BITS_T

ERR_NONE

Enum SI114X_ERR_T

ERR_INVALID_SET

Enum SI114X_ERR_T

ERR_PS1_ADC_OVER

Enum SI114X_ERR_T

ERR_PS2_ADC_OVER

Enum SI114X_ERR_T

ERR_PS3_ADC_OVER

Enum SI114X_ERR_T

ERR_ALS_VIS_ADC_OVER

Enum SI114X_ERR_T

ERR_ALS_IR_ADC_OVER

Enum SI114X_ERR_T

ERR_AUX_ADC_OVER

Enum SI114X_ERR_T

IRQEN_ALS_IE

Enum SI114X_IRQEN_BITS_T

IRQEN_PS1_IE

Enum SI114X_IRQEN_BITS_T

IRQEN_PS2_IE

Enum SI114X_IRQEN_BITS_T

IRQEN_PS3_IE

Enum SI114X_IRQEN_BITS_T