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 #332 #630

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
21 changes: 5 additions & 16 deletions src/hal/hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,27 +118,16 @@ void hal_pollPendingIRQs_helper() {
#else
// Interrupt handlers

static void hal_isrPin0() {
if (interrupt_time[0] == 0) {
template<int i>
static ICACHE_RAM_ATTR void hal_isrPin() {
if (interrupt_time[i] == 0) {
ostime_t now = os_getTime();
interrupt_time[0] = now ? now : 1;
}
}
static void hal_isrPin1() {
if (interrupt_time[1] == 0) {
ostime_t now = os_getTime();
interrupt_time[1] = now ? now : 1;
}
}
static void hal_isrPin2() {
if (interrupt_time[2] == 0) {
ostime_t now = os_getTime();
interrupt_time[2] = now ? now : 1;
interrupt_time[i] = now ? now : 1;
}
}

typedef void (*isr_t)();
static const isr_t interrupt_fns[NUM_DIO_INTERRUPT] = {hal_isrPin0, hal_isrPin1, hal_isrPin2};
static const isr_t interrupt_fns[NUM_DIO_INTERRUPT] = {hal_isrPin<0>, hal_isrPin<1>, hal_isrPin<2>};
static_assert(NUM_DIO_INTERRUPT == 3, "number of interrupts must be 3 for initializing interrupt_fns[]");

static void hal_interrupt_init() {
Expand Down
2 changes: 2 additions & 0 deletions src/lmic/lmic.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
# define LMIC_X_DEBUG_PRINTF(f, ...) do {;} while(0)
#endif

#define LMIC_DEBUG_TRACE LMIC_DEBUG_PRINTF("*** Trace *** %s\n", __func__)

#ifdef __cplusplus
extern "C"{
#endif
Expand Down