Skip to content

Commit

Permalink
Arch/Esp8266/Core/Digital.cpp: fixed pulseIn() for pins >= 8 (#2337)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex18-d authored and slaff committed Sep 27, 2021
1 parent 7c90dee commit 383e8b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sming/Arch/Esp8266/Core/Digital.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ unsigned long pulseIn(uint16_t pin, uint8_t state, unsigned long timeout)
// cache the port and bit of the pin in order to speed up the
// pulse width measuring loop and achieve finer resolution. calling
// digitalRead() instead yields much coarser resolution.
uint8_t bit = digitalPinToBitMask(pin);
uint32_t bit = digitalPinToBitMask(pin);
// uint8_t port = digitalPinToPort(pin); // Does nothing in Sming, comment-out to prevent compiler warning
uint8_t stateMask = (state ? bit : 0);
uint32_t stateMask = (state ? bit : 0);
unsigned long width = 0; // keep initialization out of time critical area

// convert the timeout from microseconds to a number of times through
Expand Down

0 comments on commit 383e8b5

Please sign in to comment.