Adafruit Library
Public Member Functions | Protected Attributes | List of all members
WipperSnapper_I2C_Driver_TSL2591 Class Reference

Class that provides a driver interface for a TSL2591 sensor. More...

#include <WipperSnapper_I2C_Driver_TSL2591.h>

Inheritance diagram for WipperSnapper_I2C_Driver_TSL2591:
WipperSnapper_I2C_Driver

Public Member Functions

 WipperSnapper_I2C_Driver_TSL2591 (TwoWire *i2c, uint16_t sensorAddress)
 Constructor for a TSL2591 sensor. More...
 
 ~WipperSnapper_I2C_Driver_TSL2591 ()
 Destructor for an TSL2591 sensor.
 
bool begin ()
 Initializes the TSL2591 sensor and begins I2C. More...
 
bool getEventLight (sensors_event_t *lightEvent)
 Performs a light sensor read using the Adafruit Unified Sensor API. More...
 
- Public Member Functions inherited from WipperSnapper_I2C_Driver
 WipperSnapper_I2C_Driver (TwoWire *i2c, uint16_t sensorAddress)
 Instanciates an I2C sensor. More...
 
virtual ~WipperSnapper_I2C_Driver ()
 Destructor for an I2C sensor.
 
bool begin ()
 Initializes the I2C sensor and begins I2C. More...
 
void setSensorPeriod (float period, wippersnapper_i2c_v1_SensorType sensorType)
 Sets the sensor's period, provided a wippersnapper_i2c_v1_SensorType. More...
 
void configureDriver (wippersnapper_i2c_v1_I2CDeviceInitRequest *msgDeviceInitReq)
 Uses an I2CDeviceInitRequest message to configure the sensors belonging to the driver. More...
 
uint16_t getI2CAddress ()
 Gets the I2C device's address. More...
 
virtual long getSensorCO2Period ()
 Base implementation - Returns the co2 sensor's period, if set. More...
 
virtual long getSensorCO2PeriodPrv ()
 Base implementation - Returns the previous time interval at which the co2 sensor was queried last. More...
 
virtual void setSensorCO2PeriodPrv (long period)
 Sets a timestamp for when the co2 sensor was queried. More...
 
virtual bool getEventCO2 (sensors_event_t *co2Event)
 Gets a sensor's CO2 value. More...
 
virtual long getSensorECO2Period ()
 Base implementation - Returns the eCO2 sensor's period, if set. More...
 
virtual long getSensorECO2PeriodPrv ()
 Base implementation - Returns the previous time interval at which the eCO2 sensor was queried last. More...
 
virtual void setSensorECO2PeriodPrv (long period)
 Sets a timestamp for when the eCO2 sensor was queried. More...
 
virtual bool getEventECO2 (sensors_event_t *eco2Event)
 Gets a sensor's eCO2 value. More...
 
virtual long getSensorTVOCPeriod ()
 Base implementation - Returns the TVOC sensor's period, if set. More...
 
virtual long getSensorTVOCPeriodPrv ()
 Base implementation - Returns the previous time interval at which the TVOC sensor was queried last. More...
 
virtual void setSensorTVOCPeriodPrv (long period)
 Sets a timestamp for when the TVOC sensor was queried. More...
 
virtual bool getEventTVOC (sensors_event_t *tvocEvent)
 Gets a sensor's TVOC value. More...
 
virtual long getSensorAmbientTempPeriod ()
 Base implementation - Returns the ambient temperature (°C) sensor's period, if set. More...
 
virtual long getSensorAmbientTempPeriodPrv ()
 Base implementation - Returns the previous time interval at which the ambient temperature sensor (°C) was queried last. More...
 
virtual void setSensorAmbientTempPeriodPrv (long periodPrv)
 Sets a timestamp for when the ambient temperature sensor (°C) was queried. More...
 
virtual bool getEventAmbientTemp (sensors_event_t *tempEvent)
 Base implementation - Reads an ambient temperature sensor (°C). Expects value to return in the proper SI unit. More...
 
virtual long getSensorRelativeHumidityPeriod ()
 Base implementation - Returns the humidity sensor's period, if set. More...
 
virtual long getSensorRelativeHumidityPeriodPrv ()
 Base implementation - Returns the previous time interval at which the humidity sensor was queried last. More...
 
virtual void setSensorRelativeHumidityPeriodPrv (long periodPrv)
 Sets a timestamp for when the temperature sensor was queried. More...
 
virtual bool getEventRelativeHumidity (sensors_event_t *humidEvent)
 Base implementation - Reads a humidity sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorPressurePeriod ()
 Base implementation - Returns the pressure sensor's period, if set. More...
 
