赞
踩
我总结为以下四步:
1)打开液晶屏文件、打开bmp图片文件、完成液晶屏内存映射
2)读取bmp图片文件到临时数组temp,等待处理数组里面的数据。
3)处理数据、映射到液晶屏上,此处是bmp图片算法:
4)关闭液晶屏、bmp图片文件。
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
- #include <sys/mman.h>
- #include <stdbool.h>
-
- #define UINT unsigned short
- #define DWORD unsigned int
- #define LONG unsigned int
- #define WORD unsigned short
- #define BMP_WIDTH 800
- #define BMP_HEIGHT 480
-
- int lcdfd;
- int *lcd_p;
- //前面14个字节 文件信息头
- typedef struct tagBITMAPFILEHEADER{
- UINT bfType; //2
- DWORD bfSize; //DWORD 4
- UINT bfReserved1; //2
- UINT bfReserved2; //2
- DWORD bfOffBits; //DWORD 4
- }BITMAPFILEHEADER;
-
- //40个字节 位图信息头
- typedef struct tagBITMAPINFOHEADER{ /* bmih */
- DWORD biSize; //DWORD 4
- LONG biWidth; //4 图像的宽度
- LONG biHeight;//4

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。