From c3f400ba9f3bee8888ab90e156b5f530275e59da Mon Sep 17 00:00:00 2001 From: rob tillaart Date: Thu, 16 Dec 2021 13:42:53 +0100 Subject: [PATCH] 0.1.2 DHT2pin --- libraries/DHT2pin/.arduino-ci.yml | 10 ++++--- .../.github/workflows/arduino_test_runner.yml | 10 ++++--- libraries/DHT2pin/LICENSE | 2 +- libraries/DHT2pin/dht2pin.cpp | 17 ++++++------ libraries/DHT2pin/dht2pin.h | 26 +++++++++---------- libraries/DHT2pin/keywords.txt | 5 ++-- libraries/DHT2pin/library.json | 5 ++-- libraries/DHT2pin/library.properties | 2 +- libraries/DHT2pin/readme.md | 19 +++++++++++--- libraries/DHT2pin/test/unit_test_001.cpp | 3 ++- 10 files changed, 61 insertions(+), 38 deletions(-) diff --git a/libraries/DHT2pin/.arduino-ci.yml b/libraries/DHT2pin/.arduino-ci.yml index ff5659b9..e7cb4633 100644 --- a/libraries/DHT2pin/.arduino-ci.yml +++ b/libraries/DHT2pin/.arduino-ci.yml @@ -2,6 +2,10 @@ compile: # Choosing to run compilation tests on 2 different Arduino platforms platforms: - uno - - leonardo - - due - - zero + # - due + # - zero + # - leonardo + - m4 + - esp32 + # - esp8266 + # - mega2560 \ No newline at end of file diff --git a/libraries/DHT2pin/.github/workflows/arduino_test_runner.yml b/libraries/DHT2pin/.github/workflows/arduino_test_runner.yml index 476456bb..096b975b 100644 --- a/libraries/DHT2pin/.github/workflows/arduino_test_runner.yml +++ b/libraries/DHT2pin/.github/workflows/arduino_test_runner.yml @@ -4,10 +4,14 @@ name: Arduino CI on: [push, pull_request] jobs: - arduino_ci: + runTest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: Arduino-CI/action@master - # Arduino-CI/action@v0.1.1 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + - run: | + gem install arduino_ci + arduino_ci.rb diff --git a/libraries/DHT2pin/LICENSE b/libraries/DHT2pin/LICENSE index 46c49382..ce6d6f88 100644 --- a/libraries/DHT2pin/LICENSE +++ b/libraries/DHT2pin/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016-2021 Rob Tillaart +Copyright (c) 2016-2022 Rob Tillaart Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/libraries/DHT2pin/dht2pin.cpp b/libraries/DHT2pin/dht2pin.cpp index 10fcdf43..dc6fe47e 100644 --- a/libraries/DHT2pin/dht2pin.cpp +++ b/libraries/DHT2pin/dht2pin.cpp @@ -1,19 +1,20 @@ // // FILE: DHT2pin.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.1.1 +// VERSION: 0.1.2 // PURPOSE: Experimental DHT Temperature & Humidity Sensor library for Arduino // URL: https://github.com/RobTillaart/DHT2pin // http://arduino.cc/playground/Main/DHTLib // // HISTORY: -// 0.1.1 2020-12-19 added arduino-ci + unit test -// 0.1.0 2020-06-30 own repository; #pragma once -// 0.0.3 Fix issue #33 -// 0.0.2 support for non "F_CPU" boards especially Galileo -// Tested and verified by Maria Emanuella Moura Silva (thanks) -// changed name to DHT2pin -// 0.0.1 initial version - 2016 SEP 05 (based upon 0.1.13 DHT) +// 0.1.2 2021-12-16 update library.json, license, minor edits +// 0.1.1 2020-12-19 added arduino-ci + unit test +// 0.1.0 2020-06-30 own repository; #pragma once +// 0.0.3 Fix issue #33 +// 0.0.2 support for non "F_CPU" boards especially Galileo +// Tested and verified by Maria Emanuella Moura Silva (thanks) +// changed name to DHT2pin +// 0.0.1 initial version - 2016 SEP 05 (based upon 0.1.13 DHT) // #include "DHT2pin.h" diff --git a/libraries/DHT2pin/dht2pin.h b/libraries/DHT2pin/dht2pin.h index 9479ac52..a201de8f 100644 --- a/libraries/DHT2pin/dht2pin.h +++ b/libraries/DHT2pin/dht2pin.h @@ -2,7 +2,7 @@ // // FILE: dht2pin.h // AUTHOR: Rob Tillaart -// VERSION: 0.1.1 +// VERSION: 0.1.2 // PURPOSE: DHT Temperature & Humidity Sensor library for Arduino // URL: https://github.com/RobTillaart/DHT2pin // http://arduino.cc/playground/Main/DHTLib @@ -13,15 +13,15 @@ #include -#define DHT2PIN_LIB_VERSION "0.1.1" +#define DHT2PIN_LIB_VERSION (F("0.1.2")) -#define DHTLIB_OK 0 -#define DHTLIB_ERROR_CHECKSUM -1 -#define DHTLIB_ERROR_TIMEOUT -2 -#define DHTLIB_ERROR_CONNECT -3 -#define DHTLIB_ERROR_ACK_L -4 -#define DHTLIB_ERROR_ACK_H -5 -#define DHTLIB_INVALID_VALUE -999 +#define DHTLIB_OK 0 +#define DHTLIB_ERROR_CHECKSUM -1 +#define DHTLIB_ERROR_TIMEOUT -2 +#define DHTLIB_ERROR_CONNECT -3 +#define DHTLIB_ERROR_ACK_L -4 +#define DHTLIB_ERROR_ACK_H -5 +#define DHTLIB_INVALID_VALUE -999 #define DHTLIB_DHT11_WAKEUP 18 #define DHTLIB_DHT_WAKEUP 1 @@ -36,7 +36,7 @@ #else #define DHTLIB_TIMEOUT (75000000/40000) #endif - + class DHT2pin { public: @@ -44,8 +44,8 @@ public: // DHTLIB_OK // DHTLIB_ERROR_CHECKSUM // DHTLIB_ERROR_TIMEOUT - DHT2pin(uint8_t rpin, uint8_t wpin) - { + DHT2pin(uint8_t rpin, uint8_t wpin) + { _rpin = rpin; _wpin = wpin; temperature = 0; @@ -57,7 +57,7 @@ public: pinMode(_rpin, INPUT); pinMode(_wpin, OUTPUT); } - + int read11(); int read(); diff --git a/libraries/DHT2pin/keywords.txt b/libraries/DHT2pin/keywords.txt index 5e62cb34..722999a7 100644 --- a/libraries/DHT2pin/keywords.txt +++ b/libraries/DHT2pin/keywords.txt @@ -1,6 +1,6 @@ -# Syntax Coloring Map For DHT2pin +# Syntax Colouring Map For DHT2pin -# Datatypes (KEYWORD1) +# Data types (KEYWORD1) DHT2pin KEYWORD1 @@ -18,6 +18,7 @@ temperature KEYWORD2 # Constants (LITERAL1) DHT2PIN_LIB_VERSION LITERAL1 + DHTLIB_OK LITERAL1 DHTLIB_ERROR_CHECKSUM LITERAL1 DHTLIB_ERROR_TIMEOUT LITERAL1 diff --git a/libraries/DHT2pin/library.json b/libraries/DHT2pin/library.json index a6fbf853..a953b1b3 100644 --- a/libraries/DHT2pin/library.json +++ b/libraries/DHT2pin/library.json @@ -15,8 +15,9 @@ "type": "git", "url": "https://github.com/RobTillaart/DHT2pin" }, - "version": "0.1.1", + "version": "0.1.2", "license": "MIT", "frameworks": "arduino", - "platforms": "*" + "platforms": "*", + "headers": "DHT2pin.h" } diff --git a/libraries/DHT2pin/library.properties b/libraries/DHT2pin/library.properties index a779584f..f8e4f36e 100644 --- a/libraries/DHT2pin/library.properties +++ b/libraries/DHT2pin/library.properties @@ -1,5 +1,5 @@ name=DHT2pin -version=0.1.1 +version=0.1.2 author=Rob Tillaart maintainer=Rob Tillaart sentence=Experimental library of the DHT library that uses 2 pins. diff --git a/libraries/DHT2pin/readme.md b/libraries/DHT2pin/readme.md index 77ffad13..33d2086a 100644 --- a/libraries/DHT2pin/readme.md +++ b/libraries/DHT2pin/readme.md @@ -1,12 +1,15 @@ [![Arduino CI](https://github.com/RobTillaart/DHT2pin/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci) +[![Arduino-lint](https://github.com/RobTillaart/DHT2pin/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/DHT2pin/actions/workflows/arduino-lint.yml) +[![JSON check](https://github.com/RobTillaart/DHT2pin/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/DHT2pin/actions/workflows/jsoncheck.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/DHT2pin/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/RobTillaart/DHT2pin.svg?maxAge=3600)](https://github.com/RobTillaart/DHT2pin/releases) # DHT2pin -Arduino library for experimental 2 pin DHT library +Arduino library for experimental 2 pin DHT library. + ## Description @@ -17,10 +20,10 @@ One pin for all read actions and one pin for write actions. This way one does not need to switch a pin between **INPUT** and **OUTPUT**. Note: It needs a diode in the hardware between the input pin of the MCU -and the datapin of the DHT sensor. -The output pin of the MCU is directly connected to the datapin of the DHT sensor. +and the data pin of the DHT sensor. +The output pin of the MCU is directly connected to the data pin of the DHT sensor. -It was made after a request which also refered to the links below. +It was made after a request which also referred to the links below. https://communities.intel.com/thread/53869 @@ -30,12 +33,20 @@ http://bigdinotech.com/tutorials/galileo-tutorials/using-1-wire-device-with-inte **NOTE: THIS LIB IS NOT TESTED EXTENSIVELY YET SO USE WITH CARE** + ## Credits & testing Maria Emanuella Moura Silva for testing and verifying this experimental code on a Galileo. + ## Operation See examples + +## Future + +- no active development planned +- improve unit tests (constants) +- \ No newline at end of file diff --git a/libraries/DHT2pin/test/unit_test_001.cpp b/libraries/DHT2pin/test/unit_test_001.cpp index c863783d..3f2c9300 100644 --- a/libraries/DHT2pin/test/unit_test_001.cpp +++ b/libraries/DHT2pin/test/unit_test_001.cpp @@ -31,6 +31,7 @@ unittest_setup() { + fprintf(stderr, "DHT2PIN_LIB_VERSION: %s\n", (char *) DHT2PIN_LIB_VERSION); } unittest_teardown() @@ -41,7 +42,7 @@ unittest_teardown() unittest(test_constructor) { DHT2pin DHT(2, 3); - fprintf(stderr, DHT2PIN_LIB_VERSION); + assertEqualFloat(0, DHT.temperature, 0.001); assertEqualFloat(0, DHT.humidity, 0.001);