/*************************************************
*
* file name:color.c
* author :momolyl@126.com
* date :2024/05/10
* brief :向lcd屏幕输出德国国旗
* note :None
*
* CopyRight (c) 2024 momolyl@126.com All Right Reseverd
*
**************************************************/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main(void)
{
int lcd_fd = open("/dev/fb0", O_RDWR);
if (-1 == lcd_fd)
{
printf("open lcd faild\n");
return -1;
}
int colorbuf[800 * 480] = {0};
for (int i = 0; i < 800 * 160; i++)
{
colorbuf[i] = 0x00000000;
}
for (int i = 800 * 160; i < 800 * 320; i++)
{
colorbuf[i] = 0x00ff0000;
}
for (int i = 800 * 320; i < 800 * 480; i++)
{
colorbuf[i] = 0x00ffff00;
}
write(lcd_fd, colorbuf, 800 * 480 * 4);
return 0;
}
标签:colorbuf,国旗,调用,int,lcd,fd,include,800
From: https://www.cnblogs.com/bell-c/p/18185428