upm
0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
|
API for the SI1145 UV Light Sensor. More...
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.
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 () |
SI114X | ( | int | bus, |
short | address | ||
) |
SI114X constructor
bus | I2C bus to use |
address | Address for this device |
float getUVIndex | ( | ) |
Reads the currently measured 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
reg | Register location to read from |
short readParam | ( | SI114X.SI114X_PARAM_T | param | ) |
Reads a value from the parameter memory
param | SI114X_PARAM_T register to read |
int readWord | ( | short | reg | ) |
Reads a word value from a register
reg | Register location to read from |
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().
uvcoeff0 | Coefficient for REG_UCOEF0 |
uvcoeff1 | Coefficient for REG_UCOEF1 |
uvcoeff2 | Coefficient for REG_UCOEF2 |
uvcoeff3 | Coefficient 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
reg | Register location to write into |
byte | Byte to write |
void writeParam | ( | SI114X.SI114X_PARAM_T | param, |
short | value | ||
) |
Writes a value to the parameter memory.
param | SI114X_PARAM_T register to write |
value | Value to write |