Skip to content

Commit ac047ba

Browse files
committed
Delegate to fptr type converter allows checking ISR in IRAM on any Delegate.
1 parent 8f08f4d commit ac047ba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cores/esp8266/core_esp8266_wiring_digital.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ extern "C" {
172172
ETS_GPIO_INTR_ATTACH(interrupt_handler, &interrupt_reg);
173173
}
174174

175-
inline void isr_iram_assertion(uint32_t userFunc)
175+
inline void isr_iram_assertion(voidFuncPtrArg userFunc)
176176
{
177177
// #5780
178178
// https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map
179-
if (userFunc >= 0x40200000)
179+
if ((uint32_t)userFunc >= 0x40200000)
180180
{
181181
// ISR not in IRAM
182182
::printf((PGM_P)F("ISR not in IRAM!\r\n"));
@@ -187,8 +187,7 @@ extern "C" {
187187

188188
extern void __attachInterruptArg(uint8_t pin, voidFuncPtrArg const userFunc, void* const arg, int mode)
189189
{
190-
isr_iram_assertion((uint32_t)userFunc);
191-
attachInterrupt(pin, { userFunc, arg }, mode);
190+
attachInterrupt(pin, { userFunc, arg }, mode);
192191
}
193192

194193
extern void __attachInterrupt(uint8_t pin, voidFuncPtr userFunc, int mode)
@@ -254,6 +253,7 @@ namespace
254253

255254
extern void attachInterrupt(uint8_t pin, Delegate<void(), void*> userFunc, int mode)
256255
{
256+
isr_iram_assertion(userFunc);
257257
if (pin < 16)
258258
{
259259
ETS_GPIO_INTR_DISABLE();

0 commit comments

Comments
 (0)