1. Make the LCD display full of red
We want to display data on the LCD. The steps required are as follows:
a. Initialize LCD
b. Enable LCD
c. Get LCD parameters: fb_base, xres, yres, bpp
d. Write data to the framebuffer
1. Initialize LCD work We have introduced the framework preparation and LCD initialization in detail in the previous section.
2. Enable LCD
void lcd_enable()
{
lcd_controller_enalbe(); //will indirectly call s3c2440_lcd_controller_enalbe
}
3. Get LCD parameters
void get_lcd_params(unsigned int *fb_base, int *xres, int *yres, int *bpp)
{
*fb_base = g_p_lcd_selected->fb_base;
*xres = g_p_lcd_selected->xres;
*yres = g_p_lcd_selected->yres;
*bpp = g_p_lcd_selected->bpp;
}
4. Write data to the framebuffer
1) Assuming that we initialize the configuration with BPP=16, how can we make the full screen display red?
The pixels of the entire screen starting from the framebuffer base address need to be filled with red values. For 16BPP, RGB=565, if you want to display red, [15:11] is all 1 for red, [10:5] is all 0 for no green, and [4:0] is all 0 for no blue, 0b1111100000000000=0xF800. Starting from the base address, with xres and yres as the boundaries, fill in the colors in sequence.
p = (unsigned short *)fb_base;
for (x = 0; x < xres; x++)
for (y = 0; y < yres; y++)
*p++ = 0xf800;
2) Assuming that we initialize the configuration with BPP=24 or BPP=32, how can we make the full screen display red?
In fact, no matter it is 24bpp or 32bpp, each pixel in the frame buffer occupies 4 bytes. The LCD controller data storage format is introduced. For 24BPP or 32 bpp, that is, RGB:888, each color occupies 8 bits, a total of 24 bits. The code is as follows:
p = (unsigned int *)fb_base;
for (x = 0; x < xres; x++)
for (y = 0; y < yres; y++)
*p++ = 0xff0000;
When the frame buffer is filled with color data, the LCD controller will fill the data onto the LCD display according to our previous configuration. So how can the previous 24BPP and 32BPP be displayed on an LCD that can only receive 16BPP (there are only 16 data lines in the hardware)?
This is because when using 24BPP, of the 8 red, 8 green, and 8 blue data sent, only the upper 5 red, upper 6 green, and upper 5 blue are used to connect to the LCD. (This is discussed in 4.FrameBuffer and BPP in the previous LCD Hardware Principles)
Previous article:s3c2440 bare metal - LCD programming - 5 - drawing dots, lines and circles on LCD
Next article:S3C2440 bare metal - LCD programming - 3 - frame preparation and LCD initialization
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- [April 23 | Suzhou] High-speed digital and optical communication test seminar invites you to meet
- TMS320C6748_UART(3) - UART polling mode
- Award-winning live broadcast: Application of TI millimeter-wave radar in cars is now open for registration~
- Modelsim10.4 installation and adding crack files error solution
- TI - MCU - MSP430 User Guide 1 -> MSP430 Introduction and Selection Guide
- [BearPi-HM Nano, play Hongmeng "Touch and Go"] -1- Unboxing and preliminary data collection
- Adding your own C functions to MicroPython
- PCB production
- Sharing 10 common formulas for switching power supply design
- Battery Management System BMS Technical Data Transfer