From f882164c9b291e5937d6d815e6071ed538aa9716 Mon Sep 17 00:00:00 2001
From: dherrada <=>
Date: Tue, 26 May 2020 11:37:42 -0400
Subject: [PATCH] Moved repository to actions
---
.github/workflows/githubci.yml | 32 ++++
.travis.yml | 27 ---
Adafruit_TSL2561_U.cpp | 335 ++++++++++++++++-----------------
Adafruit_TSL2561_U.h | 254 ++++++++++++-------------
README.md | 2 +-
library.properties | 3 +-
6 files changed, 328 insertions(+), 325 deletions(-)
create mode 100644 .github/workflows/githubci.yml
delete mode 100644 .travis.yml
diff --git a/.github/workflows/githubci.yml b/.github/workflows/githubci.yml
new file mode 100644
index 0000000..a21225b
--- /dev/null
+++ b/.github/workflows/githubci.yml
@@ -0,0 +1,32 @@
+name: Arduino Library CI
+
+on: [pull_request, push, repository_dispatch]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/setup-python@v1
+ with:
+ python-version: '3.x'
+ - uses: actions/checkout@v2
+ - uses: actions/checkout@v2
+ with:
+ repository: adafruit/ci-arduino
+ path: ci
+
+ - name: pre-install
+ run: bash ci/actions_install.sh
+
+ - name: test platforms
+ run: python3 ci/build_platform.py main_platforms
+
+ - name: clang
+ run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
+
+ - name: doxygen
+ env:
+ GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
+ PRETTYNAME : "Adafruit TSL2561 Light Sensor Library"
+ run: bash ci/doxy_gen_and_deploy.sh
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index a22fcb5..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-language: c
-sudo: false
-
-# Blacklist
-branches:
- except:
- - gh-pages
-
-env:
- global:
- - PRETTYNAME="Adafruit TSL2561 Arduino Library"
-# Optional, will default to "$TRAVIS_BUILD_DIR/Doxyfile"
-# - DOXYFILE: $TRAVIS_BUILD_DIR/Doxyfile
-
-before_install:
- - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
-
-install:
- - arduino --install-library "Adafruit Unified Sensor"
-
-script:
- - build_main_platforms
-
-# Generate and deploy documentation
-after_success:
- - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh)
- - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh)
\ No newline at end of file
diff --git a/Adafruit_TSL2561_U.cpp b/Adafruit_TSL2561_U.cpp
index 400fb05..0b746fc 100644
--- a/Adafruit_TSL2561_U.cpp
+++ b/Adafruit_TSL2561_U.cpp
@@ -18,9 +18,10 @@
*
* @section dependencies Dependencies
*
- * This library depends on
- * Adafruit_Sensor being present on your system. Please make sure you have
- * installed the latest version before using this library.
+ * This library depends on Adafruit_Sensor being
+ * present on your system. Please make sure you have installed the latest
+ * version before using this library.
*
* @section author Author
*
@@ -35,7 +36,7 @@
* v2.0 - Rewrote driver for Adafruit_Sensor and Auto-Gain support, and
* added lux clipping check (returns 0 lux on sensor saturation)
* v1.0 - First release (previously TSL2561)
-*/
+ */
/**************************************************************************/
#include "Adafruit_TSL2561_U.h"
@@ -52,8 +53,8 @@
keep track if you have many sensors in use
*/
/**************************************************************************/
-Adafruit_TSL2561_Unified::Adafruit_TSL2561_Unified(uint8_t addr, int32_t sensorID)
-{
+Adafruit_TSL2561_Unified::Adafruit_TSL2561_Unified(uint8_t addr,
+ int32_t sensorID) {
_addr = addr;
_tsl2561Initialised = false;
_tsl2561AutoGain = false;
@@ -73,8 +74,7 @@ Adafruit_TSL2561_Unified::Adafruit_TSL2561_Unified(uint8_t addr, int32_t sensorI
@returns True if sensor is found and initialized, false otherwise.
*/
/**************************************************************************/
-boolean Adafruit_TSL2561_Unified::begin()
-{
+boolean Adafruit_TSL2561_Unified::begin() {
_i2c = &Wire;
_i2c->begin();
return init();
@@ -88,10 +88,9 @@ boolean Adafruit_TSL2561_Unified::begin()
@returns True if sensor is found and initialized, false otherwise.
*/
/**************************************************************************/
-boolean Adafruit_TSL2561_Unified::begin(TwoWire *theWire)
-{
+boolean Adafruit_TSL2561_Unified::begin(TwoWire *theWire) {
_i2c = theWire;
- _i2c-> begin();
+ _i2c->begin();
return init();
}
@@ -103,8 +102,7 @@ boolean Adafruit_TSL2561_Unified::begin(TwoWire *theWire)
@returns True if sensor is found and initialized, false otherwise.
*/
/**************************************************************************/
-boolean Adafruit_TSL2561_Unified::init()
-{
+boolean Adafruit_TSL2561_Unified::init() {
/* Make sure we're actually connected */
uint8_t x = read8(TSL2561_REGISTER_ID);
if (x & 0x05) { // ID code for TSL2561
@@ -129,22 +127,22 @@ boolean Adafruit_TSL2561_Unified::init()
@param enable Set to true to enable, False to disable
*/
/**************************************************************************/
-void Adafruit_TSL2561_Unified::enableAutoRange(bool enable)
-{
- _tsl2561AutoGain = enable;
+void Adafruit_TSL2561_Unified::enableAutoRange(bool enable) {
+ _tsl2561AutoGain = enable;
}
/**************************************************************************/
/*!
@brief Sets the integration time for the TSL2561. Higher time means
more light captured (better for low light conditions) but will
- take longer to run readings.
+ take longer to run readings.
@param time The amount of time we'd like to add up values
*/
/**************************************************************************/
-void Adafruit_TSL2561_Unified::setIntegrationTime(tsl2561IntegrationTime_t time)
-{
- if (!_tsl2561Initialised) begin();
+void Adafruit_TSL2561_Unified::setIntegrationTime(
+ tsl2561IntegrationTime_t time) {
+ if (!_tsl2561Initialised)
+ begin();
/* Enable the device by setting the control bit to 0x03 */
enable();
@@ -165,15 +163,16 @@ void Adafruit_TSL2561_Unified::setIntegrationTime(tsl2561IntegrationTime_t time)
@param gain The value we'd like to set the gain to
*/
/**************************************************************************/
-void Adafruit_TSL2561_Unified::setGain(tsl2561Gain_t gain)
-{
- if (!_tsl2561Initialised) begin();
+void Adafruit_TSL2561_Unified::setGain(tsl2561Gain_t gain) {
+ if (!_tsl2561Initialised)
+ begin();
/* Enable the device by setting the control bit to 0x03 */
enable();
/* Update the timing register */
- write8(TSL2561_COMMAND_BIT | TSL2561_REGISTER_TIMING, _tsl2561IntegrationTime | gain);
+ write8(TSL2561_COMMAND_BIT | TSL2561_REGISTER_TIMING,
+ _tsl2561IntegrationTime | gain);
/* Update value placeholders */
_tsl2561Gain = gain;
@@ -192,78 +191,68 @@ void Adafruit_TSL2561_Unified::setGain(tsl2561Gain_t gain)
IR-only light diode.
*/
/**************************************************************************/
-void Adafruit_TSL2561_Unified::getLuminosity (uint16_t *broadband, uint16_t *ir)
-{
+void Adafruit_TSL2561_Unified::getLuminosity(uint16_t *broadband,
+ uint16_t *ir) {
bool valid = false;
- if (!_tsl2561Initialised) begin();
+ if (!_tsl2561Initialised)
+ begin();
/* If Auto gain disabled get a single reading and continue */
- if(!_tsl2561AutoGain)
- {
- getData (broadband, ir);
+ if (!_tsl2561AutoGain) {
+ getData(broadband, ir);
return;
}
/* Read data until we find a valid range */
bool _agcCheck = false;
- do
- {
+ do {
uint16_t _b, _ir;
uint16_t _hi, _lo;
tsl2561IntegrationTime_t _it = _tsl2561IntegrationTime;
/* Get the hi/low threshold for the current integration time */
- switch(_it)
- {
- case TSL2561_INTEGRATIONTIME_13MS:
- _hi = TSL2561_AGC_THI_13MS;
- _lo = TSL2561_AGC_TLO_13MS;
- break;
- case TSL2561_INTEGRATIONTIME_101MS:
- _hi = TSL2561_AGC_THI_101MS;
- _lo = TSL2561_AGC_TLO_101MS;
- break;
- default:
- _hi = TSL2561_AGC_THI_402MS;
- _lo = TSL2561_AGC_TLO_402MS;
- break;
+ switch (_it) {
+ case TSL2561_INTEGRATIONTIME_13MS:
+ _hi = TSL2561_AGC_THI_13MS;
+ _lo = TSL2561_AGC_TLO_13MS;
+ break;
+ case TSL2561_INTEGRATIONTIME_101MS:
+ _hi = TSL2561_AGC_THI_101MS;
+ _lo = TSL2561_AGC_TLO_101MS;
+ break;
+ default:
+ _hi = TSL2561_AGC_THI_402MS;
+ _lo = TSL2561_AGC_TLO_402MS;
+ break;
}
getData(&_b, &_ir);
/* Run an auto-gain check if we haven't already done so ... */
- if (!_agcCheck)
- {
- if ((_b < _lo) && (_tsl2561Gain == TSL2561_GAIN_1X))
- {
+ if (!_agcCheck) {
+ if ((_b < _lo) && (_tsl2561Gain == TSL2561_GAIN_1X)) {
/* Increase the gain and try again */
setGain(TSL2561_GAIN_16X);
/* Drop the previous conversion results */
getData(&_b, &_ir);
/* Set a flag to indicate we've adjusted the gain */
_agcCheck = true;
- }
- else if ((_b > _hi) && (_tsl2561Gain == TSL2561_GAIN_16X))
- {
+ } else if ((_b > _hi) && (_tsl2561Gain == TSL2561_GAIN_16X)) {
/* Drop gain to 1x and try again */
setGain(TSL2561_GAIN_1X);
/* Drop the previous conversion results */
getData(&_b, &_ir);
/* Set a flag to indicate we've adjusted the gain */
_agcCheck = true;
- }
- else
- {
+ } else {
/* Nothing to look at here, keep moving ....
Reading is either valid, or we're already at the chips limits */
*broadband = _b;
*ir = _ir;
valid = true;
}
- }
- else
- {
+ } else {
/* If we've already adjusted the gain once, just return the new results.
This avoids endless loops where a value is at one extreme pre-gain,
and the the other extreme post-gain */
@@ -274,17 +263,15 @@ void Adafruit_TSL2561_Unified::getLuminosity (uint16_t *broadband, uint16_t *ir)
} while (!valid);
}
-
-
/**************************************************************************/
/*!
Enables the device
*/
/**************************************************************************/
-void Adafruit_TSL2561_Unified::enable(void)
-{
+void Adafruit_TSL2561_Unified::enable(void) {
/* Enable the device by setting the control bit to 0x03 */
- write8(TSL2561_COMMAND_BIT | TSL2561_REGISTER_CONTROL, TSL2561_CONTROL_POWERON);
+ write8(TSL2561_COMMAND_BIT | TSL2561_REGISTER_CONTROL,
+ TSL2561_CONTROL_POWERON);
}
/**************************************************************************/
@@ -292,10 +279,10 @@ void Adafruit_TSL2561_Unified::enable(void)
Disables the device (putting it in lower power sleep mode)
*/
/**************************************************************************/
-void Adafruit_TSL2561_Unified::disable(void)
-{
+void Adafruit_TSL2561_Unified::disable(void) {
/* Turn the device off to save power */
- write8(TSL2561_COMMAND_BIT | TSL2561_REGISTER_CONTROL, TSL2561_CONTROL_POWEROFF);
+ write8(TSL2561_COMMAND_BIT | TSL2561_REGISTER_CONTROL,
+ TSL2561_CONTROL_POWEROFF);
}
/**************************************************************************/
@@ -303,36 +290,35 @@ void Adafruit_TSL2561_Unified::disable(void)
Private function to read luminosity on both channels
*/
/**************************************************************************/
-void Adafruit_TSL2561_Unified::getData (uint16_t *broadband, uint16_t *ir)
-{
+void Adafruit_TSL2561_Unified::getData(uint16_t *broadband, uint16_t *ir) {
/* Enable the device by setting the control bit to 0x03 */
enable();
/* Wait x ms for ADC to complete */
- switch (_tsl2561IntegrationTime)
- {
- case TSL2561_INTEGRATIONTIME_13MS:
- delay(TSL2561_DELAY_INTTIME_13MS); // KTOWN: Was 14ms
- break;
- case TSL2561_INTEGRATIONTIME_101MS:
- delay(TSL2561_DELAY_INTTIME_101MS); // KTOWN: Was 102ms
- break;
- default:
- delay(TSL2561_DELAY_INTTIME_402MS); // KTOWN: Was 403ms
- break;
+ switch (_tsl2561IntegrationTime) {
+ case TSL2561_INTEGRATIONTIME_13MS:
+ delay(TSL2561_DELAY_INTTIME_13MS); // KTOWN: Was 14ms
+ break;
+ case TSL2561_INTEGRATIONTIME_101MS:
+ delay(TSL2561_DELAY_INTTIME_101MS); // KTOWN: Was 102ms
+ break;
+ default:
+ delay(TSL2561_DELAY_INTTIME_402MS); // KTOWN: Was 403ms
+ break;
}
/* Reads a two byte value from channel 0 (visible + infrared) */
- *broadband = read16(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN0_LOW);
+ *broadband = read16(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT |
+ TSL2561_REGISTER_CHAN0_LOW);
/* Reads a two byte value from channel 1 (infrared) */
- *ir = read16(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN1_LOW);
+ *ir = read16(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT |
+ TSL2561_REGISTER_CHAN1_LOW);
/* Turn the device off to save power */
disable();
}
-
/**************************************************************************/
/*!
@brief Converts the raw sensor values to the standard SI lux equivalent.
@@ -349,49 +335,47 @@ void Adafruit_TSL2561_Unified::getData (uint16_t *broadband, uint16_t *ir)
Returns
*/
/**************************************************************************/
-uint32_t Adafruit_TSL2561_Unified::calculateLux(uint16_t broadband, uint16_t ir)
-{
+uint32_t Adafruit_TSL2561_Unified::calculateLux(uint16_t broadband,
+ uint16_t ir) {
unsigned long chScale;
unsigned long channel1;
unsigned long channel0;
/* Make sure the sensor isn't saturated! */
uint16_t clipThreshold;
- switch (_tsl2561IntegrationTime)
- {
- case TSL2561_INTEGRATIONTIME_13MS:
- clipThreshold = TSL2561_CLIPPING_13MS;
- break;
- case TSL2561_INTEGRATIONTIME_101MS:
- clipThreshold = TSL2561_CLIPPING_101MS;
- break;
- default:
- clipThreshold = TSL2561_CLIPPING_402MS;
- break;
+ switch (_tsl2561IntegrationTime) {
+ case TSL2561_INTEGRATIONTIME_13MS:
+ clipThreshold = TSL2561_CLIPPING_13MS;
+ break;
+ case TSL2561_INTEGRATIONTIME_101MS:
+ clipThreshold = TSL2561_CLIPPING_101MS;
+ break;
+ default:
+ clipThreshold = TSL2561_CLIPPING_402MS;
+ break;
}
/* Return 65536 lux if the sensor is saturated */
- if ((broadband > clipThreshold) || (ir > clipThreshold))
- {
+ if ((broadband > clipThreshold) || (ir > clipThreshold)) {
return 65536;
}
/* Get the correct scale depending on the intergration time */
- switch (_tsl2561IntegrationTime)
- {
- case TSL2561_INTEGRATIONTIME_13MS:
- chScale = TSL2561_LUX_CHSCALE_TINT0;
- break;
- case TSL2561_INTEGRATIONTIME_101MS:
- chScale = TSL2561_LUX_CHSCALE_TINT1;
- break;
- default: /* No scaling ... integration time = 402ms */
- chScale = (1 << TSL2561_LUX_CHSCALE);
- break;
+ switch (_tsl2561IntegrationTime) {
+ case TSL2561_INTEGRATIONTIME_13MS:
+ chScale = TSL2561_LUX_CHSCALE_TINT0;
+ break;
+ case TSL2561_INTEGRATIONTIME_101MS:
+ chScale = TSL2561_LUX_CHSCALE_TINT1;
+ break;
+ default: /* No scaling ... integration time = 402ms */
+ chScale = (1 << TSL2561_LUX_CHSCALE);
+ break;
}
/* Scale for gain (1x or 16x) */
- if (!_tsl2561Gain) chScale = chScale << 4;
+ if (!_tsl2561Gain)
+ chScale = chScale << 4;
/* Scale the channel values */
channel0 = (broadband * chScale) >> TSL2561_LUX_CHSCALE;
@@ -399,7 +383,8 @@ uint32_t Adafruit_TSL2561_Unified::calculateLux(uint16_t broadband, uint16_t ir)
/* Find the ratio of the channel values (Channel1/Channel0) */
unsigned long ratio1 = 0;
- if (channel0 != 0) ratio1 = (channel1 << (TSL2561_LUX_RATIOSCALE+1)) / channel0;
+ if (channel0 != 0)
+ ratio1 = (channel1 << (TSL2561_LUX_RATIOSCALE + 1)) / channel0;
/* round the ratio value */
unsigned long ratio = (ratio1 + 1) >> 1;
@@ -407,51 +392,70 @@ uint32_t Adafruit_TSL2561_Unified::calculateLux(uint16_t broadband, uint16_t ir)
unsigned int b, m;
#ifdef TSL2561_PACKAGE_CS
- if ((ratio >= 0) && (ratio <= TSL2561_LUX_K1C))
- {b=TSL2561_LUX_B1C; m=TSL2561_LUX_M1C;}
- else if (ratio <= TSL2561_LUX_K2C)
- {b=TSL2561_LUX_B2C; m=TSL2561_LUX_M2C;}
- else if (ratio <= TSL2561_LUX_K3C)
- {b=TSL2561_LUX_B3C; m=TSL2561_LUX_M3C;}
- else if (ratio <= TSL2561_LUX_K4C)
- {b=TSL2561_LUX_B4C; m=TSL2561_LUX_M4C;}
- else if (ratio <= TSL2561_LUX_K5C)
- {b=TSL2561_LUX_B5C; m=TSL2561_LUX_M5C;}
- else if (ratio <= TSL2561_LUX_K6C)
- {b=TSL2561_LUX_B6C; m=TSL2561_LUX_M6C;}
- else if (ratio <= TSL2561_LUX_K7C)
- {b=TSL2561_LUX_B7C; m=TSL2561_LUX_M7C;}
- else if (ratio > TSL2561_LUX_K8C)
- {b=TSL2561_LUX_B8C; m=TSL2561_LUX_M8C;}
+ if ((ratio >= 0) && (ratio <= TSL2561_LUX_K1C)) {
+ b = TSL2561_LUX_B1C;
+ m = TSL2561_LUX_M1C;
+ } else if (ratio <= TSL2561_LUX_K2C) {
+ b = TSL2561_LUX_B2C;
+ m = TSL2561_LUX_M2C;
+ } else if (ratio <= TSL2561_LUX_K3C) {
+ b = TSL2561_LUX_B3C;
+ m = TSL2561_LUX_M3C;
+ } else if (ratio <= TSL2561_LUX_K4C) {
+ b = TSL2561_LUX_B4C;
+ m = TSL2561_LUX_M4C;
+ } else if (ratio <= TSL2561_LUX_K5C) {
+ b = TSL2561_LUX_B5C;
+ m = TSL2561_LUX_M5C;
+ } else if (ratio <= TSL2561_LUX_K6C) {
+ b = TSL2561_LUX_B6C;
+ m = TSL2561_LUX_M6C;
+ } else if (ratio <= TSL2561_LUX_K7C) {
+ b = TSL2561_LUX_B7C;
+ m = TSL2561_LUX_M7C;
+ } else if (ratio > TSL2561_LUX_K8C) {
+ b = TSL2561_LUX_B8C;
+ m = TSL2561_LUX_M8C;
+ }
#else
- if ((ratio >= 0) && (ratio <= TSL2561_LUX_K1T))
- {b=TSL2561_LUX_B1T; m=TSL2561_LUX_M1T;}
- else if (ratio <= TSL2561_LUX_K2T)
- {b=TSL2561_LUX_B2T; m=TSL2561_LUX_M2T;}
- else if (ratio <= TSL2561_LUX_K3T)
- {b=TSL2561_LUX_B3T; m=TSL2561_LUX_M3T;}
- else if (ratio <= TSL2561_LUX_K4T)
- {b=TSL2561_LUX_B4T; m=TSL2561_LUX_M4T;}
- else if (ratio <= TSL2561_LUX_K5T)
- {b=TSL2561_LUX_B5T; m=TSL2561_LUX_M5T;}
- else if (ratio <= TSL2561_LUX_K6T)
- {b=TSL2561_LUX_B6T; m=TSL2561_LUX_M6T;}
- else if (ratio <= TSL2561_LUX_K7T)
- {b=TSL2561_LUX_B7T; m=TSL2561_LUX_M7T;}
- else if (ratio > TSL2561_LUX_K8T)
- {b=TSL2561_LUX_B8T; m=TSL2561_LUX_M8T;}
+ if ((ratio >= 0) && (ratio <= TSL2561_LUX_K1T)) {
+ b = TSL2561_LUX_B1T;
+ m = TSL2561_LUX_M1T;
+ } else if (ratio <= TSL2561_LUX_K2T) {
+ b = TSL2561_LUX_B2T;
+ m = TSL2561_LUX_M2T;
+ } else if (ratio <= TSL2561_LUX_K3T) {
+ b = TSL2561_LUX_B3T;
+ m = TSL2561_LUX_M3T;
+ } else if (ratio <= TSL2561_LUX_K4T) {
+ b = TSL2561_LUX_B4T;
+ m = TSL2561_LUX_M4T;
+ } else if (ratio <= TSL2561_LUX_K5T) {
+ b = TSL2561_LUX_B5T;
+ m = TSL2561_LUX_M5T;
+ } else if (ratio <= TSL2561_LUX_K6T) {
+ b = TSL2561_LUX_B6T;
+ m = TSL2561_LUX_M6T;
+ } else if (ratio <= TSL2561_LUX_K7T) {
+ b = TSL2561_LUX_B7T;
+ m = TSL2561_LUX_M7T;
+ } else if (ratio > TSL2561_LUX_K8T) {
+ b = TSL2561_LUX_B8T;
+ m = TSL2561_LUX_M8T;
+ }
#endif
unsigned long temp;
channel0 = channel0 * b;
channel1 = channel1 * m;
-
+
temp = 0;
/* Do not allow negative lux value */
- if (channel0 > channel1) temp = channel0 - channel1;
+ if (channel0 > channel1)
+ temp = channel0 - channel1;
/* Round lsb (2^(LUX_SCALE-1)) */
- temp += (1 << (TSL2561_LUX_LUXSCALE-1));
+ temp += (1 << (TSL2561_LUX_LUXSCALE - 1));
/* Strip off fractional portion */
uint32_t lux = temp >> TSL2561_LUX_LUXSCALE;
@@ -469,16 +473,15 @@ uint32_t Adafruit_TSL2561_Unified::calculateLux(uint16_t broadband, uint16_t ir)
false if sensor is saturated
*/
/**************************************************************************/
-bool Adafruit_TSL2561_Unified::getEvent(sensors_event_t *event)
-{
+bool Adafruit_TSL2561_Unified::getEvent(sensors_event_t *event) {
uint16_t broadband, ir;
/* Clear the event */
memset(event, 0, sizeof(sensors_event_t));
- event->version = sizeof(sensors_event_t);
+ event->version = sizeof(sensors_event_t);
event->sensor_id = _tsl2561SensorID;
- event->type = SENSOR_TYPE_LIGHT;
+ event->type = SENSOR_TYPE_LIGHT;
event->timestamp = millis();
/* Calculate the actual lux value */
@@ -498,25 +501,22 @@ bool Adafruit_TSL2561_Unified::getEvent(sensors_event_t *event)
details about the TSL2561 and its capabilities
*/
/**************************************************************************/
-void Adafruit_TSL2561_Unified::getSensor(sensor_t *sensor)
-{
+void Adafruit_TSL2561_Unified::getSensor(sensor_t *sensor) {
/* Clear the sensor_t object */
memset(sensor, 0, sizeof(sensor_t));
/* Insert the sensor name in the fixed length char array */
- strncpy (sensor->name, "TSL2561", sizeof(sensor->name) - 1);
- sensor->name[sizeof(sensor->name)- 1] = 0;
- sensor->version = 1;
- sensor->sensor_id = _tsl2561SensorID;
- sensor->type = SENSOR_TYPE_LIGHT;
- sensor->min_delay = 0;
- sensor->max_value = 17000.0; /* Based on trial and error ... confirm! */
- sensor->min_value = 1.0;
- sensor->resolution = 1.0;
+ strncpy(sensor->name, "TSL2561", sizeof(sensor->name) - 1);
+ sensor->name[sizeof(sensor->name) - 1] = 0;
+ sensor->version = 1;
+ sensor->sensor_id = _tsl2561SensorID;
+ sensor->type = SENSOR_TYPE_LIGHT;
+ sensor->min_delay = 0;
+ sensor->max_value = 17000.0; /* Based on trial and error ... confirm! */
+ sensor->min_value = 1.0;
+ sensor->resolution = 1.0;
}
-
-
/*========================================================================*/
/* PRIVATE FUNCTIONS */
/*========================================================================*/
@@ -528,8 +528,7 @@ void Adafruit_TSL2561_Unified::getSensor(sensor_t *sensor)
@param value The 8-bit value we're writing to the register
*/
/**************************************************************************/
-void Adafruit_TSL2561_Unified::write8 (uint8_t reg, uint8_t value)
-{
+void Adafruit_TSL2561_Unified::write8(uint8_t reg, uint8_t value) {
_i2c->beginTransmission(_addr);
_i2c->write(reg);
_i2c->write(value);
@@ -543,8 +542,7 @@ void Adafruit_TSL2561_Unified::write8 (uint8_t reg, uint8_t value)
@returns 8-bit value containing single byte data read
*/
/**************************************************************************/
-uint8_t Adafruit_TSL2561_Unified::read8(uint8_t reg)
-{
+uint8_t Adafruit_TSL2561_Unified::read8(uint8_t reg) {
_i2c->beginTransmission(_addr);
_i2c->write(reg);
_i2c->endTransmission();
@@ -560,8 +558,7 @@ uint8_t Adafruit_TSL2561_Unified::read8(uint8_t reg)
@returns 16-bit value containing 2-byte data read
*/
/**************************************************************************/
-uint16_t Adafruit_TSL2561_Unified::read16(uint8_t reg)
-{
+uint16_t Adafruit_TSL2561_Unified::read16(uint8_t reg) {
uint16_t x, t;
_i2c->beginTransmission(_addr);
diff --git a/Adafruit_TSL2561_U.h b/Adafruit_TSL2561_U.h
index e1aa191..202ce32 100644
--- a/Adafruit_TSL2561_U.h
+++ b/Adafruit_TSL2561_U.h
@@ -21,183 +21,183 @@
#ifndef ADAFRUIT_TSL2561_H_
#define ADAFRUIT_TSL2561_H_
-#include
#include
+#include
#include
-#define TSL2561_VISIBLE 2 ///< channel 0 - channel 1
-#define TSL2561_INFRARED 1 ///< channel 1
-#define TSL2561_FULLSPECTRUM 0 ///< channel 0
+#define TSL2561_VISIBLE 2 ///< channel 0 - channel 1
+#define TSL2561_INFRARED 1 ///< channel 1
+#define TSL2561_FULLSPECTRUM 0 ///< channel 0
// I2C address options
-#define TSL2561_ADDR_LOW (0x29) ///< Default address (pin pulled low)
-#define TSL2561_ADDR_FLOAT (0x39) ///< Default address (pin left floating)
-#define TSL2561_ADDR_HIGH (0x49) ///< Default address (pin pulled high)
+#define TSL2561_ADDR_LOW (0x29) ///< Default address (pin pulled low)
+#define TSL2561_ADDR_FLOAT (0x39) ///< Default address (pin left floating)
+#define TSL2561_ADDR_HIGH (0x49) ///< Default address (pin pulled high)
// Lux calculations differ slightly for CS package
-//#define TSL2561_PACKAGE_CS ///< Chip scale package
-#define TSL2561_PACKAGE_T_FN_CL ///< Dual Flat No-Lead package
+//#define TSL2561_PACKAGE_CS ///< Chip scale package
+#define TSL2561_PACKAGE_T_FN_CL ///< Dual Flat No-Lead package
-#define TSL2561_COMMAND_BIT (0x80) ///< Must be 1
-#define TSL2561_CLEAR_BIT (0x40) ///< Clears any pending interrupt (write 1 to clear)
-#define TSL2561_WORD_BIT (0x20) ///< 1 = read/write word (rather than byte)
-#define TSL2561_BLOCK_BIT (0x10) ///< 1 = using block read/write
+#define TSL2561_COMMAND_BIT (0x80) ///< Must be 1
+#define TSL2561_CLEAR_BIT \
+ (0x40) ///< Clears any pending interrupt (write 1 to clear)
+#define TSL2561_WORD_BIT (0x20) ///< 1 = read/write word (rather than byte)
+#define TSL2561_BLOCK_BIT (0x10) ///< 1 = using block read/write
-#define TSL2561_CONTROL_POWERON (0x03) ///< Control register setting to turn on
-#define TSL2561_CONTROL_POWEROFF (0x00) ///< Control register setting to turn off
+#define TSL2561_CONTROL_POWERON (0x03) ///< Control register setting to turn on
+#define TSL2561_CONTROL_POWEROFF \
+ (0x00) ///< Control register setting to turn off
-#define TSL2561_LUX_LUXSCALE (14) ///< Scale by 2^14
-#define TSL2561_LUX_RATIOSCALE (9) ///< Scale ratio by 2^9
-#define TSL2561_LUX_CHSCALE (10) ///< Scale channel values by 2^10
-#define TSL2561_LUX_CHSCALE_TINT0 (0x7517) ///< 322/11 * 2^TSL2561_LUX_CHSCALE
-#define TSL2561_LUX_CHSCALE_TINT1 (0x0FE7) ///< 322/81 * 2^TSL2561_LUX_CHSCALE
+#define TSL2561_LUX_LUXSCALE (14) ///< Scale by 2^14
+#define TSL2561_LUX_RATIOSCALE (9) ///< Scale ratio by 2^9
+#define TSL2561_LUX_CHSCALE (10) ///< Scale channel values by 2^10
+#define TSL2561_LUX_CHSCALE_TINT0 (0x7517) ///< 322/11 * 2^TSL2561_LUX_CHSCALE
+#define TSL2561_LUX_CHSCALE_TINT1 (0x0FE7) ///< 322/81 * 2^TSL2561_LUX_CHSCALE
// T, FN and CL package values
-#define TSL2561_LUX_K1T (0x0040) ///< 0.125 * 2^RATIO_SCALE
-#define TSL2561_LUX_B1T (0x01f2) ///< 0.0304 * 2^LUX_SCALE
-#define TSL2561_LUX_M1T (0x01be) ///< 0.0272 * 2^LUX_SCALE
-#define TSL2561_LUX_K2T (0x0080) ///< 0.250 * 2^RATIO_SCALE
-#define TSL2561_LUX_B2T (0x0214) ///< 0.0325 * 2^LUX_SCALE
-#define TSL2561_LUX_M2T (0x02d1) ///< 0.0440 * 2^LUX_SCALE
-#define TSL2561_LUX_K3T (0x00c0) ///< 0.375 * 2^RATIO_SCALE
-#define TSL2561_LUX_B3T (0x023f) ///< 0.0351 * 2^LUX_SCALE
-#define TSL2561_LUX_M3T (0x037b) ///< 0.0544 * 2^LUX_SCALE
-#define TSL2561_LUX_K4T (0x0100) ///< 0.50 * 2^RATIO_SCALE
-#define TSL2561_LUX_B4T (0x0270) ///< 0.0381 * 2^LUX_SCALE
-#define TSL2561_LUX_M4T (0x03fe) ///< 0.0624 * 2^LUX_SCALE
-#define TSL2561_LUX_K5T (0x0138) ///< 0.61 * 2^RATIO_SCALE
-#define TSL2561_LUX_B5T (0x016f) ///< 0.0224 * 2^LUX_SCALE
-#define TSL2561_LUX_M5T (0x01fc) ///< 0.0310 * 2^LUX_SCALE
-#define TSL2561_LUX_K6T (0x019a) ///< 0.80 * 2^RATIO_SCALE
-#define TSL2561_LUX_B6T (0x00d2) ///< 0.0128 * 2^LUX_SCALE
-#define TSL2561_LUX_M6T (0x00fb) ///< 0.0153 * 2^LUX_SCALE
-#define TSL2561_LUX_K7T (0x029a) ///< 1.3 * 2^RATIO_SCALE
-#define TSL2561_LUX_B7T (0x0018) ///< 0.00146 * 2^LUX_SCALE
-#define TSL2561_LUX_M7T (0x0012) ///< 0.00112 * 2^LUX_SCALE
-#define TSL2561_LUX_K8T (0x029a) ///< 1.3 * 2^RATIO_SCALE
-#define TSL2561_LUX_B8T (0x0000) ///< 0.000 * 2^LUX_SCALE
-#define TSL2561_LUX_M8T (0x0000) ///< 0.000 * 2^LUX_SCALE
+#define TSL2561_LUX_K1T (0x0040) ///< 0.125 * 2^RATIO_SCALE
+#define TSL2561_LUX_B1T (0x01f2) ///< 0.0304 * 2^LUX_SCALE
+#define TSL2561_LUX_M1T (0x01be) ///< 0.0272 * 2^LUX_SCALE
+#define TSL2561_LUX_K2T (0x0080) ///< 0.250 * 2^RATIO_SCALE
+#define TSL2561_LUX_B2T (0x0214) ///< 0.0325 * 2^LUX_SCALE
+#define TSL2561_LUX_M2T (0x02d1) ///< 0.0440 * 2^LUX_SCALE
+#define TSL2561_LUX_K3T (0x00c0) ///< 0.375 * 2^RATIO_SCALE
+#define TSL2561_LUX_B3T (0x023f) ///< 0.0351 * 2^LUX_SCALE
+#define TSL2561_LUX_M3T (0x037b) ///< 0.0544 * 2^LUX_SCALE
+#define TSL2561_LUX_K4T (0x0100) ///< 0.50 * 2^RATIO_SCALE
+#define TSL2561_LUX_B4T (0x0270) ///< 0.0381 * 2^LUX_SCALE
+#define TSL2561_LUX_M4T (0x03fe) ///< 0.0624 * 2^LUX_SCALE
+#define TSL2561_LUX_K5T (0x0138) ///< 0.61 * 2^RATIO_SCALE
+#define TSL2561_LUX_B5T (0x016f) ///< 0.0224 * 2^LUX_SCALE
+#define TSL2561_LUX_M5T (0x01fc) ///< 0.0310 * 2^LUX_SCALE
+#define TSL2561_LUX_K6T (0x019a) ///< 0.80 * 2^RATIO_SCALE
+#define TSL2561_LUX_B6T (0x00d2) ///< 0.0128 * 2^LUX_SCALE
+#define TSL2561_LUX_M6T (0x00fb) ///< 0.0153 * 2^LUX_SCALE
+#define TSL2561_LUX_K7T (0x029a) ///< 1.3 * 2^RATIO_SCALE
+#define TSL2561_LUX_B7T (0x0018) ///< 0.00146 * 2^LUX_SCALE
+#define TSL2561_LUX_M7T (0x0012) ///< 0.00112 * 2^LUX_SCALE
+#define TSL2561_LUX_K8T (0x029a) ///< 1.3 * 2^RATIO_SCALE
+#define TSL2561_LUX_B8T (0x0000) ///< 0.000 * 2^LUX_SCALE
+#define TSL2561_LUX_M8T (0x0000) ///< 0.000 * 2^LUX_SCALE
// CS package values
-#define TSL2561_LUX_K1C (0x0043) ///< 0.130 * 2^RATIO_SCALE
-#define TSL2561_LUX_B1C (0x0204) ///< 0.0315 * 2^LUX_SCALE
-#define TSL2561_LUX_M1C (0x01ad) ///< 0.0262 * 2^LUX_SCALE
-#define TSL2561_LUX_K2C (0x0085) ///< 0.260 * 2^RATIO_SCALE
-#define TSL2561_LUX_B2C (0x0228) ///< 0.0337 * 2^LUX_SCALE
-#define TSL2561_LUX_M2C (0x02c1) ///< 0.0430 * 2^LUX_SCALE
-#define TSL2561_LUX_K3C (0x00c8) ///< 0.390 * 2^RATIO_SCALE
-#define TSL2561_LUX_B3C (0x0253) ///< 0.0363 * 2^LUX_SCALE
-#define TSL2561_LUX_M3C (0x0363) ///< 0.0529 * 2^LUX_SCALE
-#define TSL2561_LUX_K4C (0x010a) ///< 0.520 * 2^RATIO_SCALE
-#define TSL2561_LUX_B4C (0x0282) ///< 0.0392 * 2^LUX_SCALE
-#define TSL2561_LUX_M4C (0x03df) ///< 0.0605 * 2^LUX_SCALE
-#define TSL2561_LUX_K5C (0x014d) ///< 0.65 * 2^RATIO_SCALE
-#define TSL2561_LUX_B5C (0x0177) ///< 0.0229 * 2^LUX_SCALE
-#define TSL2561_LUX_M5C (0x01dd) ///< 0.0291 * 2^LUX_SCALE
-#define TSL2561_LUX_K6C (0x019a) ///< 0.80 * 2^RATIO_SCALE
-#define TSL2561_LUX_B6C (0x0101) ///< 0.0157 * 2^LUX_SCALE
-#define TSL2561_LUX_M6C (0x0127) ///< 0.0180 * 2^LUX_SCALE
-#define TSL2561_LUX_K7C (0x029a) ///< 1.3 * 2^RATIO_SCALE
-#define TSL2561_LUX_B7C (0x0037) ///< 0.00338 * 2^LUX_SCALE
-#define TSL2561_LUX_M7C (0x002b) ///< 0.00260 * 2^LUX_SCALE
-#define TSL2561_LUX_K8C (0x029a) ///< 1.3 * 2^RATIO_SCALE
-#define TSL2561_LUX_B8C (0x0000) ///< 0.000 * 2^LUX_SCALE
-#define TSL2561_LUX_M8C (0x0000) ///< 0.000 * 2^LUX_SCALE
+#define TSL2561_LUX_K1C (0x0043) ///< 0.130 * 2^RATIO_SCALE
+#define TSL2561_LUX_B1C (0x0204) ///< 0.0315 * 2^LUX_SCALE
+#define TSL2561_LUX_M1C (0x01ad) ///< 0.0262 * 2^LUX_SCALE
+#define TSL2561_LUX_K2C (0x0085) ///< 0.260 * 2^RATIO_SCALE
+#define TSL2561_LUX_B2C (0x0228) ///< 0.0337 * 2^LUX_SCALE
+#define TSL2561_LUX_M2C (0x02c1) ///< 0.0430 * 2^LUX_SCALE
+#define TSL2561_LUX_K3C (0x00c8) ///< 0.390 * 2^RATIO_SCALE
+#define TSL2561_LUX_B3C (0x0253) ///< 0.0363 * 2^LUX_SCALE
+#define TSL2561_LUX_M3C (0x0363) ///< 0.0529 * 2^LUX_SCALE
+#define TSL2561_LUX_K4C (0x010a) ///< 0.520 * 2^RATIO_SCALE
+#define TSL2561_LUX_B4C (0x0282) ///< 0.0392 * 2^LUX_SCALE
+#define TSL2561_LUX_M4C (0x03df) ///< 0.0605 * 2^LUX_SCALE
+#define TSL2561_LUX_K5C (0x014d) ///< 0.65 * 2^RATIO_SCALE
+#define TSL2561_LUX_B5C (0x0177) ///< 0.0229 * 2^LUX_SCALE
+#define TSL2561_LUX_M5C (0x01dd) ///< 0.0291 * 2^LUX_SCALE
+#define TSL2561_LUX_K6C (0x019a) ///< 0.80 * 2^RATIO_SCALE
+#define TSL2561_LUX_B6C (0x0101) ///< 0.0157 * 2^LUX_SCALE
+#define TSL2561_LUX_M6C (0x0127) ///< 0.0180 * 2^LUX_SCALE
+#define TSL2561_LUX_K7C (0x029a) ///< 1.3 * 2^RATIO_SCALE
+#define TSL2561_LUX_B7C (0x0037) ///< 0.00338 * 2^LUX_SCALE
+#define TSL2561_LUX_M7C (0x002b) ///< 0.00260 * 2^LUX_SCALE
+#define TSL2561_LUX_K8C (0x029a) ///< 1.3 * 2^RATIO_SCALE
+#define TSL2561_LUX_B8C (0x0000) ///< 0.000 * 2^LUX_SCALE
+#define TSL2561_LUX_M8C (0x0000) ///< 0.000 * 2^LUX_SCALE
// Auto-gain thresholds
-#define TSL2561_AGC_THI_13MS (4850) ///< Max value at Ti 13ms = 5047
-#define TSL2561_AGC_TLO_13MS (100) ///< Min value at Ti 13ms = 100
-#define TSL2561_AGC_THI_101MS (36000) ///< Max value at Ti 101ms = 37177
-#define TSL2561_AGC_TLO_101MS (200) ///< Min value at Ti 101ms = 200
-#define TSL2561_AGC_THI_402MS (63000) ///< Max value at Ti 402ms = 65535
-#define TSL2561_AGC_TLO_402MS (500) ///< Min value at Ti 402ms = 500
+#define TSL2561_AGC_THI_13MS (4850) ///< Max value at Ti 13ms = 5047
+#define TSL2561_AGC_TLO_13MS (100) ///< Min value at Ti 13ms = 100
+#define TSL2561_AGC_THI_101MS (36000) ///< Max value at Ti 101ms = 37177
+#define TSL2561_AGC_TLO_101MS (200) ///< Min value at Ti 101ms = 200
+#define TSL2561_AGC_THI_402MS (63000) ///< Max value at Ti 402ms = 65535
+#define TSL2561_AGC_TLO_402MS (500) ///< Min value at Ti 402ms = 500
// Clipping thresholds
-#define TSL2561_CLIPPING_13MS (4900) ///< # Counts that trigger a change in gain/integration
-#define TSL2561_CLIPPING_101MS (37000) ///< # Counts that trigger a change in gain/integration
-#define TSL2561_CLIPPING_402MS (65000) ///< # Counts that trigger a change in gain/integration
+#define TSL2561_CLIPPING_13MS \
+ (4900) ///< # Counts that trigger a change in gain/integration
+#define TSL2561_CLIPPING_101MS \
+ (37000) ///< # Counts that trigger a change in gain/integration
+#define TSL2561_CLIPPING_402MS \
+ (65000) ///< # Counts that trigger a change in gain/integration
// Delay for integration times
-#define TSL2561_DELAY_INTTIME_13MS (15) ///< Wait 15ms for 13ms integration
-#define TSL2561_DELAY_INTTIME_101MS (120) ///< Wait 120ms for 101ms integration
-#define TSL2561_DELAY_INTTIME_402MS (450) ///< Wait 450ms for 402ms integration
+#define TSL2561_DELAY_INTTIME_13MS (15) ///< Wait 15ms for 13ms integration
+#define TSL2561_DELAY_INTTIME_101MS (120) ///< Wait 120ms for 101ms integration
+#define TSL2561_DELAY_INTTIME_402MS (450) ///< Wait 450ms for 402ms integration
/** TSL2561 I2C Registers */
-enum
-{
- TSL2561_REGISTER_CONTROL = 0x00, // Control/power register
- TSL2561_REGISTER_TIMING = 0x01, // Set integration time register
- TSL2561_REGISTER_THRESHHOLDL_LOW = 0x02, // Interrupt low threshold low-byte
+enum {
+ TSL2561_REGISTER_CONTROL = 0x00, // Control/power register
+ TSL2561_REGISTER_TIMING = 0x01, // Set integration time register
+ TSL2561_REGISTER_THRESHHOLDL_LOW = 0x02, // Interrupt low threshold low-byte
TSL2561_REGISTER_THRESHHOLDL_HIGH = 0x03, // Interrupt low threshold high-byte
- TSL2561_REGISTER_THRESHHOLDH_LOW = 0x04, // Interrupt high threshold low-byte
- TSL2561_REGISTER_THRESHHOLDH_HIGH = 0x05, // Interrupt high threshold high-byte
- TSL2561_REGISTER_INTERRUPT = 0x06, // Interrupt settings
- TSL2561_REGISTER_CRC = 0x08, // Factory use only
- TSL2561_REGISTER_ID = 0x0A, // TSL2561 identification setting
- TSL2561_REGISTER_CHAN0_LOW = 0x0C, // Light data channel 0, low byte
- TSL2561_REGISTER_CHAN0_HIGH = 0x0D, // Light data channel 0, high byte
- TSL2561_REGISTER_CHAN1_LOW = 0x0E, // Light data channel 1, low byte
- TSL2561_REGISTER_CHAN1_HIGH = 0x0F // Light data channel 1, high byte
+ TSL2561_REGISTER_THRESHHOLDH_LOW = 0x04, // Interrupt high threshold low-byte
+ TSL2561_REGISTER_THRESHHOLDH_HIGH =
+ 0x05, // Interrupt high threshold high-byte
+ TSL2561_REGISTER_INTERRUPT = 0x06, // Interrupt settings
+ TSL2561_REGISTER_CRC = 0x08, // Factory use only
+ TSL2561_REGISTER_ID = 0x0A, // TSL2561 identification setting
+ TSL2561_REGISTER_CHAN0_LOW = 0x0C, // Light data channel 0, low byte
+ TSL2561_REGISTER_CHAN0_HIGH = 0x0D, // Light data channel 0, high byte
+ TSL2561_REGISTER_CHAN1_LOW = 0x0E, // Light data channel 1, low byte
+ TSL2561_REGISTER_CHAN1_HIGH = 0x0F // Light data channel 1, high byte
};
/** Three options for how long to integrate readings for */
-typedef enum
-{
- TSL2561_INTEGRATIONTIME_13MS = 0x00, // 13.7ms
- TSL2561_INTEGRATIONTIME_101MS = 0x01, // 101ms
- TSL2561_INTEGRATIONTIME_402MS = 0x02 // 402ms
-}
-tsl2561IntegrationTime_t;
+typedef enum {
+ TSL2561_INTEGRATIONTIME_13MS = 0x00, // 13.7ms
+ TSL2561_INTEGRATIONTIME_101MS = 0x01, // 101ms
+ TSL2561_INTEGRATIONTIME_402MS = 0x02 // 402ms
+} tsl2561IntegrationTime_t;
/** TSL2561 offers 2 gain settings */
-typedef enum
-{
- TSL2561_GAIN_1X = 0x00, // No gain
- TSL2561_GAIN_16X = 0x10, // 16x gain
-}
-tsl2561Gain_t;
-
-
+typedef enum {
+ TSL2561_GAIN_1X = 0x00, // No gain
+ TSL2561_GAIN_16X = 0x10, // 16x gain
+} tsl2561Gain_t;
/**************************************************************************/
-/*!
- @brief Class that stores state and functions for interacting with TSL2561 Light Sensor
+/*!
+ @brief Class that stores state and functions for interacting with TSL2561
+ Light Sensor
*/
/**************************************************************************/
class Adafruit_TSL2561_Unified : public Adafruit_Sensor {
- public:
+public:
Adafruit_TSL2561_Unified(uint8_t addr, int32_t sensorID = -1);
boolean begin(void);
boolean begin(TwoWire *theWire);
boolean init();
-
+
/* TSL2561 Functions */
void enableAutoRange(bool enable);
void setIntegrationTime(tsl2561IntegrationTime_t time);
void setGain(tsl2561Gain_t gain);
- void getLuminosity (uint16_t *broadband, uint16_t *ir);
+ void getLuminosity(uint16_t *broadband, uint16_t *ir);
uint32_t calculateLux(uint16_t broadband, uint16_t ir);
-
- /* Unified Sensor API Functions */
- bool getEvent(sensors_event_t*);
- void getSensor(sensor_t*);
- private:
+ /* Unified Sensor API Functions */
+ bool getEvent(sensors_event_t *);
+ void getSensor(sensor_t *);
+
+private:
TwoWire *_i2c;
-
+
int8_t _addr;
boolean _tsl2561Initialised;
boolean _tsl2561AutoGain;
tsl2561IntegrationTime_t _tsl2561IntegrationTime;
tsl2561Gain_t _tsl2561Gain;
int32_t _tsl2561SensorID;
-
- void enable (void);
- void disable (void);
- void write8 (uint8_t reg, uint8_t value);
- uint8_t read8 (uint8_t reg);
- uint16_t read16 (uint8_t reg);
- void getData (uint16_t *broadband, uint16_t *ir);
+
+ void enable(void);
+ void disable(void);
+ void write8(uint8_t reg, uint8_t value);
+ uint8_t read8(uint8_t reg);
+ uint16_t read16(uint8_t reg);
+ void getData(uint16_t *broadband, uint16_t *ir);
};
#endif // ADAFRUIT_TSL2561_H
diff --git a/README.md b/README.md
index c63d59f..9c1f75e 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Adafruit TSL2561 Light Sensor Driver [](https://travis-ci.com/adafruit/Adafruit_TSL2561)
+# Adafruit TSL2561 Light Sensor Driver [](https://github.com/adafruit/Adafruit_TSL2561/actions)[](http://adafruit.github.io/Adafruit_TSL2561/html/index.html)
This driver is for the Adafruit TSL2561 Breakout, and is based on Adafruit's Unified Sensor Library (Adafruit_Sensor).
diff --git a/library.properties b/library.properties
index ab74d51..db19009 100644
--- a/library.properties
+++ b/library.properties
@@ -1,5 +1,5 @@
name=Adafruit TSL2561
-version=1.0.3
+version=1.1.0
author=Adafruit
maintainer=Adafruit
sentence=Unified sensor driver for Adafruit's TSL2561 breakouts
@@ -7,3 +7,4 @@ paragraph=Unified sensor driver for Adafruit's TSL2561 breakouts
category=Sensors
url=https://github.com/adafruit/Adafruit_TSL2561
architectures=*
+depends=Adafruit Unified Sensor