五、LCD屏填充纯色
废话不说,直接上代码:
lcd.c
#include "lcd.h" static int PEN_COLOR = LCD_RED; /* 定义画笔(前景)颜色 */
static int BK_COLOR = LCD_BLACK; /* 定义背景颜色 */ /**
* \brief LCD初始化
*/
void lcd_init (void)
{
GPICON = ;
GPICON |= 0xaaaaaaaa;
GPJCON = ;
GPJCON |= 0xaaaaaa; MIFPCON &= ~(0x1<<);
SPCON &= ~0x3;
SPCON |= 0x1; VIDCON0 = (<<) | (0x1<<) | (0x3);
VIDCON1 = (0x1<<) | (0x1<<); VIDTCON0 = (<<) | (<<) | ();
VIDTCON1 = (<<) | (<<) | (); VIDTCON2 = ((LCD_HEIGHT - ) << ) | (LCD_WIDTH - );
WINCON0 = (0xb<<) | (0x1); VIDOSD0A = ;
VIDOSD0B = ((LCD_WIDTH - ) << ) | ((LCD_HEIGHT - )); VIDOSD0C = LCD_WIDTH * LCD_HEIGHT; VIDW00ADD0B0 = SHOW_BUF;
} /**
* \brief 设置画笔颜色
*/
void set_pen_color (int color)
{
PEN_COLOR = color;
} /**
* \brief 设置背景颜色
*/
void set_bk_color (int color)
{
BK_COLOR = color;
} /**
* \brief 绘制一个点
*/
void lcd_draw_point (int x, int y)
{
*((int *)SHOW_BUF + x + y * LCD_WIDTH) = PEN_COLOR;
} void lcd_draw_bk (int x, int y)
{
*((int *)SHOW_BUF + x + y * LCD_WIDTH) = BK_COLOR;
} /**
* \brief 清屏(填充背景色)
*/
void lcd_clean (void)
{
int i, j, k;
for(i=; i<LCD_HEIGHT; i++) {
for(j=; j<LCD_WIDTH; j++) {
lcd_draw_bk(j, i);
}
}
}
lcd.h
#ifndef __LCD_H
#define __LCD_H /* 定义寄存器地址 */
#define GPICON (*(unsigned int *)0x7F008100)
#define SPCON (*(unsigned int *)0x7F0081A0)
#define MIFPCON (*(unsigned int *)0x7410800c)
#define GPJCON (*(unsigned int *)0x7F008120) #define VIDCON0 (*(unsigned int *)0x77100000)
#define VIDCON1 (*(unsigned int *)0x77100004)
#define VIDCON2 (*(unsigned int *)0x77100008)
#define VIDTCON0 (*(unsigned int *)0x77100010)
#define VIDTCON1 (*(unsigned int *)0x77100014)
#define VIDTCON2 (*(unsigned int *)0x77100018)
#define WINCON0 (*(unsigned int *)0x77100020)
#define WINCON1 (*(unsigned int *)0x77100024)
#define WINCON2 (*(unsigned int *)0x77100028)
#define WINCON3 (*(unsigned int *)0x7710002C)
#define WINCON4 (*(unsigned int *)0x77100030)
#define VIDOSD0A (*(unsigned int *)0x77100040)
#define VIDOSD0B (*(unsigned int *)0x77100044)
#define VIDOSD0C (*(unsigned int *)0x77100048)
#define VIDOSD1A (*(unsigned int *)0x77100050)
#define VIDOSD1B (*(unsigned int *)0x77100054)
#define VIDOSD1C (*(unsigned int *)0x77100058)
#define VIDW00ADD0B0 (*(unsigned int *)0x771000A0)
#define GPECON (*(unsigned int *)0x7f008080)
#define GPEDAT (*(unsigned int *)0x7f008084) #define LCD_WIDTH 480 /* 定义LCD宽度 */
#define LCD_HEIGHT 272 /* 定义LCD高度 */ /* 定义显存地址 */
#define SHOW_BUF 0x54000000 /* 定义常用颜色 */
#define COL(R,G,B) ((R<<16) | (G<<8) | (B))
#define LCD_RED COL(0xFF, 0, 0)
#define LCD_GREEN COL(0, 0xFF, 0)
#define LCD_BLUE COL(0, 0, 0xFF)
#define LCD_WHITE COL(0xFF, 0xFF, 0xFF)
#define LCD_BLACK COL(0, 0, 0) /******************************* 函数声明 **************************/
/**
* \brief LCD初始化
*/
extern void lcd_init (void); /**
* \brief 设置画笔颜色
*/
extern void set_pen_color (int color); /**
* \brief 设置背景颜色
*/
extern void set_bk_color (int color); /**
* \brief 绘制一个点
*/
extern void lcd_draw_point (int x, int y); /**
* \brief 清屏(填充背景色)
*/
extern void lcd_clean (void); #endif
main.c
#include "lcd.h" int main(int argc, const char *argv[])
{
lcd_init();
set_bk_color(LCD_RED);
lcd_clean();
return ;
}
start.s
.section .text
.global _start _start:
b main
.end
Makefile
CC = arm-none-linux-gnueabi-
objs = main.o lcd.o start.o test.bin:$(objs)
$(CC)ld $(objs) -Ttext -o test.elf
$(CC)objcopy -O binary test.elf test.bin %.o:%.c
$(CC)gcc -c $< -o $@ %.o:%.s
$(CC)gcc -c $< -o $@ clean:
rm *.o *.elf *.bin
五、LCD屏填充纯色的更多相关文章
- 痞子衡嵌入式:记录i.MXRT1060驱动LCD屏显示横向渐变色有亮点问题解决全过程(提问篇)
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家分享的是i.MXRT1060上LCD横向渐变色显示出亮点问题的分析解决经验. 痞子衡前段时间在支持一个i.MXRT1060客户项目时遇到了LCD ...
- 嵌入式Linux基于framebuffer的jpeg格式本地LCD屏显示
在基于Linux的视频监控采集系统中,摄像头采集到的一帧视频图像数据一般都是经过硬件自动压缩成jpeg格式的,然后再保存到摄像头设备的缓冲区.如果要把采集到的jpeg格式显示在本地LCD屏上,由于我们 ...
- MIPI接口LCD屏调试心得(转)
源: MIPI接口LCD屏调试心得
- 六、在U-boot中让LCD填充纯色
1. 编译U-boot 准备好U-boot压缩包urbetter-u-boot-1.1.6-v1.0.tgz,输入命令:tar -xvf urbetter-u-boot-1.1.6-v1.0.tgz ...
- ARM LCD屏调试3--屏的应用编程
2011-06-25 19:20:47 驱动自己写完了,应用函数自己就不写了,找了一点代码参考,移植并修改了一下,配合之前的定义的接口文档,我贴出部分代码.目录: 一,开发环境... 1 二,底层函数 ...
- 十四、使用framebuffer填充纯色
简单描述一下framebuffer的使用,它其实就相当于将屏幕上的像素映射到内存中,改变内存中的内容后屏幕自动就变颜色了. 首先要调用open("/dev/fb0", O_RDWR ...
- LCD屏参数及应用举例
1. LCD参数及原理 R G B 信号 PCLK(像素时钟),LCLK(HSYNC,线时钟,水平同步时钟),FCLK(VSYNC,帧时钟,垂直同步时钟) 7寸屏一般由两种工作模式DE和时钟模式, ...
- uboot启动完成,kernel启动时lcd屏…
先说说开发环境吧: 1 内核:linux2.6.xx 2 uboot:买开发板带的 注释:在最后我又添加了问题得到完美解决的办法. 问题:uboot启动完成,kernel启动时lcd屏幕出现杂色(比如 ...
- WPF布局之让你的控件随着窗口等比放大缩小,适应多分辨率满屏填充应用
一直以来,我们设计windows应用程序,都是将控件的尺寸定好,无论窗体大小怎么变,都不会改变,这样的设计对于一般的应用程序来说是没有问题的,但是对于一些比较特殊的应用,比如有背景图片的,需要铺面整个 ...
随机推荐
- 6月4 Smarty练习增删改
练习Smarty的增删改所需要用到的数据库名称:timu,xuanxiang,kemu,nandu,leixing,然后使用smarty模板将前端后后台分割开来: 主页后台页面:zhupm.php & ...
- vue项目 sockjs-node一直报错问题
vue3下 vue.config.js中 devServer: { host: '0.0.0.0', port: 8080, proxy: { '/': { target: 'http://127.0 ...
- 牛客练习赛32-D-MST+tarjin割边
链接:https://ac.nowcoder.com/acm/contest/272/D来源:牛客网 题目描述 小p和他的朋友约定好去游乐场游玩,但是他们到了游乐场后却互相找不到对方了. 游乐场可以看 ...
- phpStorm中Structure窗口中的符号代表的意思
参考:https://www.jetbrains.com/help/phpstorm/2016.3/symbols.html Icon Description Class 类 Final clas ...
- python零碎知识点
0.规范化 使用Ctrl+Alt+L可以将代码排列格式更加规范化 1.浮点数 1.23x109就是1.23e9或者12.3e8:0.000012可以写成1.2e-5 2.字符串 >>> ...
- Git中ssh的使用
远程仓库前期工作(SSH HEY的使用) 1.1.注册GitHub账号 1.2.创建SSH Key 打开Git Bash后,输入ssh-keygen -t rsa -C "youremail ...
- nginx是什么,如何使用
一:nginx是什么? 二:nginx作为网关,需要具备什么?(nginx可以作为web服务器,但更多的时候,我们把它作为网关,因为它具备网关必备的功能:) 反向代理(反向代理就是服务器找来一个机器代 ...
- Oracle12c版本中未归档隐藏参数
In this post, I will give a list of all undocumented parameters in Oracle 12.1.0.1c. Here is a query ...
- Windows下定时任务
windows计划任务 1.写一个PHP程序,命名为test.php,内容如下所示: <? $fp = fopen("test.txt", "a+"); ...
- Python线程二
转自:https://www.cnblogs.com/chengd/articles/7770898.html 1. threading.Lock() import threading balance ...