小工具知识网

当前位置: 首页 > 行业知识 > 学习笔记(1)——粤嵌gec6818实现电子相册,音乐播放器,视频播放器。

行业知识

学习笔记(1)——粤嵌gec6818实现电子相册,音乐播放器,视频播放器。

2026-11-12 14:53:26 来源:互联网转载

项目要求:

(1)设计一个初始界面,并且设置电子相册,音乐播放器,视频播放器三个触摸按键。

(2)电子相册——能够实现相册的幻灯片功能,实现相册左右滑动切换相片。

(3)音乐播放器实现——切歌,播放和暂停功能。

(4)视频播放器实现——播放、暂停、音量大小、快进倒退等功能。

(5)对代码进行集成化

项目设计:

(1)头index.php/tags-522.html" >文件、设置变量和素材引入

#include #include #include #include #include #include #include #include #include #include int get_touch(int *th_x,int *th_y);//x轴和y轴的位置。int show_color(int color,int x,int y,int w,int h);//颜色的显示x和y设定位置,w和h设定显示大小int mmap_bmp(char *namebuf,int x,int y,int w,int h);//int lcd,touch;int *map;int th_x,th_y,th_falg = 0,falg_2 = 0,i = -1;pthread_t pid;int fd_fifo;char music_path[4][32] = {"faded.mp3","faded1.mp3","faded2.mp3"};char name_buf[4][20] = {"01.bmp","02.bmp","1.bmp"};

(2)对设备的初始化和停止

int __INIT__(){    touch = open("/dev/input/event0",O_RDWR);    if(touch == -1)    {        perror("open touch failed");        return -1;    }    lcd = open("/dev/fb0",O_RDWR);    if(lcd == -1){perror("open lcd failed");return -1;}    map = (int *)mmap(NULL,800*480*4,PROT_READ | PROT_WRITE,MAP_SHARED,lcd,0);if(map == MAP_FAILED){perror("mmap failed");return -1;}    if(access("/fifo",F_OK))// 默认管道文件创建在根目录  F_OK:判断是否存在{//如果没有创建mkfifo("/fifo",777); //创建管道文件函数}fd_fifo = open("/fifo",O_RDWR);if(fd_fifo == -1){printf("创建管道文件失败!\n");return -1;}return 0;}int __FrEe(){    close(touch);    close(lcd);    munmap(map,800*400*4);    system("killall -9 mplayer");}int Send_Cmd(char *cmd)//写入管道文件{write(fd_fifo,cmd,strlen(cmd));return 0;}

(3)限制图片的显示大小

void *cyc_showbmp(void *arg){    for(int i = 0;i= 50)) return 1;//向右移动            if(old_x > *th_x && (old_x - *th_x >= 50)) return 2;//向左移动            break;        }    }    return 0;}

(5)颜色的显示

int show_color(int color,int x,int y,int w,int h){    int * new_map = map + (800*y) + x;for(int i = 0 ;i  

(6)在任意位置显示图片

//任意位置,任意大小刷图int mmap_bmp(char *namebuf,int x,int y,int w,int h){    int bmp = open(namebuf,O_RDWR);    if(bmp == -1)    {        perror("open failed");        return -1;    }char buf[w*h*3];int new_buf[w*h];lseek(bmp,54,SEEK_SET);read(bmp,buf,w*h*3);for(int i = 0 ;i = 400 &&th_y = 601 && th_x = 400 &&th_y  3) i = 0;                        printf("1111\n");                        mmap_bmp(name_buf[i],0,0,800,400);                    } //下一张                   if(th_x >= 0 && th_x = 0 &&th_y = 441 && th_x = 400 && th_y = 0 && th_x = 400 &&th_y = 201 && th_x = 400 &&th_y = 401 && th_x = 400 &&th_y  3) i = 0;        system( name_buf[i] );        } //下一首        if(th_x >= 551 && th_x = 400 && th_y = 0 && th_x = 0 &&th_y 241 && th_x400 && th_y0 && th_x400 && th_y121 && th_x400 && th_y441 && th_x400 && th_y561 && th_x400 && th_y681 && th_x400 && th_y= 100 && th_x = 300 && th_y = 300 && th_x = 300 && th_y = 600 && th_x = 300 && th_y  

 

 (11)项目成果

 

 

(12)程序编译指令  arm-linux-gcc xxx.c -o xxx -lphread 

 

 

 

 

上一篇:docker study

下一篇:怎么下载黄色?