virtual long getSensorPressurePeriodPrv ()
 Base implementation - Returns the previous time interval at which the pressure sensor was queried last. More...
 
virtual void setSensorPressurePeriodPrv (long period)
 Sets a timestamp for when the pressure sensor was queried. More...
 
virtual bool getEventPressure (sensors_event_t *pressureEvent)
 Base implementation - Reads a pressure sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorAltitudePeriod ()
 Base implementation - Returns the Altitude sensor's period, if set. More...
 
virtual long getSensorAltitudePeriodPrv ()
 Base implementation - Returns the previous time interval at which the Altitude sensor was queried last. More...
 
virtual void setSensorAltitudePeriodPrv (long period)
 Sets a timestamp for when the Altitude sensor was queried. More...
 
virtual bool getEventAltitude (sensors_event_t *altitudeEvent)
 Base implementation - Reads a Altitude sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorObjectTempPeriod ()
 Base implementation - Returns the object temperature sensor's period, if set. More...
 
virtual long getSensorObjectTempPeriodPrv ()
 Base implementation - Returns the previous time interval at which the object temperature sensor was queried last. More...
 
virtual void setSensorObjectTempPeriodPrv (long period)
 Sets a timestamp for when the object temperature sensor was queried. More...
 
virtual bool getEventObjectTemp (sensors_event_t *objectTempEvent)
 Base implementation - Reads a object temperature sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorLightPeriod ()
 Base implementation - Returns the object light sensor's period, if set. More...
 
virtual long getSensorLightPeriodPrv ()
 Base implementation - Returns the previous time interval at which the light sensor was queried last. More...
 
virtual void setSensorLightPeriodPrv (long period)
 Sets a timestamp for when the light sensor was queried. More...
 
virtual long getSensorPM10_STDPeriod ()
 Base implementation - Returns the object pm10 standard sensors' period, if set. More...
 
virtual long getSensorPM10_STDPeriodPrv ()
 Base implementation - Returns the previous time interval at which the pm10 std. sensor was queried last. More...
 
virtual void setSensorPM10_STDPeriodPrv (long period)
 Sets a timestamp for when the light sensor was queried. More...
 
virtual bool getEventPM10_STD (sensors_event_t *pm10StdEvent)
 Base implementation - Reads a object pm10 std. sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorPM25_STDPeriod ()
 Base implementation - Returns the object pm25 standard sensors' period, if set. More...
 
virtual long getSensorPM25_STDPeriodPrv ()
 Base implementation - Returns the previous time interval at which the pm25 std. sensor was queried last. More...
 
virtual void setSensorPM25_STDPeriodPrv (long period)
 Sets a timestamp for when the light sensor was queried. More...
 
virtual bool getEventPM25_STD (sensors_event_t *pm25StdEvent)
 Base implementation - Reads a object pm25 std. sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorPM100_STDPeriod ()
 Base implementation - Returns the object pm100 standard sensors' period, if set. More...
 
virtual long getSensorPM100_STDPeriodPrv ()
 Base implementation - Returns the previous time interval at which the pm100 std. sensor was queried last. More...
 
virtual void setSensorPM100_STDPeriodPrv (long period)
 Sets a timestamp for when the light sensor was queried. More...
 
virtual bool getEventPM100_STD (sensors_event_t *pm100StdEvent)
 Base implementation - Reads a object pm100 std. sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorUnitlessPercentPeriod ()
 Base implementation - Returns the object unitless % sensor period, if set. More...
 
virtual long getSensorUnitlessPercentPeriodPrv ()
 Base implementation - Returns the previous time interval at which the unitless % sensor was queried last. More...
 
virtual void setSensorUnitlessPercentPeriodPrv (long period)
 Sets a timestamp for when the unitless % sensor was queried. More...
 
virtual bool getEventUnitlessPercent (sensors_event_t *unitlessPercentEvent)
 Base implementation - Reads a object unitless % std. sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorVoltagePeriod ()
 Base implementation - Returns the voltage sensor's period. More...
 
virtual long getSensorVoltagePeriodPrv ()
 Base implementation - Returns the previous time interval at which the voltage sensor was queried last. More...
 
virtual void setSensorVoltagePeriodPrv (long period)
 Sets a timestamp for when the voltage sensor was queried. More...
 
virtual bool getEventVoltage (sensors_event_t *voltageEvent)
 Base implementation - Reads a voltage sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorCurrentPeriod ()
 Base implementation - Returns the current sensor's period. More...
 
virtual long getSensorCurrentPeriodPrv ()
 Base implementation - Returns the previous time interval at which the current sensor was queried last. More...
 
