forked from adafruit/DHT-sensor-library
removed more arduino bullshit functions
This commit is contained in:
@ -11,6 +11,7 @@ set(sources
|
|||||||
set(dependencies
|
set(dependencies
|
||||||
arduino-esp32
|
arduino-esp32
|
||||||
Adafruit_Sensor
|
Adafruit_Sensor
|
||||||
|
espcpputils
|
||||||
)
|
)
|
||||||
|
|
||||||
idf_component_register(
|
idf_component_register(
|
||||||
|
5
DHT.cpp
5
DHT.cpp
@ -26,6 +26,7 @@
|
|||||||
#include "DHT.h"
|
#include "DHT.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <tickchrono.h>
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
@ -261,7 +262,7 @@ const std::optional<std::array<uint8_t, 5>> &DHT::read(bool force) {
|
|||||||
// Go into high impedence state to let pull-up raise data line level and
|
// Go into high impedence state to let pull-up raise data line level and
|
||||||
// start the reading process.
|
// start the reading process.
|
||||||
pinMode(_pin, INPUT_PULLUP);
|
pinMode(_pin, INPUT_PULLUP);
|
||||||
delay(1);
|
espcpputils::delay(1ms);
|
||||||
|
|
||||||
// First set data line low for a period according to sensor type
|
// First set data line low for a period according to sensor type
|
||||||
pinMode(_pin, OUTPUT);
|
pinMode(_pin, OUTPUT);
|
||||||
@ -273,7 +274,7 @@ const std::optional<std::array<uint8_t, 5>> &DHT::read(bool force) {
|
|||||||
break;
|
break;
|
||||||
case DHT11:
|
case DHT11:
|
||||||
default:
|
default:
|
||||||
delay(20); // data sheet says at least 18ms, 20ms just to be safe
|
espcpputils::delay(20ms); // data sheet says at least 18ms, 20ms just to be safe
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user