调用lcd屏输出德国国旗

/*************************************************
 *
 *   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;
}
posted @ 2024-05-10 22:48  铃是铃铛的铃  阅读(45)  评论(0)    收藏  举报