Disclosure of Invention
The application provides a liquid crystal display method and a liquid crystal display device of embedded equipment, which aim to solve the problem that a hardware condition does not conform to a Lunix FrameBuffer mechanism and a liquid crystal display cannot be driven.
In a first aspect, the present application provides a method for displaying a liquid crystal display of an embedded device, including: the application software converts the initial data into display data in a preset data format; applying for a memory block in character equipment, wherein the size of the memory block is a memory space required for storing data quantity corresponding to single-frame data, and the single-frame data is data displayed by the liquid crystal screen once; the application software stores the display data to the memory block; the character equipment acquires the display data; sending the display data through a bus driver, wherein the bus driver selects a bus driver adaptive to bus parameters in Platform driver in a Linux system, and the bus parameters comprise bus numbers, bus clocks and bus modes; and the liquid crystal screen receives and displays the display data. By adopting the implementation mode, a flexible liquid crystal screen driving display scheme is realized in the embedded equipment with a simple structure, specific hardware types and operations are shielded for the upper application program, the contents of the size, the color, the position and the like of the liquid crystal screen are only concerned, and the lower layer completes various hardware adaptations by means of a bus driving structure with strong linux. Meanwhile, the method is suitable for hardware of various lcd devices.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the converting, by the application software, the initial data into display data in a preset data format includes: splitting the initial data into a plurality of single-frame data, wherein the data format of the initial data comprises characters, pictures, animations and videos, and the single-frame data is data displayed on the liquid crystal display screen at a single time; and converting the single-frame data into display data according to the preset data format. By adopting the implementation mode, customized display in various forms, such as pictures, animations and the like, can be completed simultaneously.
With reference to the first aspect, in a second possible implementation manner of the first aspect, the splitting the initial data into a plurality of single frames of data includes: acquiring a data format of the initial data; searching a splitting algorithm corresponding to the data format; and splitting the initial data according to the splitting algorithm.
With reference to the first aspect, in a third possible implementation manner of the first aspect, the applying for the memory block in the character device includes: and configuring an I/O management channel for the memory block, wherein the I/O management channel is an ioctl interface. By adopting the implementation mode, the data receiving of the upper layer application software and the data transmission of the lower layer hardware are realized according to the frame buffer principle through the ioctl interface.
With reference to the first aspect, in a fourth possible implementation manner of the first aspect, the receiving and displaying the display data by the liquid crystal screen includes: and refreshing the liquid crystal screen according to a preset time interval. By adopting the implementation mode, the dynamic display control needs to stabilize the duration of each frame, and a better display effect is achieved.
In a second aspect, the present application further provides a liquid crystal display device of an embedded device, where the device includes a module for executing the method steps in the various implementations of the first aspect.
In a third aspect, the present application further provides a terminal, including: a processor and a memory; the processor may execute the program or the instructions stored in the memory, thereby implementing the lcd display method of the embedded device in the various implementations of the first aspect.
In a fourth aspect, the present application further provides a storage medium, where the computer storage medium may store a program, and when the program is executed, part or all of the steps in each embodiment of the liquid crystal display method including the embedded device provided in the present application may be implemented.
Detailed Description
Referring to fig. 1, a schematic structural diagram of an embedded device controlling display of a liquid crystal display is provided in the present application. The central processing unit CPU comprises a synchronous dynamic random access memory SDRAM controller and a liquid crystal screen LCD controller, wherein the SDRAM controller is responsible for controlling input, output and storage of SDRAM, and the liquid crystal screen LCD controller is responsible for controlling display of a liquid crystal screen. And the SDRAM stores the display data of the liquid crystal screen.
The CPU appoints the LCD controller to work, the LCD controller fetches data and instructions to the appointed place according to the control of the CPU, the current data is fetched from the video memory generally, if the video memory is not stored, the data is fetched from the memory, if the memory is not stored, the data is fetched from the hard disk, certainly, the data is not stored, but can be stored in the hard disk in order to save the memory, and then the data and instructions are fetched by the display controller through the instruction control. The data in the FrameBuffer is stored frame by frame, and the video card can continuously refresh the FrameBuffer, namely, the FrameBuffer is updated in real time. Whether the display data exists in the memory or the display memory, the display data is explicit information, and if the resolution is 800x600, 800x600 pixel points and color values are stored.
Referring to fig. 2, a flowchart of a method for displaying a liquid crystal display of an embedded device according to the present application is provided. As shown in fig. 1, the method includes:
201. the application software converts the initial data into display data in a preset data format.
The application software is a part of software provided for meeting the application requirements of users in different fields and different problems, is used for amplifying hardware functions, and can use a plurality of programming languages and a set of application programs compiled by the plurality of programming languages. The application software refers to all software which is applied to the embedded device and relates to liquid crystal display. The initial data is data to be displayed on the liquid crystal panel. The preset data format refers to a data format capable of being used for liquid crystal screen display, such as RGB, CMYK, YUV, and the like. Whether the format of the initial data is text, picture or video, the initial data is converted into display data which can be displayed by the liquid crystal screen.
202. A memory block is applied in a character device.
The character device is responsible for interacting with the application software on the upper layer, receiving the data required to be displayed by the application software, and transmitting the data to the liquid crystal display through the bus drive. Video, i.e. images that are played continuously. That is, the liquid crystal display displays the whole screen image every time, then displays the next screen image, and if the image is data in a picture format, the images are displayed one by one in response to the picture switching speed operated or set by a user; if the data is in the video format, switching pictures according to the switching speed of the images in the video, and taking the end of a section of video as a stop mark.
When data is transmitted to the liquid crystal screen, the data is transmitted in a single screen by taking the data amount displayed in one screen as a unit. In order to reduce the limitation method of the data volume, the size of the memory block is set as the memory space required for storing the data volume corresponding to the single frame of data, and the single frame of data is the data displayed by the liquid crystal display once.
In order to facilitate data transmission, an I/O management channel is configured for the memory block, and the I/O management channel is an ioctl interface. ioctl is a function in the device driver that manages the I/O channels of the device. The management of the I/O channel is to control some characteristics of the device, such as the transmission baud rate of the serial port, the rotation speed of the motor, and the like. The number of the parameters is as follows: int ioctl (int fd, int cmd, …); where fd is the file identifier returned by the open function when the user program opens the device, cmd is the control command of the user program to the device, and the following ellipses are some supplementary parameters, typically at most one, with or without meaning related to cmd. The ioctl function is an attribute component in the file structure, that is, if your driver provides support for ioctl, the user can use the ioctl function to control the I/O channel of the device in the user program.
203. The application software saves the display data to the memory block.
And after the application software determines the display data needing to be displayed by the liquid crystal display, the display data are stored in the memory block. The memory block has limited storage space, so the application software can set the transmission speed or transmission condition for storing the display data into the memory block. For example, if the display data is a video, the video is usually played continuously, and it may be set that the next screen data is saved to the memory block as long as the data in the memory block is transmitted to the liquid crystal screen. In the transmission process, an interrupt mode may be adopted to respond to forced operations such as pause, stop, exit, and the like, and the forced cut-off position may be a position from which the application software is led out to the memory block, or a position from which the application software is led out to the liquid crystal display, which is not limited in the embodiment of the present application.
204. The character device acquires display data.
The character device acquires display data from the memory block.
205. The display data is sent through the bus driver.
The bus driver is a Platform driver in a Linux system, and selects a bus driver adaptive to bus parameters, wherein the bus parameters comprise bus numbers, bus clocks and bus modes. And configuring parameters of the bus equipment drive according to the bus type and specific hardware parameters, such as bus number, bus clock, bus mode and the like, and finishing drive registration. After the registration is finished, initialization of the liquid crystal display is performed, most importantly, a display mode is configured, the format of data transmitted to hardware is affected, and format conversion can be performed again at the driving in order to shield the influence of hardware configuration on upper layers.
206. The liquid crystal screen receives and displays the display data.
The method specifically comprises the following steps: and refreshing the liquid crystal screen according to a preset time interval. For the control of dynamic display, the duration of each frame needs to be stabilized, and a better display effect is achieved.
By adopting the implementation mode, a flexible liquid crystal screen driving display scheme is realized in the embedded equipment with a simple structure, specific hardware types and operations are shielded for the upper application program, the contents of the size, the color, the position and the like of the liquid crystal screen are only concerned, and the lower layer completes various hardware adaptations by means of a bus driving structure with strong linux. Meanwhile, the method is suitable for hardware of various lcd devices.
Referring to fig. 3, a flowchart of a method for converting initial data into display data in a preset data format by application software is provided. On the basis of the method shown in fig. 2, as shown in fig. 3, the application software converts the initial data into the display data in the preset data format, which includes:
301. the initial data is split into several single frames of data.
The data format of the initial data includes characters, pictures, animation and video, and the single frame data is data displayed on the liquid crystal screen at a single time. The initial data can be split into a plurality of single frame data, and the number of the single frame data is not limited in the present application. The method specifically comprises the following steps: acquiring a data format of initial data; searching a splitting algorithm corresponding to the data format; and splitting the initial data according to a splitting algorithm.
The application software customizes the content according to the requirement, and needs to analyze and split according to different formats. For example, Chinese and English display requires analysis of character codes and application of Chinese and English word libraries; such as the display of pictures and animations, which require parsing and splitting of the format of the pictures and animations.
302. And converting the single frame data into display data according to a preset data format.
The preset data format may be any one of liquid crystal display modes. And if the data storage form of the single-frame data is different from the preset data format, converting the single-frame data into display data.
By adopting the implementation mode, customized display in various forms, such as pictures, animations and the like, can be completed simultaneously.
As a specific implementation of the methods shown in fig. 2 and fig. 3, refer to fig. 4, which is a block diagram of a liquid crystal display device of an embedded device provided in the present application, and refer to fig. 5, which is a block diagram of a conversion unit provided in the present application. As shown in fig. 4, the apparatus includes:
aconversion unit 41, configured to convert the initial data into display data in a preset data format by application software;
an applyingunit 42, configured to apply for a memory block in a character device, where the size of the memory block is a memory space required for storing a data amount corresponding to single frame data, and the single frame data is data that is displayed by the liquid crystal display once;
a savingunit 43, configured to save the display data to the memory block by the application software;
anacquisition unit 44 for the character device to acquire the display data;
a sendingunit 45, configured to send the display data through a bus driver, where the bus driver selects a bus driver adapted to bus parameters in a Platform driver in a Linux system, where the bus parameters include a bus number, a bus clock, and a bus mode;
and thedisplay unit 46 is used for receiving and displaying the display data by the liquid crystal screen.
Further, as shown in fig. 5, theconversion unit 41 includes:
asplitting module 411, configured to split the initial data into a plurality of single-frame data, where a data format of the initial data includes characters, pictures, animations, and videos;
aconversion module 412, configured to convert the single frame data into display data according to the preset data format.
Further, as shown in fig. 5, thesplitting module 411 includes:
an obtaining sub-module 4111, configured to obtain a data format of the initial data;
a searching sub-module 4112, configured to search for a splitting algorithm corresponding to the data format;
a splitting sub-module 4113, configured to split the initial data according to the splitting algorithm.
Further, theapplication unit 42 is configured to:
and configuring an I/O management channel for the memory block, wherein the I/O management channel is an ioctl interface.
Further, thedisplay unit 46 is configured to:
and refreshing the liquid crystal screen according to a preset time interval.
In a specific implementation manner, the present invention further provides a computer storage medium, where the computer storage medium may store a program, and the program may include some or all of the steps in each embodiment of the liquid crystal display method of the embedded device provided by the present invention when executed. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
Those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The same and similar parts in the various embodiments in this specification may be referred to each other. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is simple, and the relevant points can be referred to the description in the method embodiment.
The above-described embodiments of the present invention should not be construed as limiting the scope of the present invention.