virtual void setSensorCurrentPeriodPrv (long period)
 Sets a timestamp for when the current sensor was queried. More...
 
virtual bool getEventCurrent (sensors_event_t *currentEvent)
 Base implementation - Reads a current sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorRawPeriod ()
 Base implementation - Returns the raw sensor's period, if set. More...
 
virtual long getSensorRawPeriodPrv ()
 Base implementation - Returns the previous time interval at which the raw sensor was queried last. More...
 
virtual void setSensorRawPeriodPrv (long period)
 Sets a timestamp for when the raw sensor was queried. More...
 
virtual bool getEventRaw (sensors_event_t *rawEvent)
 Gets a sensor's Raw value. More...
 
virtual void disableAmbientTempF ()
 Disables the device's ambient temperature (°F) sensor, if it exists.
 
virtual long getSensorAmbientTempFPeriod ()
 Base implementation - Returns the ambient temperature (°F) sensor's period, if set. More...
 
virtual long getSensorAmbientTempFPeriodPrv ()
 Base implementation - Returns the previous time interval at which the ambient temperature sensor (°F) was queried last. More...
 
virtual void setSensorAmbientTempFPeriodPrv (long period)
 Sets a timestamp for when the ambient temperature sensor (°F) was queried. More...
 
virtual bool getEventAmbientTempF (sensors_event_t *AmbientTempFEvent)
 Helper function to obtain a sensor's ambient temperature value in °F. Requires getEventAmbientTemp() to be fully implemented by a driver. More...
 
virtual long getSensorObjectTempFPeriod ()
 Base implementation - Returns the object temperature (°F) sensor's period, if set. More...
 
virtual long getSensorObjectTempFPeriodPrv ()
 Base implementation - Returns the previous time interval at which the object temperature sensor (°F) was queried last. More...
 
virtual void setSensorObjectTempFPeriodPrv (long period)
 Sets a timestamp for when the object temperature sensor (°F) was queried. More...
 
virtual bool getEventObjectTempF (sensors_event_t *objectTempFEvent)
 Helper function to obtain a sensor's object temperature value in °F. Requires getEventObjectTemp() to be fully implemented by a driver. More...
 
virtual long getSensorGasResistancePeriod ()
 Base implementation - Returns the gas resistance (ohms) sensor's period, if set. More...
 
virtual long getSensorGasResistancePeriodPrv ()
 Base implementation - Returns the previous time interval at which the gas resistance sensor (ohms) was queried last. More...
 
virtual void setSensorGasResistancePeriodPrv (long period)
 Sets a timestamp for when the object gas resistance sensor was queried. More...
 
virtual bool getEventGasResistance (sensors_event_t *gasEvent)
 Base implementation - Reads a gas resistance sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorNOxIndexPeriod ()
 Base implementation - Returns the NOx Index sensor's period, if set. More...
 
virtual long getSensorNOxIndexPeriodPrv ()
 Base implementation - Returns the previous time interval at which the NOx Index sensor was queried last. More...
 
virtual void setSensorNOxIndexPeriodPrv (long period)
 Sets a timestamp for when the object NOx Index sensor was queried. More...
 
virtual bool getEventNOxIndex (sensors_event_t *gasEvent)
 Base implementation - Reads a NOx Index sensor and converts the reading into the expected SI unit. More...
 
virtual long getSensorVOCIndexPeriod ()
 Base implementation - Returns the VOC Index sensor's period, if set. More...
 
virtual long getSensorVOCIndexPeriodPrv ()
 Base implementation - Returns the previous time interval at which the VOC Index sensor was queried last. More...
 
virtual void setSensorVOCIndexPeriodPrv (long period)
 Sets a timestamp for when the object VOC Index sensor was queried. More...
 
virtual bool getEventVOCIndex (sensors_event_t *gasEvent)
 Base implementation - Reads a VOC Index sensor and converts the reading into the expected SI unit. More...
 
virtual void enableSensorProximity ()
 Enables the device's proximity sensor, if it exists.
 
virtual void disableSensorProximity ()
 Disables the device's object proximity sensor, if it exists.
 
virtual long sensorProximityPeriod ()
 Base implementation - Returns the proximity sensor's period, if set. More...
 
virtual void setSensorProximityPeriod (long period)
 Set the proximity sensor's return frequency. More...
 
virtual long SensorProximityPeriodPrv ()
 Base implementation - Returns the previous time interval at which the proximity sensor was queried last. More...
 
virtual void setSensorProximityPeriodPrv (long period)
 Sets a timestamp for when the proximity sensor was queried. More...
 
virtual bool getEventProximity (sensors_event_t *proximityEvent)
 Base implementation - Reads a proximity sensor and converts the reading into the expected SI unit. More...
 
