JeeLib
An easy interface to the port headers, the RF12 driver library, timers, low-power code, and more.
 All Classes Files Functions Variables Enumerations Macros Pages
LuxPlug Class Reference

Interface for the Lux Plug - see https://jeelabs.org/xp. More...

#include <Ports.h>

Inheritance diagram for LuxPlug:
DeviceI2C

Public Types

enum  {
  CONTROL, TIMING, THRESHLOWLOW, THRESHLOWHIGH,
  THRESHHIGHLOW, THRESHHIGHHIGH, INTERRUPT, LUXID = 0xA,
  DATA0LOW = 0xC, DATA0HIGH, DATA1LOW, DATA1HIGH
}
 

Public Member Functions

 LuxPlug (PortI2C &port, byte addr)
 
void begin ()
 Initialize the LuxPlug. Wait at least 1000 ms after calling this!
 
void poweroff ()
 Power down the lux plug for low power usage.
 
void setGain (byte high)
 Set the gain mode of the 16x multiplier in the LuxPlug. More...
 
const word * getData ()
 Read the raw data from the photodiodes. More...
 
word calcLux (byte iGain=0, byte tInt=2) const
 Calculate Lux value from the raw data retreived. More...
 
- Public Member Functions inherited from DeviceI2C
 DeviceI2C (const PortI2C &p, uint8_t me)
 
bool isPresent () const
 see if a device answers at an I2C address
 
uint8_t send () const
 Create a start condition on the I2C bus, and set things up for sending data to this device. More...
 
uint8_t receive () const
 Create a start condition on the I2C bus, and set things up for receiving data from this device. More...
 
void stop () const
 Create a stop condition on the I2C bus, ending the current transfer.
 
uint8_t write (uint8_t data) const
 Write a byte to the currently addressed device. More...
 
uint8_t read (uint8_t last) const
 Read a byte from the currently addressed device. More...
 
void setAddress (uint8_t me)
 

Detailed Description

Interface for the Lux Plug - see https://jeelabs.org/xp.

Member Function Documentation

word LuxPlug::calcLux ( byte  iGain = 0,
byte  tInt = 2 
) const

Calculate Lux value from the raw data retreived.

Parameters
iGaingain, where 0:1X, 1:16X.
tIntIntegration time, where 0:13.7mS, 1:100mS, 2:402mS, 3:Manual
Returns
A 2 byte unsigned number containing the Lux value calculated.
const word * LuxPlug::getData ( )

Read the raw data from the photodiodes.

Returns
Two bytes containing the raw data read from the sensor.
void LuxPlug::setGain ( byte  high)

Set the gain mode of the 16x multiplier in the LuxPlug.

Parameters
highMultiplier is off if 0, otherwise on.

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