Adafruit HTS221 Library
Classes | Macros | Enumerations
Adafruit_TSL2591.h File Reference
#include <Adafruit_I2CDevice.h>
#include <Adafruit_Sensor.h>
#include <Arduino.h>

Go to the source code of this file.

Classes

class  Adafruit_TSL2591
 Class that stores state and functions for interacting with TSL2591 Light Sensor. More...
 

Macros

#define TSL2591_VISIBLE   (2)
 (channel 0) - (channel 1)
 
#define TSL2591_INFRARED   (1)
 channel 1
 
#define TSL2591_FULLSPECTRUM   (0)
 channel 0
 
#define TSL2591_ADDR   (0x29)
 Default I2C address.
 
#define TSL2591_COMMAND_BIT   (0xA0)
 1010 0000: bits 7 and 5 for 'command normal'
 
#define TSL2591_CLEAR_INT   (0xE7)
 ! Special Function Command for "Clear ALS and no persist ALS interrupt"
 
#define TSL2591_TEST_INT   (0xE4)
 ! Special Function Command for "Interrupt set - forces an interrupt"
 
#define TSL2591_WORD_BIT   (0x20)
 1 = read/write word (rather than byte)
 
#define TSL2591_BLOCK_BIT   (0x10)
 1 = using block read/write
 
#define TSL2591_ENABLE_POWEROFF   (0x00)
 Flag for ENABLE register to disable.
 
#define TSL2591_ENABLE_POWERON   (0x01)
 Flag for ENABLE register to enable.
 
#define TSL2591_ENABLE_AEN   (0x02)
 activates the ALS. Writing a zero disables the ALS. More...
 
#define TSL2591_ENABLE_AIEN   (0x10)
 generated, subject to the persist filter. More...
 
#define TSL2591_ENABLE_NPIEN   (0x80)
 will generate an interrupt, bypassing the persist filter More...
 
#define TSL2591_LUX_DF   (408.0F)
 Lux cooefficient.
 
#define TSL2591_LUX_COEFB   (1.64F)
 CH0 coefficient.
 
#define TSL2591_LUX_COEFC   (0.59F)
 CH1 coefficient A.
 
#define TSL2591_LUX_COEFD   (0.86F)
 CH2 coefficient B.
 

Enumerations

enum  {
  TSL2591_REGISTER_ENABLE = 0x00, TSL2591_REGISTER_CONTROL = 0x01, TSL2591_REGISTER_THRESHOLD_AILTL = 0x04, TSL2591_REGISTER_THRESHOLD_AILTH = 0x05,
  TSL2591_REGISTER_THRESHOLD_AIHTL = 0x06, TSL2591_REGISTER_THRESHOLD_AIHTH = 0x07, TSL2591_REGISTER_THRESHOLD_NPAILTL, TSL2591_REGISTER_THRESHOLD_NPAILTH,
  TSL2591_REGISTER_THRESHOLD_NPAIHTL, TSL2591_REGISTER_THRESHOLD_NPAIHTH, TSL2591_REGISTER_PERSIST_FILTER = 0x0C, TSL2591_REGISTER_PACKAGE_PID = 0x11,
  TSL2591_REGISTER_DEVICE_ID = 0x12, TSL2591_REGISTER_DEVICE_STATUS = 0x13, TSL2591_REGISTER_CHAN0_LOW = 0x14, TSL2591_REGISTER_CHAN0_HIGH = 0x15,
  TSL2591_REGISTER_CHAN1_LOW = 0x16, TSL2591_REGISTER_CHAN1_HIGH = 0x17
}
 TSL2591 Register map.
 
enum  tsl2591IntegrationTime_t {
  TSL2591_INTEGRATIONTIME_100MS = 0x00, TSL2591_INTEGRATIONTIME_200MS = 0x01, TSL2591_INTEGRATIONTIME_300MS = 0x02, TSL2591_INTEGRATIONTIME_400MS = 0x03,
  TSL2591_INTEGRATIONTIME_500MS = 0x04, TSL2591_INTEGRATIONTIME_600MS = 0x05
}
 Enumeration for the sensor integration timing.
 
enum  tsl2591Persist_t {
  TSL2591_PERSIST_EVERY = 0x00, TSL2591_PERSIST_ANY = 0x01, TSL2591_PERSIST_2 = 0x02, TSL2591_PERSIST_3 = 0x03,
  TSL2591_PERSIST_5 = 0x04, TSL2591_PERSIST_10 = 0x05, TSL2591_PERSIST_15 = 0x06, TSL2591_PERSIST_20 = 0x07,
  TSL2591_PERSIST_25 = 0x08, TSL2591_PERSIST_30 = 0x09, TSL2591_PERSIST_35 = 0x0A, TSL2591_PERSIST_40 = 0x0B,
  TSL2591_PERSIST_45 = 0x0C, TSL2591_PERSIST_50 = 0x0D, TSL2591_PERSIST_55 = 0x0E, TSL2591_PERSIST_60 = 0x0F
}
 Enumeration for the persistance filter (for interrupts)
 
enum  tsl2591Gain_t { TSL2591_GAIN_LOW = 0x00, TSL2591_GAIN_MED = 0x10, TSL2591_GAIN_HIGH = 0x20, TSL2591_GAIN_MAX = 0x30 }
 Enumeration for the sensor gain. More...
 

Detailed Description

Author
KT0WN (adafruit.com)

This is a library for the Adafruit TSL2591 breakout board This library works with the Adafruit TSL2591 breakout -—> https://www.adafruit.com/products/1980

Check out the links above for our tutorials and wiring diagrams These chips use I2C to communicate

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Macro Definition Documentation

◆ TSL2591_ENABLE_AEN

#define TSL2591_ENABLE_AEN   (0x02)

activates the ALS. Writing a zero disables the ALS.

ALS Enable. This field activates ALS function. Writing a one

◆ TSL2591_ENABLE_AIEN

#define TSL2591_ENABLE_AIEN   (0x10)

generated, subject to the persist filter.

ALS Interrupt Enable. When asserted permits ALS interrupts to be

◆ TSL2591_ENABLE_NPIEN

#define TSL2591_ENABLE_NPIEN   (0x80)

will generate an interrupt, bypassing the persist filter

No Persist Interrupt Enable. When asserted NP Threshold conditions

Enumeration Type Documentation

◆ tsl2591Gain_t

Enumeration for the sensor gain.

Enumerator
TSL2591_GAIN_MED 

low gain (1x)

TSL2591_GAIN_HIGH 

medium gain (25x)

TSL2591_GAIN_MAX 

medium gain (428x)