-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuevent.h
More file actions
47 lines (38 loc) · 1.29 KB
/
uevent.h
File metadata and controls
47 lines (38 loc) · 1.29 KB
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
#ifndef _UENENT_H_
#define _UENENT_H_
#include <stdint.h>
#include <string.h>
#include "compiler_abstraction.h"
typedef struct {
uint16_t evt_id;
void* content;
} uevt_t;
typedef void (*fpevt_h)(uevt_t*);
#include "scheduler.h"
#include "platform.h"
void user_event_send(uevt_t evt, fpevt_h event_handler);
void user_event_broadcast(uevt_t evt);
void user_event_init(void);
void user_event_handler_regist(fpevt_h func);
void user_event_handler_unregist(fpevt_h func);
void user_event_array_dispatcher(uevt_t evt);
#if G_LOG_ENABLED == 1 && EVT_LOG_ENABLED == 1
#define uevt_bc(x, y) \
LOG_RAW("EVT Push:" #x "\r\n"); \
user_event_broadcast((uevt_t) { x, y })
#define uevt_bc_e(x) \
LOG_RAW("EVT Push:" #x "\r\n"); \
user_event_broadcast((uevt_t) { x, NULL })
#define uevt_sd(x, y, hFunc) \
LOG_RAW("EVT Send:" #x "to " #hFunc "\r\n"); \
user_event_send((uevt_t) { x, y }, hFunc)
#define uevt_sd_e(x, hFunc) \
LOG_RAW("EVT Send:" #x "to " #hFunc "\r\n"); \
user_event_send((uevt_t) { x, NULL }, hFunc)
#else
#define uevt_bc(x, y) user_event_broadcast((uevt_t) { x, y })
#define uevt_bc_e(x) user_event_broadcast((uevt_t) { x, NULL })
#define uevt_sd(x, y, hFunc) user_event_send((uevt_t) { x, y }, hFunc)
#define uevt_sd_e(x, hFunc) user_event_send((uevt_t) { x, NULL }, hFunc)
#endif
#endif