Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for esp8266 and esp32 when LMIC_USE_INTERRUPTS is used #556

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/hal/hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions src/lmic/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_