diff --git a/libraries/SHT2x/.arduino-ci.yml b/libraries/SHT2x/.arduino-ci.yml index 593d2f7c..b4ab412d 100644 --- a/libraries/SHT2x/.arduino-ci.yml +++ b/libraries/SHT2x/.arduino-ci.yml @@ -1,3 +1,18 @@ +platforms: + rpipico: + board: rp2040:rp2040:rpipico + package: rp2040:rp2040 + gcc: + features: + defines: + - ARDUINO_ARCH_RP2040 + warnings: + flags: + +packages: + rp2040:rp2040: + url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json + compile: # Choosing to run compilation tests on 2 different Arduino platforms platforms: @@ -7,5 +22,6 @@ compile: # - leonardo - m4 - esp32 - # - esp8266 - #- mega2560 + - esp8266 + # - mega2560 + - rpipico diff --git a/libraries/SHT2x/CHANGELOG.md b/libraries/SHT2x/CHANGELOG.md new file mode 100644 index 00000000..cd260a41 --- /dev/null +++ b/libraries/SHT2x/CHANGELOG.md @@ -0,0 +1,43 @@ +# Change Log SHT2x + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + +## [0.2.1] - 2022-11-24 +- Add RP2040 support to build-CI. +- Add CHANGELOG.md + + +## [0.2.0] - 2022-07-10 +- Fix #11 RawTemp + rawHum (kudos to theandy94) +- add experimental getResolution() + setResolution() +- adjust read delay +- add experimental batteryOK() +- add CRC in read() - no fail. + +---- + +## [0.1.4] - 2022-06-21 +- Fix #9 ESP32 wire.begin() +- Fix getEIDB() bug. + +## [0.1.3] - 2021-12-28 +- update library.json +- update license +- minor edits + +## [0.1.2] - 2021-09-29 +- Add Si70xx derived classes +- add getEIDA(), getEIDB(), getFirmwareVersion() +- update build-CI, readme.md badges + +## [0.1.1] - 2021-09-28 +- Add HTU2x derived classes, +- update readme.md + add some status info + +## [0.1.0] - 2021-09-25 +- initial version + diff --git a/libraries/SHT2x/README.md b/libraries/SHT2x/README.md index 27db3014..e5f67eed 100644 --- a/libraries/SHT2x/README.md +++ b/libraries/SHT2x/README.md @@ -187,20 +187,11 @@ Timing in milliseconds. ## Future -- test test test - - get hardware -- investigate resolution anomalies +#### must - improve documentation -- fix TODO in code (.cpp and .h) -- add examples - - test resolutions - - performance different resolutions - - test battery -- update unit tests #### 0.3.0 - - add crc8 check (need sensor) - improve error handling (all code paths) - investigate blocking delay() in read @@ -208,6 +199,22 @@ Timing in milliseconds. - **void requestTemperature()** ==> **void readTemperature()** - **void requestHumidity()** ==> **void readHumidity()** + +#### should +- test test test + - get hardware +- add examples + - test resolutions + - performance different resolutions + - test battery + + +#### could +- investigate resolution anomalies +- fix TODO in code (.cpp and .h) +- update unit tests + + #### wont - add **getSerialNumber()** diff --git a/libraries/SHT2x/SHT2x.cpp b/libraries/SHT2x/SHT2x.cpp index 8e700ef6..421abe78 100644 --- a/libraries/SHT2x/SHT2x.cpp +++ b/libraries/SHT2x/SHT2x.cpp @@ -1,28 +1,10 @@ // // FILE: SHT2x.cpp // AUTHOR: Rob Tillaart, Viktor Balint -// VERSION: 0.2.0 +// VERSION: 0.2.1 // DATE: 2021-09-25 // PURPOSE: Arduino library for the SHT2x temperature and humidity sensor // URL: https://github.com/RobTillaart/SHT2x -// - -// HISTORY: -// 0.1.0 2021-09-25 initial version -// 0.1.1 2021-09-28 Add HTU2x derived classes, -// update readme.md + add some status info -// 0.1.2 2021-09-29 Add Si70xx derived classes -// add getEIDA(), getEIDB(), getFirmwareVersion() -// update build-CI, readme.md badges -// 0.1.3 2021-12-28 update library.json, license, minor edits -// 0.1.4 2022-06-21 Fix #9 ESP32 wire.begin() -// Fix getEIDB() bug. -// -// 0.2.0 2022-07-10 Fix #11 RawTemp + rawHum (kudos to theandy94) -// add experimental getResolution() + setResolution() -// adjust read delay -// add experimental batteryOK() -// add CRC in read() - no fail. #include "SHT2x.h" @@ -35,7 +17,7 @@ #define SHT2x_WRITE_USER_REGISTER 0xE6 #define SHT2x_READ_USER_REGISTER 0xE7 -#define SHT2x_HEATER_TIMEOUT 180000UL // milliseconds +#define SHT2x_HEATER_TIMEOUT 180000UL // milliseconds #define SHT2x_ADDRESS 0x40 diff --git a/libraries/SHT2x/SHT2x.h b/libraries/SHT2x/SHT2x.h index 7bf1ad16..1d907336 100644 --- a/libraries/SHT2x/SHT2x.h +++ b/libraries/SHT2x/SHT2x.h @@ -2,7 +2,7 @@ // // FILE: SHT2x.h // AUTHOR: Rob Tillaart, Viktor Balint -// VERSION: 0.2.0 +// VERSION: 0.2.1 // DATE: 2021-09-25 // PURPOSE: Arduino library for the SHT2x temperature and humidity sensor // URL: https://github.com/RobTillaart/SHT2x @@ -13,7 +13,7 @@ #include "Wire.h" -#define SHT2x_LIB_VERSION (F("0.2.0")) +#define SHT2x_LIB_VERSION (F("0.2.1")) // fields getStatus @@ -119,7 +119,7 @@ public: bool batteryOK(); -private: +protected: uint8_t crc8(const uint8_t *data, uint8_t len); bool writeCmd(uint8_t cmd); @@ -127,9 +127,9 @@ private: bool readBytes(uint8_t n, uint8_t *val, uint8_t maxDuration); TwoWire* _wire; - uint8_t _heatTimeout; // seconds + uint8_t _heatTimeout; // seconds uint32_t _lastRead; - uint32_t _lastRequest; // for async interface + uint32_t _lastRequest; // for async interface uint32_t _heaterStart; uint32_t _heaterStop; bool _heaterOn; diff --git a/libraries/SHT2x/examples/SHT2x_test_CRC/.arduino-ci.yml b/libraries/SHT2x/examples/SHT2x_test_CRC/.arduino-ci.yml new file mode 100644 index 00000000..59aad72b --- /dev/null +++ b/libraries/SHT2x/examples/SHT2x_test_CRC/.arduino-ci.yml @@ -0,0 +1,27 @@ +platforms: + rpipico: + board: rp2040:rp2040:rpipico + package: rp2040:rp2040 + gcc: + features: + defines: + - ARDUINO_ARCH_RP2040 + warnings: + flags: + +packages: + rp2040:rp2040: + url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json + +compile: + # Choosing to run compilation tests on 2 different Arduino platforms + platforms: + # - uno + # - due + # - zero + # - leonardo + # - m4 + # - esp32 + # - esp8266 + # - mega2560 + # - rpipico diff --git a/libraries/SHT2x/examples/SHT2x_test_CRC/SHT2x_test_CRC.ino b/libraries/SHT2x/examples/SHT2x_test_CRC/SHT2x_test_CRC.ino new file mode 100644 index 00000000..09b7fae1 --- /dev/null +++ b/libraries/SHT2x/examples/SHT2x_test_CRC/SHT2x_test_CRC.ino @@ -0,0 +1,41 @@ +// +// FILE: SHT2x_demo.ino +// AUTHOR: Rob Tillaart +// PURPOSE: demo +// URL: https://github.com/RobTillaart/SHT2x + + +#include "Wire.h" +#include "SHT2x.h" + +uint32_t start; +uint32_t stop; + +SHT2x sht; + + +void setup() +{ + Serial.begin(115200); + Serial.println(__FILE__); + Serial.print("SHT2x_LIB_VERSION: \t"); + Serial.println(SHT2x_LIB_VERSION); + + sht.begin(); + +// uint8_t buf[3] = { 0x7C, 0x82, 0 }; +// Serial.println(sht.crc8(buf, 2), HEX); // 97 +// uint8_t buf[3] = { 0x68, 0x3A, 0 }; +// Serial.println(sht.crc8(buf, 2), HEX); // 7C + uint8_t buf[3] = { 0x4E, 0x85, 0 }; + Serial.println(sht.crc8(buf, 2), HEX); // 6B +} + + +void loop() +{ + +} + + +// -- END OF FILE -- diff --git a/libraries/SHT2x/library.json b/libraries/SHT2x/library.json index 58d0b24e..fe11faeb 100644 --- a/libraries/SHT2x/library.json +++ b/libraries/SHT2x/library.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/RobTillaart/SHT2x.git" }, - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "frameworks": "arduino", "platforms": "*", diff --git a/libraries/SHT2x/library.properties b/libraries/SHT2x/library.properties index c787dcfd..cf208603 100644 --- a/libraries/SHT2x/library.properties +++ b/libraries/SHT2x/library.properties @@ -1,5 +1,5 @@ name=SHT2x -version=0.2.0 +version=0.2.1 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for the I2C SHT20 SHT21 SHT25 series temperature and humidity sensor.