五、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应用程序,都是将控件的尺寸定好,无论窗体大小怎么变,都不会改变,这样的设计对于一般的应用程序来说是没有问题的,但是对于一些比较特殊的应用,比如有背景图片的,需要铺面整个 ...
随机推荐
- 遍历input文本框
最近写的一个项目中,页面中有很多的“text文本框”和“select下拉框” 校验input框和select框是否非空,如果为空给出提示.反之,隐藏提示内容. html 页面中的input类型有ty ...
- 微信小程序页面内转发 按钮 转发
通过给 button 组件设置属性 open-type="share",可以在用户点击按钮后触发 Page.onShareAppMessage() 事件,如果当前页面没有定义此事件 ...
- php字符串 统计个数
方法一 $arr=str_split($str); $arr=array_count_values($arr); /* * 方法二 * */ $arr = str_split($str); $a2 = ...
- http bass
1.http 是超文本传输协议,是从万维网服务器传输超文本到本地浏览器的传输协议 2.http是一个基于tcp/ip通信协议来传输数据(html,图片,查询结果等) 3.一个完整的http请求包含7个 ...
- Windows下如何使用Heroku
1. 安装 进入https://devcenter.heroku.com/articles/heroku-cli#windows,选择对应版本安装 安装后使用heroku -v可检查版本号 2. 登陆 ...
- 牛客小白赛1 F题三视图
链接:https://www.nowcoder.com/acm/contest/85/F来源:牛客网 题目描述 Etéreo 拿出家里的许多的立方体积木,堆成了一个三维空间中的模型.既然你高考选了技术 ...
- shiro中单点登录
Shiro 1.2开始提供了Jasig CAS单点登录的支持,单点登录主要用于多系统集成,即在多个系统中,用户只需要到一个中央服务器登录一次即可访问这些系统中的任何一个,无须多次登录.此处我们使用Ja ...
- logging addHandler(console)
import logging # set up logging to file - see previous section for more details logging.basicConfig( ...
- element中使用button会刷新一遍页面
会刷新: <el-form-item> <button @click="register('form')" class="submitBtn&qu ...
- Echarts 简单报表系列四:雷达图
代码如下: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...