7a7daad23a
Signed-off-by: lidun <1084178170@qq.com>
39 lines
875 B
C
39 lines
875 B
C
#ifndef __Arnold_Single_Event_H__
|
|
#define __Arnold_Single_Event_H__
|
|
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
|
|
#define SingleEvent_FOREACH(func)\
|
|
func(EVENT_AA) \
|
|
func(EVENT_BB) \
|
|
func(EVENT_CC) \
|
|
func(EVENT_AC) \
|
|
func(EVENT_DC) \
|
|
|
|
|
|
#define GetSingleEvent_Enum(x) x##_EM,
|
|
#define GetSingleEventEnum(x) x##_EM
|
|
typedef enum {
|
|
EVENT_NONE,
|
|
SingleEvent_FOREACH(GetSingleEvent_Enum)
|
|
|
|
|
|
} SingleEvent_t;
|
|
#define MAX_EVENTS 5 //最大事件数 MAX_SingleEVENTS-1
|
|
|
|
#define GetSingleEventFunction(xx) void xx##FUNtion(void);
|
|
#define GetSingleEventFunction_NAME(xx) xx##FUNtion()
|
|
#define GetSwitchSingleCase(x) case GetSingleEventEnum(x):GetSingleEventFunction_NAME(x);break;
|
|
|
|
void eventDosomething(void);//事件处理函数
|
|
void add_event(SingleEvent_t event);//添加事件
|
|
#define GetEventName(x) GetSingleEventEnum(x)/* 获取事件名字 */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|