Add custom event handler for MCCI LMIC

This commit is contained in:
Leonel Lopes Parente 2021-05-16 16:08:55 +02:00
parent bbe3111ec4
commit 7f13b52468
2 changed files with 11 additions and 0 deletions

View file

@ -520,10 +520,20 @@ void initLmic(bit_t adrEnabled = 1,
serial.println(")");
#endif
#endif
#ifdef MCCI_LMIC
// Register a custom eventhandler and don't use default onEvent() to enable
// additional features (e.g. make EV_RXSTART available). User data pointer is omitted.
LMIC_registerEventCb(&onLmicEvent, nullptr);
#endif
}
#ifdef MCCI_LMIC
void onLmicEvent(void *pUserData, ev_t ev)
#else
void onEvent(ev_t ev)
#endif
{
// LMIC event handler
ostime_t timestamp = os_getTime();

View file

@ -46,6 +46,7 @@ enum class PrintTarget { All, Serial, Display };
// Forward declarations
void processWork(ostime_t timestamp);
void processDownlink(ostime_t eventTimestamp, uint8_t fPort, uint8_t* data, uint8_t dataLength);
void onLmicEvent(void *pUserData, ev_t ev);
void displayTxSymbol(bool visible);
#ifndef DO_WORK_INTERVAL_SECONDS // Should be set in platformio.ini