Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
75c3cf29
Commit
75c3cf29
authored
Jun 20, 2015
by
vowstar
Browse files
Disable interrupts while communicating with DHTxx.
parent
3430e5f8
Changes
1
Show whitespace changes
Inline
Side-by-side
app/dhtlib/dht.c
View file @
75c3cf29
...
@@ -252,6 +252,8 @@ int dht_readSensor(uint8_t pin, uint8_t wakeupDelay)
...
@@ -252,6 +252,8 @@ int dht_readSensor(uint8_t pin, uint8_t wakeupDelay)
DIRECT_WRITE_LOW
(
pin
);
DIRECT_WRITE_LOW
(
pin
);
// delay(wakeupDelay);
// delay(wakeupDelay);
for
(
i
=
0
;
i
<
wakeupDelay
;
i
++
)
os_delay_us
(
1000
);
for
(
i
=
0
;
i
<
wakeupDelay
;
i
++
)
os_delay_us
(
1000
);
// Disable interrupts
os_intr_lock
();
// digitalWrite(pin, HIGH); // T-go
// digitalWrite(pin, HIGH); // T-go
DIRECT_WRITE_HIGH
(
pin
);
DIRECT_WRITE_HIGH
(
pin
);
os_delay_us
(
40
);
os_delay_us
(
40
);
...
@@ -303,6 +305,8 @@ int dht_readSensor(uint8_t pin, uint8_t wakeupDelay)
...
@@ -303,6 +305,8 @@ int dht_readSensor(uint8_t pin, uint8_t wakeupDelay)
idx
++
;
idx
++
;
}
}
}
}
// Enable interrupts
os_intr_unlock
();
// pinMode(pin, OUTPUT);
// pinMode(pin, OUTPUT);
DIRECT_MODE_OUTPUT
(
pin
);
DIRECT_MODE_OUTPUT
(
pin
);
// digitalWrite(pin, HIGH);
// digitalWrite(pin, HIGH);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment