资源简介
将ARM开发板与电脑网线相连,设置好IP地址,在ZOC
软件里面配置好IP、文件地址,然后在Linux虚拟机里面将此c程序放在共享文件夹里编译运行,之后在开发板上就能看到自动播放的不同图片
代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
unsigned short RGB888toRGB565(unsigned char red unsigned char green unsigned char blue);
unsigned long RGB888toRGB32(unsigned char red unsigned char green unsigned char blue);
int main(int argc char *argv[])
{
///////////////////
int keys_fd;
char ret[2];
struct input_event t;
keys_fd = open (“/dev/input/event0“ O_RDONLY);
if (keys_fd <= 0)
{
printf (“open /dev/input/event0 device error!\n“);
return 0;
}
///////////////////
int framebuffer_fd = 0;
int fb = 0;
unsigned int x y i ;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
long int screensize = 0;
char *fbp = 0;
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
if(argc != 5)
{
printf(“insuffient auguments“);
exit(-1);
}
framebuffer_fd = open(“/dev/fb0“O_RDWR);
if(framebuffer_fd<=0)
{
printf(“error:can not open framebuffer device.\n“);
return -1;
}
printf(“the framebuffer device was opened successfully.\n“);
if(ioctl(framebuffer_fd FBIOGET_VSCREENINFO &vinfo))
{
printf(“error reading variable information.\n“);
return -3;
}
if (ioctl(framebuffer_fd FBIOGET_FSCREENINFO &finfo))
{
printf(“Error reading fixed information.\n“);
exit(-3);
}
screensize = vinfo.xres*vinfo.yres*vinfo.bits_per_pixel/8;
fbp=(char*)mmap(0 screensizePROT_READ|PROT_WRITEMAP_SHAREDframebuffer_fd0);
if((int)fbp==-1)
{
printf(“error:failed to map framebuffer device to memory.\n“);
return -4;
}
printf(“success to map framebuffer device to memory.\n“);
FILE *infp;
unsigned char *buffer;
while(1){
for(i=0;i<4;i++)
{
if((infp=fopen(argv[1+i]“r“)) == NULL)
{
printf(“Error:open %s failed \n“argv[1]);
exit(0);
}
cinfo.err=jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);//初始化cinfo
jpeg_stdio_src(&cinfo infp); //指定要解压的文件
jpeg_read_header(&cinfo TRUE);
jpeg_start_decompress(&cinfo);
if((cinfo.output_width > vinfo.xres) || (cinfo.output_height
- 上一篇:dibazhang.sln
- 下一篇:利用DS1302实现单片机控制的电子万年历
评论
共有 条评论