欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 嵌入式顯示屏顯示 功能 [打印本頁]

作者: 中大南方    時間: 2018-5-17 14:05
標題: 嵌入式顯示屏顯示 功能
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

#define LCD_SEZI 800*480*4
int lcd_fd=-1;
int *lcd_memary;


int open_lcd(char *lcdpath)
{
        lcd_fd=open(lcdpath,O_RDWR);
        if(lcd_fd==-1)
        {
                perror("open lcd error");
                        return -1;
        }
}
lcd_memary = (int *)mmap(NULL,LCD_SEZI,PROT_READ|PROT_WRITE,MAP_SHARED,lcd_fd,0);
return lcd_fd;
}
int lcd_draw_bmp(char *pic_path)
{
        int ret = -1;
        int i = 0,j = 0;
        char blue = 0;
        char green = 0;
        char red = 0;
        int color = 0;
        char bmp_info_buf[54]={0};
        char bmp_data_buf[800*480*4];
        char *bmp_data = bmp_data_buf;
       
        int bmp_fd = open(pic_path,O_RDWR);
        if(bmp_fd ==-1)
        {
                perror();
        }
        ret = read(bmp_fd,bmp_info_buf,54);
        if(ret == -1)
        {
                perror();
        }
       
        int bmp_width = bmp_info_buf[18];
                bmp_width | = bmp_info_buf[19]<<8;
        int bmp_heigth = bmp_info_buf[22];
                bmp_heigth | = bmp_info_buf[23]<<8;
               
        int bmp_type = bmp_info_buf[28];
                bmp_type | = bmp_info_buf[29]<<8;
       
       
        ret = read(bmp_fd,bmp_data_buf,800*480*4);
        if(ret == -1)
        {
                perror("read bmp data error");
                return -1;
        }
       
        for(i=0;i<479;i++)
        {
                for(j=0;j<800;j++)
                {
                       
                }
               
        }
       
       
       
}
//int main()
{
                int color_buf[800*480] = {0};
                int i = 0;
               
                //1、打開lcd
                int lcd_fd = open("/dev/fb0", O_RDWR);
                if(lcd_fd == -1)
                {
                        perror("open lcd error");
                        return -1;
                }
               
                for(i = 0; i < 800*480; i++)
                {
                        //把顏色值賦給數組中每個元素
                        color_buf[i] = 0x00ff0000;
                }
               
                //2、把顏色數據寫到lcd中
                int ret = write(lcd_fd, color_buf, 800*480*4);
               

               
                //3、關閉
                close(lcd_fd);
}
//






歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1