1. Digital Photo Frame - Frame Analysis (1) Photo Frame

Reprinted: https: //www.cnblogs.com/lifexy/p/8467503.html

Project Flow

  • Understand the needs (what needs to be done)
  • Design framework (how to achieve demand)
  • Write code (how through code design)
  • test

Understand the needs

(1) is powered on, LCD display a picture

(2) Depending on the configuration file, decided to stay current interface is automatically displayed at a

(3) click, a dialog box appears (manual display, automatic display)

(4) an enlarged upper, lower shrink around slide between images

(5) when the slide around quickly, switching on upper / lower case one

Design Framework

Done by two parts:

1) Input process (shown below)

Create three threads: Touch the thread, buttons thread, the master thread

- Touch Thread: stop calling tslib, when there is data, packaged into events reported to the master thread

- Key Thread: when not pressing the sleep, they generate an interrupt when pressed, packaged well reported to the master thread

- Master Thread: after receiving the data sent to the display process with socket

 

 

2) Display process (shown below)

Created 7 threads

-socket receiving thread:

To receive socket, receive data such as left draw, it notifies the event to the main thread

- Master Thread:

According to the event, which are then calls the driver to data prepared by DMA (located on a memory) memory address placed on the framebuffer.

- the other five processes (current, left, right, up, down):

For example when the master display a complete picture, it is ready to start (unzip the pictures up / down pictures, zoom in, zoom and other data) to facilitate the master thread called directly, thereby increasing speed.

Picture data is decompressed by the application (to convert the jpeg format for the LCD display format) using a mmap () function on the spread library using a memory libjpeg.

 

 

The current thread of meaning:

We have said before, when a click, a dialog box will appear, if after exit the dialog box will inform the current thread to display the current picture.

Dialog:

按钮以及边框直接做成一个个图片,调用对话框时,直接覆盖LCD显存上即可

 

总结:

使用多线程好处在于:每个模块独立起来,方便以后修改,而且全局变量在多线程里可以共用.

 

 

Guess you like

Origin www.cnblogs.com/jorbin0850/p/11617005.html