upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Classes | Public Member Functions | List of all members

API for the SI1145 UV Light Sensor. More...

Detailed Description

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

Classes

class  SI114X_CHLIST_BITS_T
 
class  SI114X_CMD_T
 
class  SI114X_ERR_T
 
class  SI114X_IRQEN_BITS_T
 
class  SI114X_PARAM_T
 
class  SI114X_REG_T
 

Public Member Functions

synchronized void delete ()
 
 SI114X (int bus, short address)
 
 SI114X (int bus)
 
boolean writeByte (short reg, short arg1)
 
short readByte (short reg)
 
int readWord (short reg)
 
void reset ()
 
void setUVCalibration (short uvcoeff0, short uvcoeff1, short uvcoeff2, short uvcoeff3)
 
void writeParam (SI114X.SI114X_PARAM_T param, short value)
 
short readParam (SI114X.SI114X_PARAM_T param)
 
void initialize ()
 
void update ()
 
float getUVIndex ()
 

Constructor & Destructor Documentation

SI114X ( int  bus,
short  address 
)

SI114X constructor

Parameters
busI2C bus to use
addressAddress for this device

Member Function Documentation

float getUVIndex ( )

Reads the currently measured UV index value

Returns
UV index value
void initialize ( )

Resets and initializes the device and starts auto-sampling

short readByte ( short  reg)

Reads a byte value from a register

Parameters
regRegister location to read from
Returns
Value in a specified register
short readParam ( SI114X.SI114X_PARAM_T  param)

Reads a value from the parameter memory

Parameters
paramSI114X_PARAM_T register to read
Returns
Value
int readWord ( short  reg)

Reads a word value from a register

Parameters
regRegister location to read from
Returns
Value in a specified register
void reset ( )

Disables interrupts and auto-measuring, issues a device reset, and then sets the hardware key.

void setUVCalibration ( short  uvcoeff0,
short  uvcoeff1,
short  uvcoeff2,
short  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
uvcoeff0Coefficient for REG_UCOEF0
uvcoeff1Coefficient for REG_UCOEF1
uvcoeff2Coefficient for REG_UCOEF2
uvcoeff3Coefficient for REG_UCOEF3
void update ( )

Updates stored values. You should call this before calling getUVIndex()

boolean writeByte ( short  reg,
short  arg1 
)

Writes a byte value into a register

Parameters
regRegister location to write into
byteByte to write
Returns
True if successful
void writeParam ( SI114X.SI114X_PARAM_T  param,
short  value 
)

Writes a value to the parameter memory.

Parameters
paramSI114X_PARAM_T register to write
valueValue to write

The documentation for this class was generated from the following file: