⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.c

📁 arm下的lcd的测试 程序
💻 C
字号:
#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <sys/ioctl.h>int main(void){    unsigned char ctrl1 = 0x00;    unsigned char ctrl2 = 0x11;    unsigned char row = 0x00;    unsigned char listh = 0x00;    unsigned char listl = 0x00;    unsigned char data1 =0xe0;    unsigned char data2 =0x2f;    int i, j, fd, fd_file;    unsigned char buf[214][318];    fd_file = open("/home/test.bin", O_RDWR);    if(fd_file < 0) {	printf("open \"/home/test.bin\" failed!!!\n");	return -1;    }    lseek(fd_file, 4, SEEK_CUR);    for(i = 0; i < 214; i++) {	read(fd_file, buf[i], 318);    }            fd =open("/dev/lcd", O_RDWR);    if(fd < 0) {	printf("open \"/dev/lcd\" failed!!!\n");	return -1;    }    ioctl(fd, 1, &ctrl1);    ioctl(fd, 2, &row);    ioctl(fd, 3, &listh);    ioctl(fd, 3, &listl);    ioctl(fd, 4, &data1);        row = 0x08;    listl = 0x01;    for(i = 0; i < 214; i++) {	ioctl(fd, 2, &row);	ioctl(fd, 3, &listh);	ioctl(fd, 3, &listl);	for(j = 0; j < 318; j++) {	    write(fd, &buf[i][j], 1);	}	row = row + 0x01;    }    row = 0x00;    listl = 0x00;    ioctl(fd, 1, &ctrl2);    ioctl(fd, 2, &row);    ioctl(fd, 3, &listh);    ioctl(fd, 3, &listl);    ioctl(fd, 4, &data2);    row = 0xe0;    listl = 0x01;    for(i = 0; i < 214; i++) {	ioctl(fd, 2, &row);	ioctl(fd, 3, &listh);	ioctl(fd, 3, &listl);	for(j = 0; j < 318; j++) {	    write(fd, &buf[i][j], 1);	}	row = row - 0x01;    }    for(i = 0; i < 30; i++)    {	ioctl(fd, 1, &ctrl1);	sleep(2);	ioctl(fd, 1, &ctrl2);	sleep(2);    }    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -