扫描方式,lcd驱动程序

来源:互联网 发布:文件损坏和丢失windows 编辑:程序博客网 时间:2024/05/16 19:35

 

显示器的扫描方式主要有隔行扫描(Interlaced)与逐行扫描(Non-Interlaced)两种,港台地区也称为交错与非交错。隔行扫描是指在显示器在显示图像时,先扫描奇数行,然后再回头扫描偶数行,经过两次扫描才完成一次图像刷新。而逐行扫描则是将视频线条连续进行扫描,一次性刷新图像。逐行扫描方式显示的图像要比隔行扫描稳定和清晰,一般来说,在640*480的分辨率下,几乎所有显示器都为逐行扫描,但在1280*1024或更高的分辨率下,就不是所有显示器都能做到逐行扫描了。市面上有某些15显示器声称可以上到1600*1200的高分辨率,实际上是以隔行扫描方式实现的,通常会标注为1600*1200(I),这个括号里的“I”就是“Interlaced”,隔行扫描

 

先摘抄一份,以备后用

 

前些天调试LCD,发现显示的内容完全是旋转的,并且也只显示了部分,写color bar的程序部分如下

#include <stdio.h>

#include <fcntl.h>

#include <string.h>

#include <stdlib.h>

#include <linux/fb.h>

#include <sys/mman.h>

#include <sys/ioctl.h>

#include <fcntl.h>

#include <malloc.h>

#include <unistd.h>

struct fb_var_screeninfo vinfo;

int main(int argc, char *argv[])

{

int fbfd, fbsize, i;

int red, green, blue;

unsigned char *fbbuf;

if (argc != 5) {

printf("usage: ./%s /dev/fbx r g b/n", argv[0]);

printf("e.g: ./%s /dev/fb0 128 255 255/n", argv[0]);

exit(0);

}

red = atoi(argv[2]);

green = atoi(argv[3]);

blue = atoi(argv[4]);

/* Open video memory */

if ((fbfd = open(argv[1], O_RDWR)) < 0) {

exit(1);

}

/* Get variable display parameters */

if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) {

printf("Bad vscreeninfo ioctl/n");

exit(2);

}

printf("xres, yres, pixel/bit : %d, %d, %d/n", vinfo.xres, vinfo.yres, vinfo.

bits_per_pixel);

/* Size of frame buffer */

fbsize = vinfo.xres*vinfo.yres*(vinfo.bits_per_pixel/8);

/* Map video memory */

if ((fbbuf = mmap(0, fbsize, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0)) == (void *) -1

) {

exit(3);

}

/* Clear the screen */

for (i = 0; i < fbsize; i++) {

*(fbbuf + i++) = red;

*(fbbuf + i++) = green;

*(fbbuf + i++) = blue;

}

printf("clear screen with rgb:%s %s %s %d/n", argv[2], argv[3], argv[4], fbsize);

munmap(fbbuf, fbsize);

close(fbfd);

return 0;

}

改进部分如下

显示如下

code: 

red

blue

green

red/blue

 

后来发现其实是扫描方式,的问题。

 

 

 

但是应该显示:

 

 

 

red

blue

green

red/blue

 

 

 详情见 论坛

 

原创粉丝点击