Hello,
This behavior within the SDK has bitten me a couple times so I thought it would be a good thing to share. If you call app_sched_event_put(NULL, 0, &my_function), when "my_function" is called, the data pointer is not NULL for the size parameter is zero. Therefore the following will not work.
Caller:
Fullscreen
1
2
3
extern void event_handler(void* data, size_t data_len);
app_sched_event_put(NULL, 0, event_handler);
Callee:
Fullscreen
1
2
3
4
5
6
7
void event_handler(void* data, size_t data_len)
{
// This will not work, check data+len instead
if (data == NULL) {
do_something();
}
}