Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from 107-systems/initial_release
Browse files Browse the repository at this point in the history
added support for esp8266
  • Loading branch information
generationmake authored Feb 8, 2022
2 parents 8a820be + f162ef2 commit 073e477
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-arduino.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ jobs:
uses: arduino/arduino-lint-action@v1
with:
compliance: specification
library-manager: update
library-manager: submit
project-type: library
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Alexander Entinger, LXRobotics GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<a href="https://107-systems.org/"><img align="right" src="https://raw.githubusercontent.com/107-systems/.github/main/logo/107-systems.png" width="15%"></a>
`107-Arduino-TSL2550`
=====================
[![Arduino Library Badge](https://www.ardu-badge.com/badge/107-Arduino-TSL2550.svg?)](https://www.ardu-badge.com/107-Arduino-TMF8801)
[![Arduino Library Badge](https://www.ardu-badge.com/badge/107-Arduino-TSL2550.svg?)](https://www.ardu-badge.com/107-Arduino-TSL2550)
[![Compile Examples](https://github.com/107-systems/107-Arduino-TSL2550/workflows/Compile%20Examples/badge.svg)](https://github.com/107-systems/107-Arduino-TSL2550/actions?workflow=Compile+Examples)
[![Check Arduino](https://github.com/107-systems/107-Arduino-TSL2550/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/107-systems/107-Arduino-TSL2550/actions/workflows/check-arduino.yml)
[![Check keywords.txt](https://github.com/107-systems/107-Arduino-TSL2550/actions/workflows/check-keywords-txt.yml/badge.svg)](https://github.com/107-systems/107-Arduino-TSL2550/actions/workflows/check-keywords-txt.yml)
Expand All @@ -18,5 +18,4 @@ This library works for
* [ArduinoCore-samd](https://github.com/arduino/ArduinoCore-samd): [`Arduino Zero`](https://store.arduino.cc/arduino-zero), [`MKR 1000`](https://store.arduino.cc/arduino-mkr1000-wifi), [`MKR WiFi 1010`](https://store.arduino.cc/arduino-mkr-wifi-1010), [`Nano 33 IoT`](https://store.arduino.cc/arduino-nano-33-iot), [`MKR GSM 1400`](https://store.arduino.cc/arduino-mkr-gsm-1400-1415), [`MKR NB 1500`](https://store.arduino.cc/arduino-mkr-nb-1500-1413), [`MKR WAN 1300/1310`](https://store.arduino.cc/mkr-wan-1310) :heavy_check_mark:
* [ArduinoCore-mbed](https://github.com/arduino/ArduinoCore-mbed): [`Portenta H7`](https://store.arduino.cc/portenta-h7), [`Nano 33 BLE`](https://store.arduino.cc/arduino-nano-33-ble), [`Nano RP2040 Connect`](https://store.arduino.cc/nano-rp2040-connect), [`Edge Control`](https://store.arduino.cc/edge-control) :heavy_check_mark:
* [arduino-esp32](https://github.com/espressif/arduino-esp32): `ESP32 Dev Module`, `ESP32 Wrover Module`, ... :heavy_check_mark:


* [arduino-esp8266](https://github.com/esp8266/Arduino) :heavy_check_mark:
1 change: 1 addition & 0 deletions extras/codespell-ignore-words-list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wan
18 changes: 8 additions & 10 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@ TSL2550_Io KEYWORD1
# Methods and Functions (KEYWORD2)
#######################################

angle_raw KEYWORD2
read KEYWORD2
write KEYWORD2
get_lux KEYWORD2
powerdown KEYWORD2

#######################################
# Constants (LITERAL1)
#######################################

TSL2550_ClearErrorFlag LITERAL1
TSL2550_ProgrammingControl LITERAL1
TSL2550_OTP_RegisterZeroPosition_HIGH LITERAL1
TSL2550_OTP_RegisterZeroPosition_LOW LITERAL1
TSL2550_Diagnostics_AutomaticGainControl LITERAL1
TSL2550_Magnitude LITERAL1
TSL2550_Angle LITERAL1
TSL2550_PowerDownState LITERAL1
TSL2550_ReadCommandRegister LITERAL1
TSL2550_WriteCommandExtendedRange LITERAL1
TSL2550_WriteCommandStandardRange LITERAL1
TSL2550_ReadADCChannel0 LITERAL1
TSL2550_ReadADCChannel1 LITERAL1
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ sentence=Arduino library for TSL2550 ambient light sensor
paragraph=
category=Sensors
url=https://github.com/107-systems/107-Arduino-TSL2550
architectures=samd,mbed,mbed_nano,mbed_portenta,mbed_edge
architectures=samd,mbed,mbed_nano,mbed_portenta,mbed_edge,esp8266
includes=107-Arduino-TSL2550.h
depends=107-Arduino-Sensor
21 changes: 7 additions & 14 deletions src/107-Arduino-TSL2550.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,34 +66,27 @@ float ArduinoTSL2550::get_lux()
adc_0_chord=(adc_0&0xf0)>>4;;
adc_0_step=adc_0&0x0f;
adc_0_count=((33*((1<<adc_0_chord)-1))>>1)+(adc_0_step*(1<<adc_0_chord));
// Serial.print("ADC channel 0: ");
// Serial.println(adc_0_count);


adc_1=adc_1&0x7f; // remove valid bit
adc_1_chord=(adc_1&0xf0)>>4;;
adc_1_step=adc_1&0x0f;
adc_1_count=((33*((1<<adc_1_chord)-1))>>1)+(adc_1_step*(1<<adc_1_chord));
// Serial.print("ADC channel 1: ");
// Serial.println( adc_1_count);


if((adc_0_count-adc_1_count)!=0)
{
r=(float)adc_1_count/((float)(adc_0_count-adc_1_count));
light_level=(float)(adc_0_count-adc_1_count)*5.0*0.39*exp(-0.181*r*r);

// Serial.print("R = ");
// Serial.println(r);
// Serial.print("Light level = ");
// Serial.print(light_level);
// Serial.println(" lux");
}

return light_level;
}

void ArduinoTSL2550::powerdown()
{
_io.write(TSL2550::Register::TSL2550_PowerDownState);
}

TSL2550::Error ArduinoTSL2550::error()
{
return _error;
}


1 change: 1 addition & 0 deletions src/107-Arduino-TSL2550.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class ArduinoTSL2550

bool begin(bool const use_extended);
float get_lux();
void powerdown();

TSL2550::Error error();

Expand Down

0 comments on commit 073e477

Please sign in to comment.