Skip to content

Modify radio_irq_handler to take a timestamp from caller. #148

@terrillmoore

Description

@terrillmoore

At present, there's a vestigial interrupt-handling configuration option. Comments in README.md indicate that it's configurable and not tested:

arduino-lmic/README.md

Lines 187 to 189 in c3aa460

`#define LMIC_USE_INTERRUPTS`
If defined, configures the library to use interrupts for detecting events from the transceiver. If left undefined, the library will poll for events from the transceiver. `LMIC_USE_INTERRUPTS` is not currently tested.

Commentary at https://github.com/mcci-catena/arduino-lmic#timing further discusses this, and suggests passing a timestamp from the ISR to the radio_irq_handler(). This is a really important point, especially when getting timing from the network (moving towards proper Class B support). We should do this by splitting radio_irq_handler() into two parts.

Note that in this code, the radio_irq_handler is really an event handler; the HAL is required to serialize it with any other calls into the LMIC.

void radio_irq_handler(void) {
    radio_irq_handler_v2(os_getTime());
}

void radio_irq_handler_v2(ostime_t now) {
   // body of existing handler after getting time.
}

Then HALs can migrate as they want to. The overhead from the extra subroutine call for old HALs is insignificant.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions