diff --git a/src/hal/hal.cpp b/src/hal/hal.cpp index 62271b49..d1f16e8a 100644 --- a/src/hal/hal.cpp +++ b/src/hal/hal.cpp @@ -109,14 +109,17 @@ static void hal_io_check() { // Interrupt handlers static ostime_t interrupt_time[NUM_DIO] = {0}; +LMIC_ISR_ATTR static void hal_isrPin0() { ostime_t now = os_getTime(); interrupt_time[0] = now ? now : 1; } +LMIC_ISR_ATTR static void hal_isrPin1() { ostime_t now = os_getTime(); interrupt_time[1] = now ? now : 1; } +LMIC_ISR_ATTR static void hal_isrPin2() { ostime_t now = os_getTime(); interrupt_time[2] = now ? now : 1; diff --git a/src/lmic/config.h b/src/lmic/config.h index 8673b46a..cc14614e 100644 --- a/src/lmic/config.h +++ b/src/lmic/config.h @@ -212,4 +212,11 @@ # define LMIC_ENABLE_arbitrary_clock_error 0 /* PARAM */ #endif +#if defined(ESP8266) || defined(ESP32) +// functions called from an interrupt context need this attribute +#define LMIC_ISR_ATTR ICACHE_RAM_ATTR +#else +#define LMIC_ISR_ATTR +#endif + #endif // _lmic_config_h_