Files
FireAlarmCtrlCn/MyCode/Gui/GraphLow.cpp
2026-04-06 19:02:09 +08:00

2311 lines
51 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "stm32h743xx.h"
#include "GraphLow.h"
#include "font.h"
#include "my_font.h"
extern "C"{
#include "extern_C_Include.h"
}
const char ppp[8] = "测试";
const unsigned char *HeadOfLocation;
typedef unsigned short u16;
typedef unsigned int u32;
#define dLCD_HORIZ_SIZE 800
#define dLCD_VERT_SIZE 480
static unsigned char text_buf[76];
volatile static unsigned int FixColor;
volatile static unsigned int *pFixColor;
const unsigned int LcdBaseAddr = 0xC0000000;
const unsigned int LcdTopAddr = 0XC0177000;
Tltdc_dev LtdcDev;
void LcdTopFill(unsigned int aClr)
{
unsigned int i;
unsigned int addr = LcdTopAddr;
for(i=0; i<384000;i++){
*(volatile unsigned int*)(addr) = aClr;
addr += 4;
}
}
unsigned int Abs32(signed int num) {
if(num < 0)
num = num * -1;
return num;
}
void SwapCoord(int *c1, int *c2)
{
int tmp;
tmp = *c1;
*c1 = *c2;
*c2 = tmp;
}
int GetFontWidth(int FS)
{
switch(FS){
case 7: return 7;
case 11: return 11;
case 14: return 14;
case 17: return 17;
case 16: return 16;
case 24: return 24;
case 32: return 32;
default: return 16;
}
}
int GetFontHeight(int FS)
{
switch(FS){
case 7: return 12;
case 11: return 16;
case 14: return 20;
case 17: return 24;
case 16: return 16;
case 24: return 24;
case 32: return 32;
default: return 16;
}
}
void PixelRender(int x, int y, unsigned int aColor)
{
unsigned int addr;
addr = ((y * 800) + x) *4 + LcdBaseAddr;
*(volatile unsigned int*)(addr) = aColor;
}
void BoxRender2D(int x1, int y1, int x2, int y2, unsigned int color)
{
LTDC_Fill(x1,y1,x2,y2, color);
}
void PixelRender(int x, int y, int PenWidth, unsigned int PenColor)
{
unsigned int addr;
if(PenWidth ==1){
addr = ((y * 800) + x) *4 + LcdBaseAddr;
*(volatile unsigned int*)(addr) = PenColor;
}else{
int aW, aH;
for(aW=0; aW<PenWidth; aW++){
for(aH=0; aH<PenWidth; aH++){
addr = (((y+aH) * 800) + (x+aW)) *4 + LcdBaseAddr;
*(volatile unsigned int*)(addr) = PenColor;
}
}
}
}
void LineRender (int x1, int y1, int x2, int y2, int PenWidth, unsigned int PenColor) //draw line - bresenham algorithm
{
signed int delta_x, delta_y;
signed int ix, iy;
/*
if((x1 == x2) || (y1 == y2)) // if the line is vertical or horizontal then draw box function is faster than general bresenham algorithm
{
if(PenWidth > 1 )
{
if(x1 > x2)
{
SwapCoord(&x1, &x2);
}
if(y1 > y2)
{
SwapCoord(&y1, &y2);
}
x2++;
y2++;
}
BoxRender2D(x1 ,y1 ,x2 , y2, PenColor);
return;
}
*/
if(x1 == x2){
VertLineRender(x1, y1, y2-y1+1, PenColor);
return;
}else
if(y1 == y2){
HorizLineRender(x1, y2, x2-x1+1, PenColor);
return;
}
delta_x = static_cast<int>(Abs32((x2 - x1)) << 1);
delta_y = static_cast<int>(Abs32((y2 - y1)) << 1);
// if x1 == x2 or y1 == y2, then it does not matter what we set here
ix = ((x2 > x1)?1:-1);
iy = ((y2 > y1)?1:-1);
PixelRender( x1, y1, PenWidth, PenColor);
if (delta_x >= delta_y)
{
// error may go below zero
int error = delta_y - (delta_x >> 1);
while (x1 != x2)
{
if (error >= 0)
{
if (error || (ix > 0))
{
y1 += iy;
error -= delta_x;
}
// else do nothing
}
// else do nothing
x1 += ix;
error += delta_y;
PixelRender( x1, y1, PenWidth, PenColor);
}
}
else
{
// error may go below zero
int error = delta_x - (delta_y >> 1);
while (y1 != y2)
{
if (error >= 0)
{
if (error || (iy > 0))
{
x1 += ix;
error -= delta_y;
}
// else do nothing
}
// else do nothing
y1 += iy;
error += delta_x;
PixelRender( x1, y1, PenWidth, PenColor);
}
}
}
void HorizLineRender(int xpos, int ypos, int length, unsigned int clr)
{
unsigned short i;
unsigned int ram_addr;
ram_addr = LcdBaseAddr + ((ypos * 800) + xpos) * 4;
for(i=0; i<length; i++){
*(volatile unsigned int*)(ram_addr) = clr;
ram_addr +=4;
}
}
void VertLineRender(int xpos, int ypos, int length, unsigned int clr)
{
unsigned int i;
unsigned int ram_addr;
ram_addr = LcdBaseAddr + ((ypos * 800) + xpos) * 4;
for(i=0; i<length; i++){
*(volatile unsigned int*)(ram_addr) = clr;
ram_addr += dLCD_HORIZ_SIZE * 4;
}
}
void RectRender(int x1, int y1, int x2, int y2, int PenWidth, unsigned int color) //draw rectangle
{
int i;
if(PenWidth <2){
LineRender(x1, y1, x2, y1, PenWidth, color);
LineRender(x2, y1, x2, y2, PenWidth, color);
LineRender(x1, y2, x2, y2, PenWidth, color);
LineRender(x1, y1, x1, y2, PenWidth, color);
}else{
for(i=0; i<PenWidth; i++){
LineRender(x1+i, y1+i, x2-i, y1+i, 1, color);
LineRender(x2-i, y1+i, x2-i, y2-i, 1, color);
LineRender(x1+i, y2-i, x2-i, y2-i, 1, color);
LineRender(x1+i, y1+i, x1+i, y2-i, 1, color);
}
}
}
void RectFillRender(int x1, int y1, int x2, int y2, unsigned int color) //draw rectangle
{
/*
unsigned int psx,psy,pex,pey; //以LCD面板为基准的坐标系,不随横竖屏变化而变化
unsigned int timeout=0;
unsigned short offline;
unsigned int addr;
//坐标系转换
psx=x1;psy=y1;
pex=x2;pey=y2;
FixColor = color;
pFixColor = &FixColor;
offline = 800 - (pex-psx);
addr= LcdBaseAddr + psy * 800 + psx;
RCC->AHB1ENR|=1<<23; //使能DM2D时钟
DMA2D->CR=3<<16; //寄存器到存储器模式
DMA2D->BGPFCCR = 0x00;
DMA2D->FGPFCCR = 0x00;
DMA2D->OPFCCR=0x00; //LCD_PIXFORMAT; //设置颜色格式 LCD_PIXEL_FORMAT_ARGB8888 0X00
DMA2D->OOR=offline; //设置行偏移
DMA2D->CR&=~(1<<0); //先停止DMA2D
DMA2D->OMAR=addr; //输出存储器地址
DMA2D->NLR=(pey-psy)|((pex-psx)<<16); //设定行数寄存器
DMA2D->OCOLR=FixColor; //设定输出颜色寄存器
DMA2D->CR|=1<<0; //启动DMA2D
while((DMA2D->ISR&(1<<1))==0) //等待传输完成
{
timeout++;
if(timeout>0X2FFFFFF)break; //超时退出
}
DMA2D->IFCR|=1<<1; //清除传输完成标志
*/
int x,y,aW,aH;
volatile unsigned int ram_addr;
if(x1 > x2){
ram_addr = ((y2 ) * 800 + x2) *4 + LcdBaseAddr;
aW = x1 -x2 + 1;
aH = y1 - y2 + 1;
}else{
ram_addr = ((y1 ) * 800 + x1) *4 + LcdBaseAddr;
aW = x2 -x1 + 1;
aH = y2 - y1 + 1;
}
for(y=0; y<aH; y++){
for(x=0; x<aW; x++){
*(volatile unsigned int *)(ram_addr) = color;
ram_addr += 4;
}
ram_addr += (800 - aW) *4 ;
}
}
unsigned int lcd_draw_char_8x16(unsigned int xpos, unsigned int ypos, unsigned int clr, char cr)
{
unsigned int ram_addr;
unsigned int data_x;
unsigned int x,y;
unsigned char c;
unsigned int state = 0;
//if((xpos+11) > LCD_X_SIZE){
//beyond screen width
// state |= 1;
//}
//if((ypos+16) > LCD_V_SIZE){
//beyond screen height
// state |= 2;
//}
//if(stete){
// return state;
//}
ram_addr = ((ypos - 1) * dLCD_HORIZ_SIZE + xpos) * 4;
data_x = static_cast<unsigned int>((cr - ' ' ) * 8 * 2);
for(y=0;y<16;y++){
c = 0x80;
for(x=0;x<8;x++){
if(ascii_8x16[data_x] & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = clr;
}else{
//ram_x = ~clr;
}
ram_addr += 4;
c >>=1;
}
c = 0x80;
data_x++;
ram_addr += (dLCD_HORIZ_SIZE - 8) *4 ;
}
return state;
}
unsigned int lcd_draw_char_8x16(unsigned int xpos, unsigned int ypos, unsigned int clr, unsigned int bClr, char cr)
{
unsigned int ram_addr;
unsigned int data_x;
unsigned int x,y;
unsigned char c;
unsigned int state = 0;
//if((xpos+11) > LCD_X_SIZE){
//beyond screen width
// state |= 1;
//}
//if((ypos+16) > LCD_V_SIZE){
//beyond screen height
// state |= 2;
//}
//if(stete){
// return state;
//}
ram_addr = ((ypos - 1) * dLCD_HORIZ_SIZE + xpos) * 4;
data_x = static_cast<unsigned int>((cr - ' ' ) * 8 * 2);
for(y=0;y<16;y++){
c = 0x80;
for(x=0;x<8;x++){
if(ascii_8x16[data_x] & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = clr;
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = bClr;
}
ram_addr += 4;
c >>=1;
}
c = 0x80;
data_x++;
ram_addr += (dLCD_HORIZ_SIZE - 8) *4 ;
}
return state;
}
void lcd_draw_str_8x16(unsigned int xpos,unsigned int ypos,unsigned int clr, char *pc)
{
unsigned int text_size = 0;
const char *p_text;
unsigned int xp;
unsigned int i;
//get text size
p_text = pc;
while (*p_text++) text_size ++ ;
xp = xpos;
if(text_size>1024)return;
for(i=0; i<text_size; i++){
lcd_draw_char_8x16(xp,ypos,clr,*pc);
xp += 8;
pc++;
}
}
unsigned int lcd_draw_char_11x16(unsigned int xpos, unsigned int ypos, unsigned int clr, char cr)
{
unsigned int ram_addr;
unsigned int data_x;
unsigned int x,y;
unsigned char c;
unsigned int state = 0;
//if((xpos+11) > LCD_X_SIZE){
//beyond screen width
// state |= 1;
//}
//if((ypos+16) > LCD_V_SIZE){
//beyond screen height
// state |= 2;
//}
//if(stete){
// return state;
//}
ram_addr = ((ypos - 1) * dLCD_HORIZ_SIZE + xpos) * 4;
data_x = static_cast<unsigned int>((cr - ' ' ) * 16 * 2);
for(y=0;y<16;y++){
c = 0x80;
for(x=0;x<8;x++){
if(ascii_11x16_table[data_x] & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = clr;
}else{
//ram_x = ~clr;
}
ram_addr += 4;
c >>=1;
}
c = 0x80;
data_x++;
for(x=0;x<3;x++){
if(ascii_11x16_table[data_x] & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = clr;
}else{
//ram_x = ~clr;
}
ram_addr += 4;
c >>=1;
}
data_x++;
ram_addr += (dLCD_HORIZ_SIZE - 11) *4 ;
}
return state;
}
void lcd_draw_str_11x16(unsigned int xpos,unsigned int ypos,unsigned int clr,const char *pc)
{
unsigned int text_size = 0;
const char *p_text;
unsigned int xp;
unsigned int i;
//get text size
p_text = pc;
while (*p_text++) text_size ++ ;
xp = xpos;
if(text_size>1024)return;
for(i=0; i<text_size; i++){
lcd_draw_char_11x16(xp,ypos,clr,*pc);
xp += 11;
pc++;
}
}
void lcd_draw_str_11x16(unsigned int xpos,unsigned int ypos,unsigned int clr, char *pc)
{
unsigned int text_size = 0;
char *p_text;
unsigned int xp;
unsigned int i;
//get text size
p_text = pc;
while (*p_text++) text_size ++ ;
xp = xpos;
if(text_size>1024)return;
for(i=0; i<text_size; i++){
lcd_draw_char_11x16(xp,ypos,clr,*pc);
xp += 11;
pc++;
}
}
unsigned int lcd_draw_char_14x20(unsigned int xpos, unsigned int ypos, unsigned int clr, unsigned char cr)
{
unsigned int ram_addr;
unsigned int data_x;
unsigned int x,y;
unsigned char c;
unsigned int state = 0;
//if((xpos+14) > LCD_X_SIZE){
//beyond screen width
// state |= 1;
//}
//if((ypos+20) > LCD_V_SIZE){
//beyond screen height
// state |= 2;
//}
//if(stete){
// return state;
//}
ram_addr = ((ypos - 1) * dLCD_HORIZ_SIZE + xpos) * 4;
data_x = (unsigned int)((cr - ' ' ) * 20 * 2);
for(y=0;y<20;y++){
c = 0x80;
for(x=0;x<8;x++){
if(ascii_14x20_table[data_x] & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = clr;
}else{
//ram_x = ~clr;
}
ram_addr += 4;
c >>=1;
}
c = 0x80;
data_x++;
for(x=0;x<6;x++){
if(ascii_14x20_table[data_x] & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = clr;
}else{
//ram_x = ~clr;
}
ram_addr += 4;
c >>=1;
}
data_x++;
ram_addr += (dLCD_HORIZ_SIZE - 14) *4 ;
}
return state;
}
void lcd_draw_str_14x20(unsigned int xpos,unsigned int ypos, unsigned int clr, const char *pc)
{
unsigned int text_size = 0;
const char *p_text;
unsigned int xp;
unsigned int i;
//get text size
p_text = pc;
while (*p_text++) text_size ++ ;
xp = xpos;
if(text_size > 1024)return;
for(i=0; i<text_size; i++){
lcd_draw_char_14x20(xp,ypos,clr,*pc);
xp += 14;
pc++;
}
}
void lcd_draw_str_14x20(unsigned int xpos,unsigned int ypos, unsigned int clr, char *pc)
{
unsigned int text_size = 0;
char *p_text;
unsigned int xp;
unsigned int i;
//get text size
p_text = pc;
while (*p_text++) text_size ++ ;
xp = xpos;
if(text_size > 1024)return;
for(i=0; i<text_size; i++){
lcd_draw_char_14x20(xp,ypos,clr,*pc);
xp += 14;
pc++;
}
}
unsigned int lcd_draw_char_17x24(unsigned int xpos, unsigned int ypos, unsigned int clr, unsigned char cr)
{
unsigned int ram_addr;
unsigned int data_x;
unsigned int x,y;
unsigned char c;
unsigned int state = 0;
//if((xpos+17) > LCD_X_SIZE){
//beyond screen width
// state |= 1;
//}
//if((ypos+24) > LCD_V_SIZE){
//beyond screen height
// state |= 2;
//}
//if(stete){
// return state;
//}
ram_addr = ((ypos - 1) * dLCD_HORIZ_SIZE + xpos) * 4;
data_x = static_cast<unsigned int>((cr - ' ' ) * 24 * 3);
for(y=0;y<24;y++){
c = 0x80;
for(x=0;x<8;x++){
if(ascii_17x24_table[data_x] & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = clr;
}else{
//ram_x = ~clr;
}
ram_addr += 4;
//add lint here
c >>=1;
}
c = 0x80;
data_x++;
for(x=0;x<8;x++){ //ascii_17x24_table
if(ascii_17x24_table[data_x] & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = clr;
}else{
//ram_x = ~clr;
}
ram_addr += 4;
//add lint here
c >>=1;
}
c = 0x80;
data_x++;
if(1){
if(ascii_17x24_table[data_x] & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = clr;
}else{
//ram_x = ~clr;
}
ram_addr += 4;
//add lint here
c >>=1;
}
data_x++;
ram_addr += (dLCD_HORIZ_SIZE - 17) *4 ;
}
return state;
}
void lcd_draw_str_17x24(unsigned int xpos,unsigned int ypos, unsigned int clr, unsigned char *pc)
{
unsigned int text_size = 0;
unsigned char *p_text;
unsigned int xp;
unsigned int i;
//get text size
p_text = pc;
while (*p_text++) text_size ++ ;
xp = xpos;
if(text_size > 1024)return;
for(i=0; i<text_size; i++){
lcd_draw_char_17x24(xp,ypos,clr,*pc);
xp += 17;
pc++;
}
}
void gui_write_EN2412(unsigned short x1, unsigned short y1, unsigned int CharColor, unsigned char num)
{
const unsigned char* pbuf;
unsigned int x, y;
unsigned short ix, iy;
unsigned int offset = 0;
unsigned int ram_addr;
unsigned char c;
x = x1;
y = y1;
//num=num-' ';//得到偏移后的值ASCII字库是从空格开始取模所以-' '就是对应字符的字库)
offset = (num-' ');
pbuf = &asc2_2412[offset][0];
for(y=0;y<12;y++){
ram_addr = (y1 * dLCD_HORIZ_SIZE + x1) * 4;
c = 0x80;
for(x=0;x<8;x++){
if(*pbuf & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor;
}else{
//ram_x = ~clr;
}
ram_addr += 3200;
//add lint here
c >>=1;
}
pbuf++;
c = 0x80;
for(x=0;x<8;x++){ //ascii_17x24_table
if(*pbuf & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor;
}else{
//ram_x = ~clr;
}
ram_addr += 3200;
//add lint here
c >>=1;
}
pbuf++;
c = 0x80;
for(x=0;x<8;x++){
if(*pbuf & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor;
}else{
//ram_x = ~clr;
}
ram_addr += 3200;
//add lint here
c >>=1;
}
pbuf++;
x1++;
}
}
void gui_write_EN2412(unsigned short x1, unsigned short y1, unsigned int CharColor, unsigned int bClr, unsigned char num)
{
const unsigned char* pbuf;
unsigned int x, y;
unsigned short ix, iy;
unsigned int offset = 0;
unsigned int ram_addr;
unsigned char c;
x = x1;
y = y1;
//num=num-' ';//得到偏移后的值ASCII字库是从空格开始取模所以-' '就是对应字符的字库)
offset = (num-' ');
pbuf = &asc2_2412[offset][0];
for(y=0;y<12;y++){
ram_addr = (y1 * dLCD_HORIZ_SIZE + x1) * 4;
c = 0x80;
for(x=0;x<8;x++){
if(*pbuf & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor;
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = bClr;
}
ram_addr += 3200;
//add lint here
c >>=1;
}
pbuf++;
c = 0x80;
for(x=0;x<8;x++){ //ascii_17x24_table
if(*pbuf & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor;
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = bClr;
}
ram_addr += 3200;
//add lint here
c >>=1;
}
pbuf++;
c = 0x80;
for(x=0;x<8;x++){
if(*pbuf & c){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor;
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = bClr;
}
ram_addr += 3200;
//add lint here
c >>=1;
}
pbuf++;
x1++;
}
}
static unsigned int get_chinese_code24(const char *p)
{
u32 address;
address=72UL*( ((*p)-15-0xa1)*94 + ((*(p+1))-0xa1) );
//sFLASH_ReadBuffer(dot, address, 72);
return address;
}
static unsigned int get_chinese_code24(char *p)
{
u32 address;
address=72UL*( ((*p)-15-0xa1)*94 + ((*(p+1))-0xa1) );
//sFLASH_ReadBuffer(dot, address, 72);
return address;
}
static unsigned int get_chinese_code24(unsigned char *p)
{
u32 address;
address=72UL*( ((*p)-15-0xa1)*94 + ((*(p+1))-0xa1) );
//sFLASH_ReadBuffer(dot, address, 72);
return address;
}
static unsigned int get_C_code24(const char *p)
{
u32 address;
if((*(p+1)) < 0x7F){
address=72UL*( ((*p)-0x81)*190 + ((*(p+1))-0x40) );
}else{
address=72UL*( ((*p)-0x81)*190 + ((*(p+1))-0x41) );
}
//sFLASH_ReadBuffer(dot, address, 72);
return address;
}
static unsigned int get_C_code24(char *p)
{
u32 address;
if((*(p+1)) < 0x7F){
address=72UL*( ((*p)-0x81)*190 + ((*(p+1))-0x40) );
}else{
address=72UL*( ((*p)-0x81)*190 + ((*(p+1))-0x41) );
}
//sFLASH_ReadBuffer(dot, address, 72);
return address;
}
static unsigned int get_C_code24(unsigned char *p)
{
u32 address;
if((*(p+1)) < 0x7F){
address=72UL*( ((*p)-0x81)*190 + ((*(p+1))-0x40) );
}else{
address=72UL*( ((*p)-0x81)*190 + ((*(p+1))-0x41) );
}
//sFLASH_ReadBuffer(dot, address, 72);
return address;
}
void TextRender_1CN24(int x, int y, unsigned int CharColor, const char *p)
{
const unsigned char* pbuf;
unsigned short ix, iy;
unsigned int ram_addr;
static unsigned int offset = 0;
unsigned char c;
//if((*p<0xA1) || (*(p+1)< 0xA1)){
if(1){
offset = get_C_code24(p);
HeadOfLocation = (const unsigned char *)Gbk_24_data;
pbuf = &HeadOfLocation[offset];
for(iy=0; iy<24; iy++){
ram_addr = (y * dLCD_HORIZ_SIZE + x) * 4;
c = 0x80;
for(ix=0; ix<8; ix++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
c = 0x80;
for(ix=0; ix<8; ix++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+8, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
c = 0x80;
for(ix=0; ix<8; ix++)
{
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+16, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
y++;
}
}else{
offset = get_chinese_code24( p);
//______________________________fill location
//HeadOfLocation = Hzk_24_data;
pbuf = &HeadOfLocation[offset];
for(ix=0; ix<24; ix++){
ram_addr = (y * dLCD_HORIZ_SIZE + x) * 4;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+8, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+16, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
x++;
}
}
}
void TextRender_1CN24(int x, int y, unsigned int CharColor, char *p)
{
const unsigned char* pbuf;
unsigned short ix, iy;
unsigned int ram_addr;
unsigned int offset = 0;
unsigned char c;
//if((*p<0xA1) || (*(p+1)< 0xA1)){
if(1){
offset = get_C_code24(p);
HeadOfLocation = (const unsigned char *)Gbk_24_data;
pbuf = &HeadOfLocation[offset];
for(iy=0; iy<24; iy++){
ram_addr = (y * dLCD_HORIZ_SIZE + x) * 4;
c = 0x80;
for(ix=0; ix<8; ix++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
c = 0x80;
for(ix=0; ix<8; ix++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+8, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
c = 0x80;
for(ix=0; ix<8; ix++)
{
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+16, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
y++;
}
}else{
offset = get_chinese_code24( p);
//______________________________fill location
//HeadOfLocation = Hzk_24_data;
pbuf = &HeadOfLocation[offset];
for(ix=0; ix<24; ix++){
ram_addr = (y * dLCD_HORIZ_SIZE + x) * 4;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+8, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+16, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
x++;
}
}
}
void TextRender_1CN24(int x, int y, unsigned int CharColor, unsigned char *p)
{
const unsigned char* pbuf;
unsigned short ix, iy;
unsigned int ram_addr;
unsigned int offset = 0;
unsigned char c;
//if((*p<0xA1) || (*(p+1)< 0xA1)){
if(1){
offset = get_C_code24(p);
HeadOfLocation = (const unsigned char *)Gbk_24_data;
pbuf = &HeadOfLocation[offset];
for(iy=0; iy<24; iy++){
ram_addr = (y * dLCD_HORIZ_SIZE + x) * 4;
c = 0x80;
for(ix=0; ix<8; ix++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
c = 0x80;
for(ix=0; ix<8; ix++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+8, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
c = 0x80;
for(ix=0; ix<8; ix++)
{
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+16, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
y++;
}
}else{
offset = get_chinese_code24( p);
//______________________________fill location
//HeadOfLocation = Hzk_24_data;
pbuf = &HeadOfLocation[offset];
for(ix=0; ix<24; ix++){
ram_addr = (y * dLCD_HORIZ_SIZE + x) * 4;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+8, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
//gui_put_pixel(x, y+iy+16, 0, BackColor); //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
x++;
}
}
}
void TextRender_1CN24(int x, int y, unsigned int CharColor, unsigned int bClr, const char *p)
{
const unsigned char* pbuf;
unsigned short ix, iy;
unsigned int ram_addr;
unsigned int offset = 0;
unsigned char c;
//if((*p<0xA1) || (*(p+1)< 0xA1)){
if(1){
offset = get_C_code24(p);
HeadOfLocation = (const unsigned char *)Gbk_24_data;
pbuf = &HeadOfLocation[offset];
for(iy=0; iy<24; iy++){
ram_addr = (y * dLCD_HORIZ_SIZE + x) * 4;
c = 0x80;
for(ix=0; ix<8; ix++){
if( (*pbuf & c)==0 ){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = bClr; //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
c = 0x80;
for(ix=0; ix<8; ix++){
if( (*pbuf & c)==0 ){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = bClr; //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
c = 0x80;
for(ix=0; ix<8; ix++)
{
if( (*pbuf & c)==0 ){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = bClr; //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 4;
c >>=1;
}
pbuf++;
y++;
}
}else{
offset = get_chinese_code24( p);
//______________________________fill location
//HeadOfLocation = Hzk_24_data;
pbuf = &HeadOfLocation[offset];
for(ix=0; ix<24; ix++){
ram_addr = (y * dLCD_HORIZ_SIZE + x) * 4;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = bClr; //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = bClr; //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
c = 0x80;
for(iy=0; iy<8; iy++){
if( (*pbuf & c)==0 ){
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = bClr; //______________________________put pixel here
}else{
*(volatile unsigned int *)(LcdBaseAddr+ ram_addr) = CharColor; //______________________________put pixel here
}
ram_addr += 3200;
c >>=1;
}
pbuf++;
x++;
}
}
}
void TextRender_string24(int x, int y, unsigned int CharColor, unsigned char* pC)
{
unsigned char dat;
unsigned char *p;
p = pC;
for(; *p!=0; p++)
{
if(( (unsigned char)*p&0x80)==0)//??
{
if(*p=='\r')//??
{
//x=START_X;
continue;
}
else if(*p=='\n')//??
{
//y+=24;
//if(y > RECT_YMAX-24)
// y=START_Y;
continue;
}
else if(*p=='\1') //?????.?
dat='~'-' '+1;
else if(*p=='\2') //?????.?
dat='~'-' '+2;
else if(*p=='\3') //?????.?
dat='~'-' '+3;
else if(*p=='\4') //?????.?
dat='~'-' '+4;
// else if(*p=='\\') //?????
// {
// p++;
// if(*p=='U') //?????.?
// dat='~'-' '+1;
// else if(*p=='D') //?????.?
// dat='~'-' '+2;
// else if(*p=='L') //?????.?
// dat='~'-' '+3;
// else// if(*p=='R') //?????.?
// dat='~'-' '+4;
// }
else //??????
dat=*p-0x20;
dat=*p;
gui_write_EN2412(x, y, CharColor, dat);
x+=12;
//gui_write_EN2417(x, y, CharColor, BackColor, dat);
//x+=17;
}
else//??
{
TextRender_1CN24(x, y, CharColor, p);
x+=24;
p++;
}
}
}
void TextRender_string24(int x, int y, unsigned int CharColor, unsigned int aBClr, unsigned char* pC)
{
unsigned char dat;
unsigned char *p;
p = pC;
for(; *p!=0; p++)
{
if(( (unsigned char)*p&0x80)==0)//??
{
if(*p=='\r')//??
{
//x=START_X;
continue;
}
else if(*p=='\n')//??
{
//y+=24;
//if(y > RECT_YMAX-24)
// y=START_Y;
continue;
}
else if(*p=='\1') //?????.?
dat='~'-' '+1;
else if(*p=='\2') //?????.?
dat='~'-' '+2;
else if(*p=='\3') //?????.?
dat='~'-' '+3;
else if(*p=='\4') //?????.?
dat='~'-' '+4;
// else if(*p=='\\') //?????
// {
// p++;
// if(*p=='U') //?????.?
// dat='~'-' '+1;
// else if(*p=='D') //?????.?
// dat='~'-' '+2;
// else if(*p=='L') //?????.?
// dat='~'-' '+3;
// else// if(*p=='R') //?????.?
// dat='~'-' '+4;
// }
else //??????
dat=*p-0x20;
dat=*p;
gui_write_EN2412(x, y, CharColor, aBClr, dat);
x+=12;
//gui_write_EN2417(x, y, CharColor, BackColor, dat);
//x+=17;
}
else//??
{
TextRender_1CN24(x, y, CharColor, aBClr, (const char *)(p));
x+=24;
p++;
}
}
}
void TextRender_string24(int x, int y, unsigned int CharColor, const char* pC)
{
unsigned char dat;
const char *p;
p = pC;
for(; *p!=0; p++)
{
if(( (unsigned char)*p&0x80)==0)//??
{
if(*p=='\r')//??
{
//x=START_X;
continue;
}
else if(*p=='\n')//??
{
//y+=24;
//if(y > RECT_YMAX-24)
// y=START_Y;
continue;
}
else if(*p=='\1') //?????.?
dat='~'-' '+1;
else if(*p=='\2') //?????.?
dat='~'-' '+2;
else if(*p=='\3') //?????.?
dat='~'-' '+3;
else if(*p=='\4') //?????.?
dat='~'-' '+4;
// else if(*p=='\\') //?????
// {
// p++;
// if(*p=='U') //?????.?
// dat='~'-' '+1;
// else if(*p=='D') //?????.?
// dat='~'-' '+2;
// else if(*p=='L') //?????.?
// dat='~'-' '+3;
// else// if(*p=='R') //?????.?
// dat='~'-' '+4;
// }
else //??????
dat=*p-0x20;
dat=*p;
gui_write_EN2412(x, y, CharColor, dat);
x+=12;
//gui_write_EN2417(x, y, CharColor, BackColor, dat);
//x+=17;
}
else//??
{
TextRender_1CN24(x, y, CharColor, p);
x+=24;
p++;
}
}
}
void TextRender_string24(int x, int y, unsigned int CharColor, char* pC)
{
unsigned char dat;
const char *p;
p = pC;
for(; *p!=0; p++)
{
if(( (unsigned char)*p&0x80)==0)//??
{
if(*p=='\r')//??
{
//x=START_X;
continue;
}
else if(*p=='\n')//??
{
//y+=24;
//if(y > RECT_YMAX-24)
// y=START_Y;
continue;
}
else if(*p=='\1') //?????.?
dat='~'-' '+1;
else if(*p=='\2') //?????.?
dat='~'-' '+2;
else if(*p=='\3') //?????.?
dat='~'-' '+3;
else if(*p=='\4') //?????.?
dat='~'-' '+4;
// else if(*p=='\\') //?????
// {
// p++;
// if(*p=='U') //?????.?
// dat='~'-' '+1;
// else if(*p=='D') //?????.?
// dat='~'-' '+2;
// else if(*p=='L') //?????.?
// dat='~'-' '+3;
// else// if(*p=='R') //?????.?
// dat='~'-' '+4;
// }
else //??????
dat=*p-0x20;
dat=*p;
gui_write_EN2412(x, y, CharColor, dat);
x+=12;
//gui_write_EN2417(x, y, CharColor, BackColor, dat);
//x+=17;
}
else//??
{
TextRender_1CN24(x, y, CharColor, p);
x+=24;
p++;
}
}
}
void TextRender_string24(int x, int y, unsigned int CharColor, unsigned int bClr, char* pC)
{
unsigned char dat;
const char *p;
p = pC;
for(; *p!=0; p++)
{
if(( (unsigned char)*p&0x80)==0)//??
{
if(*p=='\r')//??
{
//x=START_X;
continue;
}
else if(*p=='\n')//??
{
//y+=24;
//if(y > RECT_YMAX-24)
// y=START_Y;
continue;
}
else if(*p=='\1') //?????.?
dat='~'-' '+1;
else if(*p=='\2') //?????.?
dat='~'-' '+2;
else if(*p=='\3') //?????.?
dat='~'-' '+3;
else if(*p=='\4') //?????.?
dat='~'-' '+4;
// else if(*p=='\\') //?????
// {
// p++;
// if(*p=='U') //?????.?
// dat='~'-' '+1;
// else if(*p=='D') //?????.?
// dat='~'-' '+2;
// else if(*p=='L') //?????.?
// dat='~'-' '+3;
// else// if(*p=='R') //?????.?
// dat='~'-' '+4;
// }
else //??????
dat=*p-0x20;
dat=*p;
gui_write_EN2412(x, y, CharColor, bClr, dat);
x+=12;
//gui_write_EN2417(x, y, CharColor, BackColor, dat);
//x+=17;
}
else//??
{
TextRender_1CN24(x, y, CharColor, bClr, p);
x+=24;
p++;
}
}
}
void TextRender_string24(int x, int y, unsigned int CharColor, unsigned int bClr, const char* pC)
{
unsigned char dat;
const char *p;
p = pC;
for(; *p!=0; p++)
{
if(( (unsigned char)*p&0x80)==0)//??
{
if(*p=='\r')//??
{
//x=START_X;
continue;
}
else if(*p=='\n')//??
{
//y+=24;
//if(y > RECT_YMAX-24)
// y=START_Y;
continue;
}
else if(*p=='\1') //?????.?
dat='~'-' '+1;
else if(*p=='\2') //?????.?
dat='~'-' '+2;
else if(*p=='\3') //?????.?
dat='~'-' '+3;
else if(*p=='\4') //?????.?
dat='~'-' '+4;
// else if(*p=='\\') //?????
// {
// p++;
// if(*p=='U') //?????.?
// dat='~'-' '+1;
// else if(*p=='D') //?????.?
// dat='~'-' '+2;
// else if(*p=='L') //?????.?
// dat='~'-' '+3;
// else// if(*p=='R') //?????.?
// dat='~'-' '+4;
// }
else //??????
dat=*p-0x20;
dat=*p;
gui_write_EN2412(x, y, CharColor, bClr, dat);
x+=12;
//gui_write_EN2417(x, y, CharColor, BackColor, dat);
//x+=17;
}
else//??
{
TextRender_1CN24(x, y, CharColor, bClr, p);
x+=24;
p++;
}
}
}
void TextDigitRender1Right24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int da;
da = dig % 10;
gui_write_EN2412(x, y, CharColor, da + '0');
}
void TextDigitRender1Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int da;
da = dig % 10;
gui_write_EN2412(x, y, CharColor, bClr, da + '0');
}
void TextDigitRenderLeft24_1t3(int x, int y, unsigned int CharColor, unsigned int dig)
{
if(dig > 999)return;
if(dig < 10){
gui_write_EN2412(x, y, CharColor, dig + '0');
}else
if(dig < 100){
TextDigitRender2Right24(x,y,CharColor,dig);
}else{
TextDigitRender3Right24(x,y,CharColor,dig);
}
}
void TextDigitRenderLeft24_1t3(int x, int y, unsigned int CharColor, unsigned int BackClr, unsigned int dig)
{
if(dig > 999)return;
if(dig < 10){
gui_write_EN2412(x, y, CharColor, BackClr, dig + '0');
}else
if(dig < 100){
TextDigitRender2Right24(x,y,CharColor,BackClr,dig);
}else{
TextDigitRender3Right24(x,y,CharColor,BackClr,dig);
}
}
void TextDigitRender2_24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 10;
da = dig;
for(i=0; i<2; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender2_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 10;
da = dig;
for(i=0; i<2; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender2Right24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x + 12;
gui_write_EN2412(x2, y, CharColor, '0');
}
x2 = x;
Found = 0;
aRatio = 10;
da = dig;
for(i=0; i<2; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, Le + '0');
}else{
if(Le == 0){
if(i == 1)gui_write_EN2412(x2, y, CharColor, '0');
}else{
gui_write_EN2412(x2, y, CharColor, Le + '0');
Found = 1;
}
}
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender2Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x + 12;
gui_write_EN2412(x2, y, CharColor, '0');
}
x2 = x;
Found = 0;
aRatio = 10;
da = dig;
for(i=0; i<2; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
}else{
if(Le == 0){
gui_write_EN2412(x2, y, CharColor, bClr, ' ');
if(i == 1)gui_write_EN2412(x2, y, CharColor, bClr, '0');
}else{
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
Found = 1;
}
}
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender3_24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 100;
da = dig;
for(i=0; i<3; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender3_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 100;
da = dig;
for(i=0; i<3; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender4_24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 1000;
da = dig;
for(i=0; i<4; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender4_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 1000;
da = dig;
for(i=0; i<4; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender5_24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 10000;
da = dig;
for(i=0; i<5; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender5_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 10000;
da = dig;
for(i=0; i<5; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender6_24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 100000;
da = dig;
for(i=0; i<6; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender6_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 100000;
da = dig;
for(i=0; i<6; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender8_24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 10000000;
da = dig;
for(i=0; i<8; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender8_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
x2 = x;
aRatio = 10000000;
da = dig;
for(i=0; i<8; i++){
Le = da / aRatio;
da = da % aRatio;
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender3Right24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x + 24;
gui_write_EN2412(x2, y, CharColor, '0');
}
x2 = x;
Found = 0;
aRatio = 100;
da = dig;
for(i=0; i<3; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, Le + '0');
}else{
if(Le == 0){
//if(Found)gui_write_EN2412(x2, y, CharColor, ' ');
if(i == 2)gui_write_EN2412(x2, y, CharColor, '0');
}else{
gui_write_EN2412(x2, y, CharColor, Le + '0');
Found = 1;
}
}
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender3Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x + 0;
gui_write_EN2412(x2, y, CharColor, bClr, ' ');
x2 = x + 12;
gui_write_EN2412(x2, y, CharColor, bClr, ' ');
x2 = x + 24;
gui_write_EN2412(x2, y, CharColor, bClr, '0');
}
x2 = x;
Found = 0;
aRatio = 100;
da = dig;
for(i=0; i<3; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
}else{
if(Le == 0){
gui_write_EN2412(x2, y, CharColor, bClr, ' ');
if(i == 2)gui_write_EN2412(x2, y, CharColor, bClr, '0');
}else{
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
Found = 1;
}
}
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender4Right24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x + 36;
gui_write_EN2412(x2, y, CharColor, '0');
return;
}
x2 = x;
Found = 0;
aRatio = 1000;
da = dig;
for(i=0; i<4; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, Le + '0');
}else{
if(Le == 0){
//if(Found)gui_write_EN2412(x2, y, CharColor, ' ');
if(i == 3)gui_write_EN2412(x2, y, CharColor, '0');
}else{
gui_write_EN2412(x2, y, CharColor, Le + '0');
Found = 1;
}
}
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender4Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x + 36;
gui_write_EN2412(x2, y, CharColor, bClr, '0');
return;
}
x2 = x;
Found = 0;
aRatio = 1000;
da = dig;
for(i=0; i<4; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
}else{
if(Le == 0){
if(i == 3)gui_write_EN2412(x2, y, CharColor, bClr, '0');
else gui_write_EN2412(x2, y, CharColor, bClr, ' ');
}else{
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
Found = 1;
}
}
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender5Right24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x + 48;
gui_write_EN2412(x2, y, CharColor, '0');
return;
}
x2 = x;
Found = 0;
aRatio = 10000;
da = dig;
for(i=0; i<5; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, Le + '0');
}else{
if(Le == 0){
//if(Found)gui_write_EN2412(x2, y, CharColor, ' ');
if(i == 4)gui_write_EN2412(x2, y, CharColor, '0');
}else{
gui_write_EN2412(x2, y, CharColor, Le + '0');
Found = 1;
}
}
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender5Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x + 48;
gui_write_EN2412(x2, y, CharColor, bClr, '0');
return;
}
x2 = x;
Found = 0;
aRatio = 10000;
da = dig;
for(i=0; i<5; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
}else{
if(Le == 0){
if(i == 4)gui_write_EN2412(x2, y, CharColor, bClr, '0');
else gui_write_EN2412(x2, y, CharColor, bClr, ' ');
}else{
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
Found = 1;
}
}
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender6Right24(int x, int y, unsigned int CharColor, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x + 60;
gui_write_EN2412(x2, y, CharColor, '0');
return;
}
x2 = x;
Found = 0;
aRatio = 100000;
da = dig;
for(i=0; i<6; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, Le + '0');
}else{
if(Le == 0){
//if(Found)gui_write_EN2412(x2, y, CharColor, ' ');
if(i == 5)gui_write_EN2412(x2, y, CharColor, '0');
}else{
gui_write_EN2412(x2, y, CharColor, Le + '0');
Found = 1;
}
}
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender6Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x + 60;
gui_write_EN2412(x2, y, CharColor, bClr, '0');
return;
}
x2 = x;
Found = 0;
aRatio = 100000;
da = dig;
for(i=0; i<6; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
}else{
if(Le == 0){
if(i == 5)gui_write_EN2412(x2, y, CharColor, bClr, '0');
else gui_write_EN2412(x2, y, CharColor, bClr, ' ');
}else{
gui_write_EN2412(x2, y, CharColor, bClr, Le + '0');
Found = 1;
}
}
aRatio = aRatio / 10;
x2 += 12;
}
}
void TextDigitRender5Left24(int x, int y, unsigned int CharColor, unsigned int BackClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x;
gui_write_EN2412(x2, y, CharColor, BackClr, '0');
x2 += 12;
for(Found=1; Found<5; Found++){
gui_write_EN2412(x2, y, CharColor, BackClr, ' ');
x2 += 12;
}
return;
}
x2 = x;
Found = 0;
aRatio = 10000;
da = dig;
for(i=0; i<5; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, BackClr, Le + '0');
Found++;
}else{
if(Le == 0){
//if(Found)gui_write_EN2412(x2, y, BackClr, ' ');
if(i == 5)gui_write_EN2412(x2, y, CharColor, BackClr, '0');
}else{
gui_write_EN2412(x2, y, CharColor, BackClr, Le + '0');
Found =1;
}
}
aRatio = aRatio / 10;
if(Found)x2 += 12;
}
if(Found <5){
for(; Found<5; Found++){
gui_write_EN2412(x2, y, CharColor, BackClr, ' ');
x2 += 12;
}
}
}
void TextDigitRender6Left24(int x, int y, unsigned int CharColor, unsigned int BackClr, unsigned int dig)
{
unsigned int i, da, Le, Ta, x2, aRatio, Found;
if(dig == 0){
x2 = x;
gui_write_EN2412(x2, y, CharColor, BackClr, '0');
x2 += 12;
for(Found=1; Found<6; Found++){
gui_write_EN2412(x2, y, CharColor, BackClr, ' ');
x2 += 12;
}
return;
}
x2 = x;
Found = 0;
aRatio = 100000;
da = dig;
for(i=0; i<6; i++){
Le = da / aRatio;
da = da % aRatio;
if(Found){
gui_write_EN2412(x2, y, CharColor, BackClr, Le + '0');
Found++;
}else{
if(Le == 0){
//if(Found)gui_write_EN2412(x2, y, BackClr, ' ');
if(i == 5)gui_write_EN2412(x2, y, CharColor, BackClr, '0');
}else{
gui_write_EN2412(x2, y, CharColor, BackClr, Le + '0');
Found =1;
}
}
aRatio = aRatio / 10;
if(Found)x2 += 12;
}
if(Found <6){
for(; Found<6; Found++){
gui_write_EN2412(x2, y, CharColor, BackClr, ' ');
x2 += 12;
}
}
}
void TextRender(int x1, int y1, const char *p, unsigned int aColor, int aFontSize)
{
}
void TextRenderAscii_20(unsigned int x,unsigned int y, unsigned int clr,const char *pc)
{
lcd_draw_str_14x20(x,y, clr,pc);
}
void TextRenderAscii_20(unsigned int x,unsigned int y, unsigned int clr, char *pc)
{
lcd_draw_str_14x20(x,y, clr,pc);
}
void TextRenderAscii_16(unsigned int x,unsigned int y, unsigned int clr, const char *pc)
{
lcd_draw_str_11x16(x,y,clr,pc);
}
void TextRenderAscii_16(unsigned int x,unsigned int y, unsigned int clr, char *pc)
{
lcd_draw_str_11x16(x,y,clr,pc);
}