Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9d8caed

Browse files
committedJun 24, 2019
Put InterruptLock (from interrupts.h) into namespace esp8266 to fix now and future
collisions with 3rd party Arduino libraries (currently Adafruit DHT has this issue)
1 parent 2e3e1d5 commit 9d8caed

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed
 

‎cores/esp8266/Esp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void EspClass::restart(void)
200200

201201
uint16_t EspClass::getVcc(void)
202202
{
203-
InterruptLock lock;
203+
esp8266::InterruptLock lock;
204204
(void)lock;
205205
return system_get_vdd33();
206206
}

‎cores/esp8266/Schedule.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bool schedule_function_us(std::function<bool(void)>&& fn, uint32_t repeat_us, sc
5656
{
5757
assert(repeat_us < decltype(scheduled_fn_t::callNow)::neverExpires); //~26800000us (26.8s)
5858

59-
InterruptLock lockAllInterruptsInThisScope;
59+
esp8266::InterruptLock lockAllInterruptsInThisScope;
6060

6161
scheduled_fn_t* item = get_fn_unsafe();
6262
if (!item)
@@ -104,7 +104,7 @@ void run_scheduled_functions(schedule_e policy)
104104

105105
static bool fence = false;
106106
{
107-
InterruptLock lockAllInterruptsInThisScope;
107+
esp8266::InterruptLock lockAllInterruptsInThisScope;
108108
if (fence)
109109
// prevent recursive calls from yield()
110110
return;
@@ -136,7 +136,7 @@ void run_scheduled_functions(schedule_e policy)
136136
else
137137
{
138138
// function removed from list
139-
InterruptLock lockAllInterruptsInThisScope;
139+
esp8266::InterruptLock lockAllInterruptsInThisScope;
140140

141141
if (sFirst == toCall)
142142
sFirst = sFirst->mNext;

‎cores/esp8266/Updater.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "Updater.h"
22
#include "Arduino.h"
33
#include "eboot_command.h"
4-
#include <interrupts.h>
54
#include <esp8266_peri.h>
65

76
//#define DEBUG_UPDATER Serial

‎cores/esp8266/interrupts.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
//}
1717
//
1818

19+
namespace esp8266
20+
{
21+
1922
class InterruptLock {
2023
public:
2124
InterruptLock() {
@@ -54,4 +57,6 @@ private: \
5457
}; \
5558
_AutoDisableIntr _autoDisableIntr
5659

60+
} // esp8266
61+
5762
#endif //INTERRUPTS_H

0 commit comments

Comments
 (0)
Please sign in to comment.