-
Notifications
You must be signed in to change notification settings - Fork 1
/
nrf_evt_queue.h
50 lines (39 loc) · 1.13 KB
/
nrf_evt_queue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef NRF_EVT_QUEUE_H
#define NRF_EVT_QUEUE_H
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*nrf_evt_queue_evt_handler_t)(void);
typedef struct nrf_evt_queue_evt_s nrf_evt_queue_evt_t;
struct nrf_evt_queue_evt_s {
nrf_evt_queue_evt_handler_t handler;
nrf_evt_queue_evt_t * next;
};
/** @brief Return true if a given event is currently queued for execution */
bool nrf_evt_queue_is_queued(nrf_evt_queue_evt_t * p_evt);
/**
* @brief Queue event
*
* @retval NRF_SUCCESS Event successfully queued
* @retval NRF_ERROR_INVALID_STATE Event already queued
*/
uint32_t nrf_evt_queue_put(nrf_evt_queue_evt_t * p_evt, nrf_evt_queue_evt_handler_t callback);
/**
* @brief Unqueue event
*
* @retval NRF_SUCCESS Event successfully unqueued
* @retval NRF_ERROR_INVALID_STATE Event not queued
*/
uint32_t nrf_evt_queue_remove(nrf_evt_queue_evt_t * p_evt);
/**
* @brief Execute all queued events
*
* @warning Call only from main context (as opposed to from inside an interrupt)
*/
void nrf_evt_queue_execute(void);
#ifdef __cplusplus
}
#endif
#endif // NRF_EVT_QUEUE_H