21 Commits

Author SHA1 Message Date
be6915c60d Update CI action versions 2023-05-12 11:24:12 -04:00
b2be3b193b Bump to 1.4.4 2022-06-27 14:05:27 -04:00
5273ef06a8 Merge pull request #191 from ondras12345/unknown-F_CPU
Fix infinite loop on STM32F103
2022-06-25 21:18:53 -04:00
2470b8a3a1 Fix infinite loop on STM32F103
When trying to read temperature from a DHT11 when the sensor was
disconnected, the program would encounter an infinite loop in
DHT::expectPulse, because count would keep overflowing.
2022-06-25 19:46:56 +02:00
ce31485de7 Bump to 1.4.3 2021-10-25 15:56:26 -04:00
c14960c223 Merge pull request #189 from klone52/patch-1
Fix comment on DHT22 and DHT21 variables
2021-10-25 14:26:26 -04:00
880538fa12 Fix comment on DHT22 and DHT21 variables 2021-10-24 21:27:23 -03:00
cf2346e7c1 Merge pull request #188 from phd/phd-const-sensors-types
Use const instead of defines for sensors types
2021-10-23 11:46:30 -04:00
bd145c5449 Use const instead of defines for sensors types 2021-10-21 10:39:47 +02:00
f339feb6b6 Bump to 1.4.2 2021-03-16 15:43:28 -04:00
b30f03cec7 Merge pull request #183 from ClementPeter/patch-1
Updated comment on the Pin Out of the DHTxx Sensors
2021-03-12 17:23:16 -05:00
8f89d15729 Updated comment on the Pin Out of the DHTxx Sensors
The DHTxx series sometimes come with 3 pins although the actual sensor itself happens to have 4 pins, So I made an update on the comment to help anyone who might find it sketchy ...Thanks
2021-03-12 22:14:19 +01:00
61ffee54ba Bump to 1.4.1 2020-12-02 11:37:29 -05:00
cfaa202f96 Merge pull request #174 from per1234/fix-nano-33-ble-conditional
Make preprocessor conditional false when identifier undefined
2020-12-01 21:21:34 -05:00
86115884c7 Make preprocessor conditional false when identifier undefined
A preprocessor conditional directive intended to only evaluate as true when compiling for the Arduino Nano 33 BLE board
was also evaluating as true when compiling for any board that didn't define the compared identifiers because undefined
identifiers are replaced with 0 by the C/C++ preprocessor, making them equal.

From the C++11 standard section 16.1, paragraph 4:

> After all replacements due to macro expansion and the defined unary operator
have been performed, all remaining identifiers and keywords 148 , except for true and false, are replaced
with the pp-number 0

The fix is to modify the directive to check whether the macro has been defined.
2020-12-01 17:53:54 -08:00
b64fe15ad0 Bump to 1.4.0 2020-09-16 14:42:30 -04:00
7062b127f0 Merge pull request #167 from tjpetz/missing-nanoble-support
Add missing microsecondsToClockCycles for 33 BLE
2020-09-08 16:34:27 -04:00
f0a66b0dd3 Adjust comments to comply with doxygen. 2020-09-08 16:12:02 -04:00
b504fa540e fix extra space and end of line 2020-09-08 14:48:08 -04:00
fa22bc6ca4 Fix lint errors 2020-09-08 14:41:40 -04:00
a1f0c1c038 Add missing microsecondsToClockCycles for 33 BLE 2020-09-08 13:57:07 -04:00
5 changed files with 24 additions and 11 deletions

View File

@ -7,11 +7,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: adafruit/ci-arduino
path: ci

View File

@ -360,7 +360,9 @@ bool DHT::read(bool force) {
// in the very latest IDE versions):
// https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/wiring_pulse.c
uint32_t DHT::expectPulse(bool level) {
#if (F_CPU > 16000000L)
// F_CPU is not be known at compile time on platforms such as STM32F103.
// The preprocessor seems to evaluate it to zero in that case.
#if (F_CPU > 16000000L) || (F_CPU == 0L)
uint32_t count = 0;
#else
uint16_t count = 0; // To work fast enough on slower AVR boards

20
DHT.h
View File

@ -41,11 +41,21 @@
#endif
/* Define types of sensors. */
#define DHT11 11 /**< DHT TYPE 11 */
#define DHT12 12 /**< DHY TYPE 12 */
#define DHT22 22 /**< DHT TYPE 22 */
#define DHT21 21 /**< DHT TYPE 21 */
#define AM2301 21 /**< AM2301 */
static const uint8_t DHT11{11}; /**< DHT TYPE 11 */
static const uint8_t DHT12{12}; /**< DHY TYPE 12 */
static const uint8_t DHT21{21}; /**< DHT TYPE 21 */
static const uint8_t DHT22{22}; /**< DHT TYPE 22 */
static const uint8_t AM2301{21}; /**< AM2301 */
#if defined(TARGET_NAME) && (TARGET_NAME == ARDUINO_NANO33BLE)
#ifndef microsecondsToClockCycles
/*!
* As of 7 Sep 2020 the Arduino Nano 33 BLE boards do not have
* microsecondsToClockCycles defined.
*/
#define microsecondsToClockCycles(a) ((a) * (SystemCoreClock / 1000000L))
#endif
#endif
/*!
* @brief Class that stores state and functions for DHT

View File

@ -20,7 +20,8 @@
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect pin 3 (on the right) of the sensor to GROUND (if your sensor has 3 pins)
// Connect pin 4 (on the right) of the sensor to GROUND and leave the pin 3 EMPTY (if your sensor has 4 pins)
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
// Initialize DHT sensor.

View File

@ -1,5 +1,5 @@
name=DHT sensor library
version=1.3.10
version=1.4.4
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Arduino library for DHT11, DHT22, etc Temp & Humidity Sensors