📄 message.h
字号:
// --------------------------------------------------------------------------
// Message.h
// --------------------------------------------------------------------------
#ifndef __MESSAGE_H__
#define __MESSAGE_H__
/*----------------------------------------------------------------------------+
| Type Definition & Macro |
+----------------------------------------------------------------------------*/
#define MAX_MSG_STACK_DEPTH 32 // 定义消息堆栈的深度
#define MSG_NULL 0x00 // 没有消息
// 与按键相关的消息定义
// wParam: 保留, 将来作为按键的各个状态位如Shift、Ctrl等
// lParam: 键值, 二进制表示
#define MSG_KEY_ROUTINE 0x01 // 按键扫描
#define MSG_KEY_DOWN 0x02 // 按键按下
#define MSG_KEY_UP 0x03 // 按键松开
// 与串口相关的消息定义
// wParam: Rx时最低位为RB8的值, Tx时无意义
// lParam: Rx时为接收到的数据的二进制值, Tx时无意义
#define MSG_RS485_RX_FRAME 0x04 // 485总线上接收到一帧数据
#define MSG_RS485_TX_FRAME 0x05 // 有数据帧需要向485总线发送
// 定义与计算机通信的模拟串口的消息
#define MSG_RS232_RX 0x06
// 10ms定时时间到,
#define MSG_TIMER_OVER 0x08
// 时钟计数器计数到显示需要改变, 也即0.5秒触发一次
#define MSG_TIME_DISPLAY 0x09
// 1秒钟定时时间到
#define MSG_TIMER_TEN_SECOND 0x0A
#define MSG_TIMER_ONE_SECOND 0x0B
#define MSG_RX_CARDNUMBER 0x10
// 其它
#define MSG_TEST 0x7F
#define MSG_ALL 0xFF // 所有消息类型,用来清除消息队列中所有消息的时候
// Message structure
typedef struct t_MSG {
BYTE Msg;
UINT Param;
UINT xParam; // 扩展参数
} MSG, *PMSG;
/*----------------------------------------------------------------------------+
| Function Prototype |
+----------------------------------------------------------------------------*/
BYTE xdata*MsgGetBuf(void) reentrant;
void MsgPutBuf(BYTE *pBuf) reentrant;
void InitMessagePool(void);
BOOL GetMessage(PMSG pMsg);
void SendMessage(BYTE nMessage) reentrant;
BYTE PostMessage(BYTE nMessage, UINT wParam) reentrant;
//void ClearMessage(BYTE nMessage);
/*----------------------------------------------------------------------------+
| End of header file |
+----------------------------------------------------------------------------*/
#endif // __MESSAGE_H__
/*------------------------ Nothing Below This Line --------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -