mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
be6915c60d | |||
b2be3b193b | |||
5273ef06a8 | |||
2470b8a3a1 | |||
ce31485de7 | |||
c14960c223 | |||
880538fa12 | |||
cf2346e7c1 | |||
bd145c5449 | |||
f339feb6b6 | |||
b30f03cec7 | |||
8f89d15729 | |||
61ffee54ba | |||
cfaa202f96 | |||
86115884c7 | |||
b64fe15ad0 | |||
7062b127f0 | |||
f0a66b0dd3 | |||
b504fa540e | |||
fa22bc6ca4 | |||
a1f0c1c038 | |||
13d25e6b9a | |||
8de033bae1 | |||
a7157aa586 | |||
4f841c64b2 | |||
d0a1035985 | |||
7528a843dd | |||
5ce3bce49c | |||
44a80e01e6 |
6
.github/workflows/githubci.yml
vendored
6
.github/workflows/githubci.yml
vendored
@ -7,11 +7,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-python@v1
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: adafruit/ci-arduino
|
repository: adafruit/ci-arduino
|
||||||
path: ci
|
path: ci
|
||||||
|
9
DHT.cpp
9
DHT.cpp
@ -26,7 +26,9 @@
|
|||||||
#include "DHT.h"
|
#include "DHT.h"
|
||||||
|
|
||||||
#define MIN_INTERVAL 2000 /**< min interval value */
|
#define MIN_INTERVAL 2000 /**< min interval value */
|
||||||
#define TIMEOUT -1 /**< timeout on */
|
#define TIMEOUT \
|
||||||
|
UINT32_MAX /**< Used programmatically for timeout. \
|
||||||
|
Not a timeout duration. Type: uint32_t. */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Instantiates a new DHT class
|
* @brief Instantiates a new DHT class
|
||||||
@ -38,6 +40,7 @@
|
|||||||
* number of sensors
|
* number of sensors
|
||||||
*/
|
*/
|
||||||
DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) {
|
DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) {
|
||||||
|
(void)count; // Workaround to avoid compiler warning.
|
||||||
_pin = pin;
|
_pin = pin;
|
||||||
_type = type;
|
_type = type;
|
||||||
#ifdef __AVR
|
#ifdef __AVR
|
||||||
@ -357,7 +360,9 @@ bool DHT::read(bool force) {
|
|||||||
// in the very latest IDE versions):
|
// in the very latest IDE versions):
|
||||||
// https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/wiring_pulse.c
|
// https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/wiring_pulse.c
|
||||||
uint32_t DHT::expectPulse(bool level) {
|
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;
|
uint32_t count = 0;
|
||||||
#else
|
#else
|
||||||
uint16_t count = 0; // To work fast enough on slower AVR boards
|
uint16_t count = 0; // To work fast enough on slower AVR boards
|
||||||
|
20
DHT.h
20
DHT.h
@ -41,11 +41,21 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define types of sensors. */
|
/* Define types of sensors. */
|
||||||
#define DHT11 11 /**< DHT TYPE 11 */
|
static const uint8_t DHT11{11}; /**< DHT TYPE 11 */
|
||||||
#define DHT12 12 /**< DHY TYPE 12 */
|
static const uint8_t DHT12{12}; /**< DHY TYPE 12 */
|
||||||
#define DHT22 22 /**< DHT TYPE 22 */
|
static const uint8_t DHT21{21}; /**< DHT TYPE 21 */
|
||||||
#define DHT21 21 /**< DHT TYPE 21 */
|
static const uint8_t DHT22{22}; /**< DHT TYPE 22 */
|
||||||
#define AM2301 21 /**< AM2301 */
|
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
|
* @brief Class that stores state and functions for DHT
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
|
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
|
||||||
// to 3.3V instead of 5V!
|
// to 3.3V instead of 5V!
|
||||||
// Connect pin 2 of the sensor to whatever your DHTPIN is
|
// 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
|
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
|
||||||
|
|
||||||
// Initialize DHT sensor.
|
// Initialize DHT sensor.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=DHT sensor library
|
name=DHT sensor library
|
||||||
version=1.3.9
|
version=1.4.4
|
||||||
author=Adafruit
|
author=Adafruit
|
||||||
maintainer=Adafruit <info@adafruit.com>
|
maintainer=Adafruit <info@adafruit.com>
|
||||||
sentence=Arduino library for DHT11, DHT22, etc Temp & Humidity Sensors
|
sentence=Arduino library for DHT11, DHT22, etc Temp & Humidity Sensors
|
||||||
|
Reference in New Issue
Block a user