#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#define FILE "/dev/fb0"
#define WHITE 0xffffffff // test ok
#define BLACK 0x00000000
#define RED 0xffff0000
#define GREEN 0xff00ff00 // test ok
#define BLUE 0xff0000ff
#define GREENP 0x0000ff00 // 一样,说明前2个ff透明位不起作用
unsigned int *pfb = NULL;
// 函数声明
void draw_back(unsigned int width, unsigned int height, unsigned int color);
void draw_line(unsigned int width, unsigned int height, unsigned int color);
int main()
{
int fd=-1,ret=-1;
struct fb_fix_screeninfo finfo = {0};
struct fb_var_screeninfo vinfo = {0};
//打开设备
fd=open(FILE,O_RDWR);
if(fd<0)
{
perror("open");
return -1;
}
printf("open %s success..\n", FILE);
//获取设备的硬件信息
ret=ioctl(fd,FBIOGET_FSCREENINFO,&finfo);
if(ret<0)
{
perror("
linux驱动开发扩展--framebuffer应用实例
最新推荐文章于 2024-02-17 23:03:10 发布