This article is linked from https://lupyuen.github.io/pinetime-rust-mynewt/articles/dfu
struct ble_npl_event *
ble_npl_eventq_get(
struct ble_npl_eventq *evq,
ble_npl_time_t tmo)
Pull a single Event from an Event Queue
This function is implemented in the NimBLE Porting Layer for Mynewt like this...
static inline struct ble_npl_event *
ble_npl_eventq_get(struct ble_npl_eventq *evq, ble_npl_time_t tmo)
{
struct os_event *ev;
if (tmo == BLE_NPL_TIME_FOREVER) {
ev = os_eventq_get(&evq->evq);
} else {
ev = os_eventq_poll((struct os_eventq **)&evq, 1, tmo);
}
return (struct ble_npl_event *)ev;
}
See os_eventq_get
and os_eventq_poll
void
ble_npl_event_init(
struct ble_npl_event *ev,
ble_npl_event_fn *fn,
void *arg)
Create an Event and initialise it
This function is implemented in the NimBLE Porting Layer for Mynewt like this...
static inline void
ble_npl_event_init(struct ble_npl_event *ev, ble_npl_event_fn *fn,
void *arg)
{
memset(ev, 0, sizeof(*ev));
ev->ev.ev_queued = 0;
ev->ev.ev_cb = (os_event_fn *)fn;
ev->ev.ev_arg = arg;
}