mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
Fix merge conflict with interrupt disable lock.
This commit is contained in:
commit
5cd78aead6
9
DHT.cpp
9
DHT.cpp
@ -143,9 +143,11 @@ boolean DHT::read(void) {
|
||||
digitalWrite(_pin, LOW);
|
||||
delay(20);
|
||||
|
||||
uint32_t cycles[80];
|
||||
{
|
||||
// Turn off interrupts temporarily because the next sections are timing critical
|
||||
// and we don't want any interruptions.
|
||||
noInterrupts();
|
||||
InterruptLock lock;
|
||||
|
||||
// End the start signal by setting data line high for 40 microseconds.
|
||||
digitalWrite(_pin, HIGH);
|
||||
@ -176,14 +178,11 @@ boolean DHT::read(void) {
|
||||
// if the bit is a 0 (high state cycle count < low state cycle count), or a
|
||||
// 1 (high state cycle count > low state cycle count). Note that for speed all
|
||||
// the pulses are read into a array and then examined in a later step.
|
||||
uint32_t cycles[80];
|
||||
for (int i=0; i<80; i+=2) {
|
||||
cycles[i] = expectPulse(LOW);
|
||||
cycles[i+1] = expectPulse(HIGH);
|
||||
}
|
||||
|
||||
// Re-enable interrupts, timing critical code is complete.
|
||||
interrupts();
|
||||
} // Timing critical code is now complete.
|
||||
|
||||
// Inspect pulses and determine which ones are 0 (high state cycle count < low
|
||||
// state cycle count), or 1 (high state cycle count > low state cycle count).
|
||||
|
Loading…
Reference in New Issue
Block a user