148 lines
3.6 KiB
C
148 lines
3.6 KiB
C
#ifndef USER_DISPLAY_PRESENT
|
||
#define USER_DISPLAY_PRESENT
|
||
|
||
typedef enum {UNIT_MPA, UNIT_PSI, UNIT_PCT, UNIT_M3} TH2PressUnit;
|
||
typedef enum {SOURCE_LNG, SOURCE_O2, SOURCE_N2, SOURCE_AR, SOURCE_CO2,
|
||
SOURCE_H2, SOURCE_CNG, SOURCE_HE, SOURCE_C2H4, SOURCE_LPG, SOURCE_NH3,
|
||
SOURCE_PENT, SOURCE_POPO} TDispSource; // 戊烷,聚醚多元醇
|
||
|
||
// 显示一个8段码
|
||
// pos: 氢压力为0~4(从左到右,真值表14~10),温度为5~7(真值表4~6),
|
||
// 压力为8~10(真值表7~9),真空为11~13(真值表1~3)
|
||
void Disp_DispChar(u8 pos, char c);
|
||
|
||
// 显示氢压力数据
|
||
void Disp_H2PressText(s8 *text);
|
||
// 显示小数点
|
||
void Disp_H2PressPointOn(u8 pos);
|
||
void Disp_H2PressPointOff();
|
||
|
||
// 显示压力数据
|
||
void Disp_PresText(s8 *text);
|
||
// 显示小数点
|
||
void Disp_PresPointOn();
|
||
void Disp_PresPointOff();
|
||
// 显示压力的单位符号
|
||
void Disp_PresUnitOn();
|
||
void Disp_PresUnitOff();
|
||
|
||
// 显示温度数据
|
||
void Disp_TempText(s8 *text);
|
||
// 显示小数点
|
||
void Disp_TempPointOn();
|
||
void Disp_TempPointOff();
|
||
// 显示温度的单位符号
|
||
void Disp_TempUnitOn();
|
||
void Disp_TempUnitOff();
|
||
|
||
// 显示真空数据
|
||
void Disp_VacuText(s8 *text);
|
||
// 显示小数点
|
||
void Disp_VacuPointOn();
|
||
void Disp_VacuPointOff();
|
||
|
||
// 氢压力单位关闭
|
||
void Disp_H2PressUnitOff();
|
||
// 氢压力显示切换
|
||
void Disp_SwitchH2PressUnit(TH2PressUnit unit);
|
||
|
||
// 写指针数据
|
||
void Disp_WriteNeedle(u8 val);
|
||
// 写电量数据
|
||
void Disp_WriteBattery(u8 val);
|
||
// 写信号强度
|
||
void Disp_WriteStrength(u8 val);
|
||
// 写通讯状态(是否发送数据)
|
||
void Disp_WriteCommunication(u8 val);
|
||
|
||
// 清屏
|
||
void Disp_Clear();
|
||
|
||
// 设置闪烁
|
||
void Disp_SetBlinkVisible(u8 visible);
|
||
void Disp_H2PressBlink(u8 blink);
|
||
void Disp_PresBlink(u8 blink);
|
||
void Disp_TempBlink(u8 blink);
|
||
void Disp_VacuBlink(u8 blink);
|
||
void Disp_BatteryBlink(u8 blink);
|
||
// ********************************************
|
||
// 以下为窗口界面实现
|
||
// ********************************************
|
||
|
||
// 设置焦点显示
|
||
void Disp_SetCursor(u8 pos, u8 width);
|
||
void Disp_ClearCursor();
|
||
|
||
// 选择框函数
|
||
typedef struct
|
||
{
|
||
u8 pos; // 显示位置(0~3,0为氢压力显示最左边,3为氢压力显示最右边)
|
||
u8 width; // 显示位数
|
||
u8 count; // 选项个数(最多10个可选项)
|
||
u8 idx; // 当前选项
|
||
u8 read_only; // 只读
|
||
u8 hide; // 隐藏
|
||
char items[13][6]; // 可选项内容(每个可选项最长5个字符)
|
||
} TSelectBox;
|
||
|
||
// 刷新显示
|
||
void SelectBox_Refresh(TSelectBox *pBox);
|
||
// 创建选择框
|
||
void SelectBox_Create(TSelectBox *pBox, u8 pos, u8 width, u8 count, const char items[][6], u8 idx);
|
||
// 设置只读属性
|
||
void SelectBox_ReadOnly(TSelectBox *pBox);
|
||
// 设置隐藏属性
|
||
void SelectBox_Hide(TSelectBox *pBox);
|
||
// 选择框处理按键
|
||
u8 SelectBox_OnKey(TSelectBox *pBox, u8 key);
|
||
// 选择框获得焦点
|
||
void SelectBox_SetFocus(TSelectBox *pBox);
|
||
|
||
// 编辑框函数
|
||
typedef struct
|
||
{
|
||
u8 pos; // 显示位置
|
||
u8 width; // 显示位数
|
||
u8 len; // 编辑数据长度(如len>width,则需向左滚动才能输入完整的数据)
|
||
u8 left_idx; // 编辑框最左位的数据idx
|
||
u8 curr_idx; // 光标所在数据idx
|
||
u8 read_only; // 只读
|
||
u8 hide; // 隐藏
|
||
char text[20]; // 编辑内容
|
||
} TEditBox;
|
||
|
||
// 刷新显示
|
||
void EditBox_Refresh(TEditBox *pEdit);
|
||
// 创建编辑框
|
||
void EditBox_Create(TEditBox *pEdit, u8 pos, u8 width, u8 len, char *text);
|
||
// 设置只读属性
|
||
void EditBox_ReadOnly(TEditBox *pEdit);
|
||
// 设置隐藏属性
|
||
void EditBox_Hide(TEditBox *pEdit);
|
||
// 编辑框处理按键
|
||
u8 EditBox_OnKey(TEditBox *pEdit, u8 key);
|
||
// 编辑框获得焦点
|
||
void EditBox_SetFocus(TEditBox *pEdit);
|
||
|
||
// 按钮函数
|
||
typedef struct
|
||
{
|
||
u8 pos; // 显示位置
|
||
u8 width; // 显示位数
|
||
u8 hide; // 隐藏
|
||
char caption[6]; // 标题
|
||
} TButton;
|
||
|
||
// 刷新显示
|
||
void Button_Refresh(TButton *pButton);
|
||
// 创建按钮
|
||
void Button_Create(TButton *pButton, u8 pos, u8 width, char *caption);
|
||
// 设置隐藏属性
|
||
void Button_Hide(TButton *pButton);
|
||
// 按钮处理按键
|
||
u8 Button_OnKey(TButton *pButton, u8 key);
|
||
// 按钮获得焦点
|
||
void Button_SetFocus(TButton *pButton);
|
||
|
||
#endif
|