My chGUI (3)

Source: Internet
Author: User

LCD simulator.

I introduced the simulator that I used to rewrite the ucGUI, but it took me a long time to separate the simulator from the ucGUI, do not separate well, but at least you can use it. the description is as follows:

1. LCD simulator configuration.

# Define LCD _XSIZE (640) LCD width
# Define LCD _YSIZE (480) LCD height

# Define LCD _BITSPERPIXEL (8) the number of bits in a single pixel, that is, the number of bits in color

# Define LCD _FIXEDPALETTE color mode of 332 pixels, that is, the number of digits occupied by RGB
# Define LCD _SWAP_RB 1 Red Blue

The above configurations are the same as those of ucGUI. For details, refer to the ucGUI documents (a lot of information on the Internet)

 

Ii. External function interfaces of the LCD Simulator

Only two functions are published, namely void LCDSIM_SetPixelIndex (int x, int y, int Index) and int LCDSIM_GetPixelIndex (int x, int y)

1. void LCDSIM_SetPixelIndex (int x, int y, int Index)

Draw a pixel on the LCD. The coordinates are x and y. The color is index.

The Index here is not really a complete RGB value, but according to the above color pattern configuration, the corresponding value can also be understood as the value we want to write into the real LCD.

In the LCD simulator, the color is a 24-bit real color, that is, R8G8B8, And the analog LCD can not have so many bits, so the color of the LCD simulation is called index,

It will be converted to 24-bit RGB internally.

 

2. int LCDSIM_GetPixelIndex (int x, int y)

Obtain the index of the color value at the coordinates x and y on the LCD. The index is of the same meaning.

 

Iii. Composition of chGUI Project.

This project consists of three parts. One is the LCD simulator, which does not need to be modified, as long as the configuration is complete. the second is the chGUI part, the main part to be developed, and the third is Applicatio. In the future, the test program will be placed here.

The GUI part has a directory named convcolor, Which is borrowed from ucGUI. It is owned by the LCD simulator and can be stored in the GUI. Currently, my idea is to try not to use this directory in chGUI.

The LCD simulator has a "myType. h", which defines some common types and will be used in chGUI,

 

Iv. LCD simulator Input Interface

1. int CXM_GetKey (void)

Read a key. If it is 0, no key is pressed.

2. int CXM_TOUCH_GetState (GUI_PID_STATE * pState)

Read the status of the touch screen, return 0 without touch, non-0 with touch, pState returns coordinates

 

This part has no queue buffer, that is, the input data may be lost, but it is enough for our application.

 

 

Writing is really difficult! It is always not good to express what you understand in words. Sometimes it is not easy to think about the technical writers!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.