/********************************************************************************* * Copyright: (C) 2021 Guo Wenxue * All rights reserved. * * Filename: test_key.c * Description: This file used to test GPIO button driver builtin Linux kernel on ARM board * * Version: 1.0.0(11/17/2021~) * Author: Guo Wenxue * ChangeLog: 1, Release initial version on "11/17/2021 02:46:18 PM" * * Linux Clear LCD screen command : * * dd if=/dev/zero of=/dev/fb0 bs=320 count=720 [ 240*(24bpp/8)=720 ] * ********************************************************************************/ #include #include #include #include #include #include #include #include #define CONFIG_RGB565 #ifdef CONFIG_RGB565 /* RRRR RGGG GGGB BBBB */ #define RED 0xF800 #define GREEN 0x07E0 #define BLUE 0x001F #define YELLOW 0xFFE0 #define WHITE 0xFFFF #endif void fill_color16(short *fb_addr, short bit_map, int psize) { int i; for(i=0; i vinfo.xoffset = 0; vinfo.yoffset = vinfo.yres; */ vinfo.xoffset = 0; vinfo.yoffset = 0; /* show color loop */ while(num--) { printf("\ndrawing red ...\n"); fill_color16((short *)fbp, RED, pix_size); //ioctl(fp, FBIOPAN_DISPLAY, &vinfo); sleep(3); printf("\ndrawing green ...\n"); fill_color16((short *)fbp, GREEN, pix_size); //ioctl(fp, FBIOPAN_DISPLAY, &vinfo); sleep(3); printf("\ndrawing blue ...\n"); fill_color16((short *)fbp, BLUE, pix_size); //ioctl(fp, FBIOPAN_DISPLAY, &vinfo); sleep(3); printf("\ndrawing yellow ...\n"); fill_color16((short *)fbp, YELLOW, pix_size); //ioctl(fp, FBIOPAN_DISPLAY, &vinfo); sleep(3); } #if 1 /*这是你想画的点的位置坐标,(0,0)点在屏幕左上角*/ x = 10; y = 10; location = x * (vinfo.bits_per_pixel / 8) + y * finfo.line_length; test_fbp = fbp + location; printf("draw line.......\n"); for(i = 0; i < (vinfo.xres - x); i++) *test_fbp++ = i+30; //ioctl(fp, FBIOPAN_DISPLAY, &vinfo); #endif munmap(fbp, screensize); /*解除映射*/ close (fp); return 0; }