TSL2561 illuminance sensor

Device driver interface for the illuminance TSL2561 sensor.

This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.

TSL2561_ADDR_LOW
1
(0x29)
TSL2561_ADDR_FLOAT
1
(0x39)
TSL2561_ADDR_HIGH
1
(0x49)
TSL2561_INTEGRATIONTIME_13MS
1
(0x00)    /* 13.7ms */
TSL2561_INTEGRATIONTIME_101MS
1
(0x01)    /* 101ms  */
TSL2561_INTEGRATIONTIME_402MS
1
(0x02)    /* 402ms  */
TSL2561_INTEGRATIONTIME_NA
1
(0x03)    /* N/A    */
TSL2561_GAIN_1X
1
(0x00)
TSL2561_GAIN_16X
1
(0x10)
TSL2561_OK
1
(0)
TSL2561_NOI2C
1
(-1)
TSL2561_BADDEV
1
(-2)
int tsl2561_init(tsl2561_t * dev, const tsl2561_params_t * params)

Initialize the given TSL2561 device.

Parameters

dev:Initialized device descriptor of BMP180 device
params:Initialization parameters

Return values

  • 0 on success
  • -1 if given I2C is not available
  • -2 if not a TSL2561 sensor
uint16_t tsl2561_read_illuminance(const tsl2561_t * dev)

Read illuminance value from the given TSL2561 device, returned in lx.

Parameters

dev:Device descriptor of TSL2561 device to read from

Return values

  • Illuminance in Lux (lx)
struct tsl2561_params_t

Device initialization parameters.

i2c.h::i2c_t i2c_dev

I2C device which is used.

uint8_t addr

address on I2C bus

uint8_t gain

gain

uint8_t integration

integration time

struct tsl2561_t

Device descriptor for the TSL2561 sensor.

tsl2561_params_t params

device initialization parameters