📄 print.c
字号:
/****************************************************************************
* 公司名称:SITRONIX *
* 模块名称:PRINT.C *
* 模块功能:在屏幕上打印ASC *
* 创建人员:Jim Yuan *
* 创建日期:2007-6-8 *
* 修改日期:2007-6-26 *
****************************************************************************/
#include "print.h"
#if ASC_FONT == FONT_8
#include "asc_8x8.h"
#endif
#if ASC_FONT == FONT_16
#include "asc_8x16.h"
#endif
uint8 asc_height = ASC_FONT;
uint8 asc_width = 8;
/****************************************************************************
* 函数名称:print_asc *
* 函数功能:在屏幕上打印一个ASC字符 *
* 入口参数:asc ASC数值 *
* 出口参数:无 *
* 创建日期:2007-6-8 *
* 修改日期:2007-6-26 *
* 修改原因:增加字体颜色和背景颜色设置 *
****************************************************************************/
void print_asc(uint8 asc)
{
uint8 i,j;
uint8 tmp;
for(i = 0;i < asc_height; i++)
{
tmp = asc_lib[asc - 0x20][i];
for(j = 0; j < asc_width; j++)
{
if (((tmp << j) & 0x80) == 0x80)
{
disp_data(FONT_COLOR >> 8);
disp_data(FONT_COLOR & 0x0f);
}
else
{
disp_data(BACK_COLOR >> 8);
disp_data(BACK_COLOR & 0x0f);
}
}
}
}
/****************************************************************************
* 函数名称:print_string *
* 函数功能:在屏幕上打印ASC字符串 *
* 入口参数:row 显示行 *
* column 显示列 *
* *str 显示内容 *
* 出口参数:无 *
* 创建日期:2007-6-8 *
* 修改日期:2007-6-26 *
* 修改原因:增加行,列自动计算,行/列最小值为0/0 *
****************************************************************************/
void print_string(uint16 row, uint16 column, uint8 *str)
{
uint16 r,c;
r = row;
c = column;
while (*str != '\0')
{
if (disp_area(c * asc_width, r * asc_height, asc_width, asc_height) == FALSE){return;}
print_asc(*str++);
c++;
}
}
/*ASC数值 --- ASC字符转换*/
code uint8 asc_table[] = "0123456789ABCDEF";
static char hex2ch(char hex)
{
return asc_table[hex];
}
/****************************************************************************
* 函数名称:print_hex *
* 函数功能:在屏幕上打印ASC字符串 *
* 入口参数:row 显示行 *
* column 显示列 *
* hex 显示内容 *
* 出口参数:无 *
* 创建日期:2007-6-8 *
* 修改日期:2007-6-26 *
* 修改原因:增加行,列自动计算,行/列最小值为0/0 *
****************************************************************************/
void print_hex(uint16 row, uint16 column, uint8 hex)
{
uint16 i,c,r;
uint8 table[4];
table[0] = '0';
table[1] = 'x';
table[2] = hex2ch(hex >> 4);
table[3] = hex2ch(hex & 0x0f);
r = row;
c = column;
for (i = 0;i < 4;i++)
{
if (disp_area(c * asc_width, r * asc_height, asc_width, asc_height) == FALSE){return;}
print_asc(table[i]);
c++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -