From 84a8902c86716af1a8cda1689cef3bed71df8efd Mon Sep 17 00:00:00 2001 From: Ioannis Charalampidis Date: Wed, 16 Jan 2019 00:42:17 +0200 Subject: [PATCH] Adding access headers to DHT --- .library.json | 2 +- README.md | 4 +++ library.properties | 2 +- src/uNode/libraries/DHT.hpp | 30 ++++++++++++++++++++++ src/vendor/DHT_sensor_library/uNodeDHT.cpp | 2 +- 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 src/uNode/libraries/DHT.hpp diff --git a/.library.json b/.library.json index 892329f..6ee17df 100644 --- a/.library.json +++ b/.library.json @@ -34,5 +34,5 @@ "type": "git", "url": "https://github.com/tlabio/arduino-unode.git" }, - "version": "0.8.0" + "version": "0.8.1" } diff --git a/README.md b/README.md index 8986d35..a7e3a52 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,10 @@ This repository is currently being renovated. More information will be available * **ADDED** : Under-voltage protection limits can be now configured in the `.undervoltageProtection` structure. * **ADDED** : `.tx_sf`, `.tx_power` and `.adr` on LoRa configuration segment. +#### 0.8.0 + +* **ADDED** : Added the `uNode/libraries/DHT.hpp` library. + ## Closed-Source Features The following features are closed-source and they are only available on the binary release of the library: diff --git a/library.properties b/library.properties index feb5a73..68033b5 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=uNode-Open -version=0.8.0 +version=0.8.1 author=Ioannis Charalampidis maintainer=Ioannis Charalampidis sentence=Hardware abstraction library for TLab uNode
diff --git a/src/uNode/libraries/DHT.hpp b/src/uNode/libraries/DHT.hpp new file mode 100644 index 0000000..45eb527 --- /dev/null +++ b/src/uNode/libraries/DHT.hpp @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2019 Ioannis Charalampidis, Gijs Mos + * + * This is a private, preview release of the uNode hardware abstraction library. + * The holder of a copy of this software and associated documentation files + * (the "Software") is allowed to use the Software without any obligation to + * create private and/or commercial projects. The Software can be obtained + * through the official channels of the author, including but not limited to + * Github and the official TLab.gr website. It is FORBIDDEN however to modify, + * reverse-engineer, publish, distribute, sublicense, and/or sell copies of the + * Software itself. + * + * The license for this file might change in a future release. The author is not + * obliged to announce this change through any channel but it should be included + * in the release notes. + * + * 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. + * + *******************************************************************************/ + +/** + * This file is solely a placeholder to provide a more logical access to the + * uNode-Adapted version of the DHT sensor. + */ +#include "../../vendor/DHT_sensor_library/uNodeDHT.hpp" diff --git a/src/vendor/DHT_sensor_library/uNodeDHT.cpp b/src/vendor/DHT_sensor_library/uNodeDHT.cpp index 0c7d73b..88f7180 100644 --- a/src/vendor/DHT_sensor_library/uNodeDHT.cpp +++ b/src/vendor/DHT_sensor_library/uNodeDHT.cpp @@ -186,7 +186,7 @@ boolean DHT::read(bool force) { for (int i = 0; i < 40; ++i) { uint32_t lowCycles = cycles[2 * i]; uint32_t highCycles = cycles[2 * i + 1]; - if ((lowCycles == -1) || (highCycles == -1)) { + if ((lowCycles == 0xFFFFFFFF) || (highCycles == 0xFFFFFFFF)) { DEBUG_PRINTLN(F("Timeout waiting for pulse.")); _lastresult = false; return _lastresult;