五、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应用程序,都是将控件的尺寸定好,无论窗体大小怎么变,都不会改变,这样的设计对于一般的应用程序来说是没有问题的,但是对于一些比较特殊的应用,比如有背景图片的,需要铺面整个 ...
随机推荐
- 「THUWC 2017」在美妙的数学王国中畅游
这个题目很明显在暗示你要用泰勒展开. 直接套上去泰勒展开的式子,精度的话保留12项左右即可. 分别维护每一项的和,可能比较难写吧. 然后强行套一个LCT就没了.
- python记录_day04 列表 元组
今日主要内容: 列表 和 元组 列表 一.列表介绍 列表是一种能存储大量数据的数据结构,是能装对象的对象.由方括号 [] 括起来,能放任意类型的数据,数据之间用逗号隔开 列表存储数据是有顺序的 二.增 ...
- shiro会话管理
Shiro提供了完整的企业级会话管理功能,不依赖于底层容器(如web容器tomcat),不管JavaSE还是JavaEE环境都可以使用,提供了会话管理.会话事件监听.会话存储/持久化.容器无关的集群. ...
- python-django rest framework框架之序列化
序列化与反序列化: 对象 -> 字符串 序列化 字符串 -> 对象 反序列化 rest framework序列化+Form 目的: 解决QuerySet序列化问题 功能:解析 和 过滤 - ...
- leetcode-algorithms-27 Remove Element
leetcode-algorithms-27 Remove Element Given an array nums and a value val, remove all instances of t ...
- ECharts饼状图添加事件
和柱状图添加事件没有区别,详情如下: <!DOCTYPE html> <html> <head> <meta http-equiv="Content ...
- 【转】Vue中mintui的field实现blur和focus事件
首先上代码说总结: <mt-field label="卡号" v-model="card.cardNo" @blur.native.capture=&qu ...
- Nginx隐藏版本号操作
1.定位当前nginx所使用的配置文件 ps -ef |grep nginx 如果-c参数.则-c文件即为nginx当前所用配置文件,如上图中配置文件即为/usr/local/nginx/conf/n ...
- redux源码解析(深度解析redux+异步demo)
redux源码解析 1.首先让我们看看都有哪些内容 2.让我们看看redux的流程图 Store:一个库,保存数据的地方,整个项目只有一个 创建store Redux提供 creatStore 函数来 ...
- 8188EU 在AM335X MC183上以AP+STA工作
[目的] 8188EU 在AM335X MC183上以AP+STA工作. [环境] 1. Ubuntu 16.04发行版 2. linux-3.2.0-psp04.06.00.11 3. MC1 ...