virtual void updateSensorProximity (float period)
 Updates the properties of a proximity sensor. More...
 

Protected Attributes

Adafruit_TSL2591 * _tsl
 Pointer to TSL2591 light sensor object.
 
- Protected Attributes inherited from WipperSnapper_I2C_Driver
TwoWire * _i2c
 Pointer to the I2C driver's Wire object.
 
uint16_t _sensorAddress
 The I2C driver's unique I2C address.
 
long _tempSensorPeriod
 The time period between reading the temperature sensor's value. More...
 
long _tempSensorPeriodPrv
 
long _humidSensorPeriod
 The time period between reading the humidity sensor's value. More...
 
long _humidSensorPeriodPrv
 
long _pressureSensorPeriod
 The time period between reading the pressure sensor's value. More...
 
long _pressureSensorPeriodPrv
 
long _CO2SensorPeriod
 The time period between reading the CO2 sensor's value. More...
 
long _CO2SensorPeriodPrv
 The time when the CO2 sensor was last read. More...
 
long _ECO2SensorPeriod
 The time period between reading the eCO2 sensor's value. More...
 
long _ECO2SensorPeriodPrv
 The time when the eCO2 sensor was last read. More...
 
long _TVOCSensorPeriod
 The time period between reading the TVOC sensor's value. More...
 
long _TVOCSensorPeriodPrv
 The time when the TVOC sensor was last read. More...
 
long _altitudeSensorPeriod
 The time period between reading the altitude sensor's value. More...
 
long _altitudeSensorPeriodPrv
 
long _objectTempSensorPeriod = 0L
 
long _objectTempSensorPeriodPrv
 
long _lightSensorPeriod
 The time period between reading the light sensor's value. More...
 
long _lightSensorPeriodPrv
 
long _PM10SensorPeriod
 The time period between reading the pm25 sensor's value. More...
 
long _PM10SensorPeriodPrv
 The time when the pm25 sensor was last read. More...
 
long _PM25SensorPeriod
 The time period between reading the pm25 sensor's value. More...
 
long _PM25SensorPeriodPrv
 The time when the pm25 sensor was last read. More...
 
long _PM100SensorPeriod
 The time period between reading the pm100_std sensor's value. More...
 
long _PM100SensorPeriodPrv
 
long _unitlessPercentPeriod
 The time period between reading the unitless % sensor's value. More...
 
long _unitlessPercentPeriodPrv
 
long _voltagePeriod
 The time period between reading the voltage sensor's value. More...
 
long _voltagePeriodPrv
 
long _currentPeriod
 The time period between reading the current sensor's value. More...
 
long _currentPeriodPrv
 
long _rawSensorPeriod
 The time period between reading the Raw sensor's value. More...
 
long _rawSensorPeriodPrv
 The time when the Raw sensor was last read. More...
 
long _ambientTempFPeriod = 0L
 
long _ambientTempFPeriodPrv
 
long _objectTempFPeriod = 0L
 
long _objectTempFPeriodPrv
 
long _gasResistancePeriod = 0L
 
long _gasResistancePeriodPrv
 
long _NOxIndexPeriod
 The time period between reading the NOx Index sensor's value. More...
 
long _NOxIndexPeriodPrv
 
long _VOCIndexPeriod
 The time period between reading the VOC Index sensor's value. More...
 
long _VOCIndexPeriodPrv
 
long _proximitySensorPeriod
 The time period between reading the proximity sensor's value. More...
 
long _proximitySensorPeriodPrv
 

Detailed Description

Class that provides a driver interface for a TSL2591 sensor.

Constructor & Destructor Documentation

◆ WipperSnapper_I2C_Driver_TSL2591()

WipperSnapper_I2C_Driver_TSL2591::WipperSnapper_I2C_Driver_TSL2591 ( TwoWire *  i2c,
uint16_t  sensorAddress 
)
inline

Constructor for a TSL2591 sensor.

Parameters
i2cThe I2C interface.
sensorAddressThe 7-bit I2C address of the sensor.

Member Function Documentation

◆ begin()

bool WipperSnapper_I2C_Driver_TSL2591::begin ( )
inline

Initializes the TSL2591 sensor and begins I2C.

Returns
True if initialized successfully, False otherwise.

◆ getEventLight()

bool WipperSnapper_I2C_Driver_TSL2591::getEventLight ( sensors_event_t *  lightEvent)
inlinevirtual

Performs a light sensor read using the Adafruit Unified Sensor API.

Parameters
lightEventLight sensor reading, in lux.
Returns
True if the sensor event was obtained successfully, False otherwise.

Reimplemented from WipperSnapper_I2C_Driver.


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