Transplantation of external font chip GT32L32S0140

Publisher:荒火Latest update time:2015-01-19 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

After several days of hard work, the transplant was finally successful. Now I record the problems I encountered.

step by step,

1. First, make the hardware and drivers work. I found an old board, soldered the GT32L32 to the board, and connected it to the spi2 port of the motherboard. Install the steps on the Internet to transplant the driver font library. Run it first to see if Chinese characters will appear? ... Of course not, the expectations are too high. Next, I started to find the problem and found that there was a problem with the address calculation of the font chip. I quickly corrected it and tested it again, and read out the font information. In order to verify whether the reading is correct, I manually translated the data into binary code and clicked it on the font model. Wow! It is correct, incredible.

2. Move the driver to ucgui. Try to display it on ucgui first. Don't be fanciful. You need to walk the road yourself and split the mountain yourself. Now start to find the problem. After checking, I found that the position of the word display is wrong, x=-139. If you change x=10, the Chinese characters will be displayed, which means the coordinates are wrong. Where do the coordinates come from? After careful inspection, I found the function

The most critical statement  in  GUICharP.c  is int GUIPROP_GetCharDistX(U16P c) { const GUI_FONT_PROP GUI_UNI_PTR * pProp = GUIPROP_FindChar(GUI_Context.pAFont->p.pProp, c); return (pProp) ? (pProp->paCharInfo + (c-pProp- >First))->XSize * GUI_Context.pAFont->XMag : 0; }


 
 

There is this (c-pProp->First).

So you need to transplant the font

GUI_FLASH const GUI_CHARINFO GUI_FontHZ16_CharInfo[] = { } Copy 93 in the array.

 

 

Run it again, and the beautiful Chinese characters are displayed! It's done, hahaha, let's laugh.

After the external font library was successfully transplanted, a shortcoming was found. When using the ASC characters in the external font library, one character was up and the other was down, and it was crooked. After analysis, it may be necessary to define the width of GUI_CHARINFO in the font library, or it may not be necessary.

 

Decided to use the font library in the system,

GUI_FLASH  const GUI_FONT_PROP GUI_FontHZ16_Prop0020= {
     0x0020,
     0x007f,
     &GUI_CharInfo_Font16ASCII[0],  // For ASC code characters, use the 16-size font in the system. Do not use the one on the chip.
     (void *)&GUI_FontHZ16_Propa1a1
};

The third parameter is the index pointing to the system's font information.

And the bold font is defined. The font library is transplanted.

 

I plan to add pinyin input method when I have time in the future: the initial idea is:

Define an array pyArr in the software  {“a”, address of the font library, number of characters in the pinyin a}, ... {“ai”, address of the font library, number of characters in the pinyin ai}...

In the font library, you can customize the Chinese character area code for the pinyin a, the area code for ai... The area codes of all Chinese characters are saved in one space in the font library.

When you input a pinyin in the software, for example, "bo", find the record of the pinyin in the array pyArr, and take out this series of Chinese character area codes according to the font address and the number of pinyin characters and put them into the array  GB[]. After getting the area code, the Chinese characters are displayed through the system.

Reference address:Transplantation of external font chip GT32L32S0140

Previous article:C language keyword - static
Next article:Several concepts that should be understood in the early stage of microcontroller development

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号