Skip to content

Commit 06aa91d

Browse files
Move DECL_ON_LMIC_EVENT from lmic.c to lmic.h
This declares the onEvent() callback function that must be defined by an application. Previously, the application was expected to define this itself, and a reference to it was declared in lmic.c. By moving the declaration into lmic.h, this prevents problems when an application uses a different function signature for the function, or when defining the callback in a C++ file (which will now be compiled as a C function automatically).
1 parent 2234fd3 commit 06aa91d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/lmic/lmic.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#define isTESTMODE() 0
4444

4545
DEFINE_LMIC;
46-
DECL_ON_LMIC_EVENT;
4746

4847

4948
// Fwd decls.

src/lmic/lmic.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ void LMIC_tryRejoin (void);
262262
void LMIC_setSession (u4_t netid, devaddr_t devaddr, xref2u1_t nwkKey, xref2u1_t artKey);
263263
void LMIC_setLinkCheckMode (bit_t enabled);
264264

265+
// Declare onEvent() function, to make sure any definition will have the
266+
// C conventions, even when in a C++ file.
267+
DECL_ON_LMIC_EVENT;
268+
265269
// Special APIs - for development or testing
266270
// !!!See implementation for caveats!!!
267271

0 commit comments

Comments
 (0)