mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-07 18:02:15 +08:00
add ili9325 lcd driver
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1612 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
717
bsp/stm32f10x/ili_lcd_general.c
Normal file
717
bsp/stm32f10x/ili_lcd_general.c
Normal file
File diff suppressed because it is too large
Load Diff
46
bsp/stm32f10x/ili_lcd_general.h
Normal file
46
bsp/stm32f10x/ili_lcd_general.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef ILI_LCD_GENERAL_H_INCLUDED
|
||||
#define ILI_LCD_GENERAL_H_INCLUDED
|
||||
|
||||
/*
|
||||
Compatible list:
|
||||
ili9320 ili9325 ili9328
|
||||
LG4531
|
||||
*/
|
||||
|
||||
/* LCD color */
|
||||
#define White 0xFFFF
|
||||
#define Black 0x0000
|
||||
#define Grey 0xF7DE
|
||||
#define Blue 0x001F
|
||||
#define Blue2 0x051F
|
||||
#define Red 0xF800
|
||||
#define Magenta 0xF81F
|
||||
#define Green 0x07E0
|
||||
#define Cyan 0x7FFF
|
||||
#define Yellow 0xFFE0
|
||||
|
||||
/*---------------------- Graphic LCD size definitions ------------------------*/
|
||||
#define LCD_WIDTH 240 /* Screen Width (in pixels) */
|
||||
#define LCD_HEIGHT 320 /* Screen Hight (in pixels) */
|
||||
#define BPP 16 /* Bits per pixel */
|
||||
#define BYPP ((BPP+7)/8) /* Bytes per pixel */
|
||||
|
||||
extern void lcd_Initializtion(void);
|
||||
extern unsigned int lcd_getdeviceid(void);
|
||||
|
||||
//#define _ILI_REVERSE_DIRECTION_
|
||||
|
||||
#include "rtthread.h"
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/rtgui_server.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
//extern void rt_hw_lcd_update(rtgui_rect_t *rect);
|
||||
//extern rt_uint8_t * rt_hw_lcd_get_framebuffer(void);
|
||||
//extern void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y);
|
||||
//extern void rt_hw_lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y);
|
||||
//extern void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_t y);
|
||||
//extern void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t y2);
|
||||
//extern void rt_hw_lcd_draw_raw_hline(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y);
|
||||
|
||||
#endif // ILI_LCD_GENERAL_H_INCLUDED
|
||||
@@ -139,7 +139,7 @@
|
||||
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
|
||||
|
||||
/* SECTION: RT-Thread/GUI */
|
||||
#define RT_USING_RTGUI
|
||||
/* #define RT_USING_RTGUI */
|
||||
|
||||
/* name length of RTGUI object */
|
||||
#define RTGUI_NAME_MAX 12
|
||||
|
||||
@@ -260,44 +260,6 @@ static void lcd_data_bus_test(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void lcd_gram_test(void)
|
||||
{
|
||||
unsigned short temp;
|
||||
unsigned int test_x;
|
||||
unsigned int test_y;
|
||||
|
||||
printf(" LCD GRAM test....");
|
||||
|
||||
/* write */
|
||||
temp=0;
|
||||
write_reg(0x0011,0x6030 | (0<<3)); // AM=0 hline
|
||||
|
||||
lcd_SetCursor(0,0);
|
||||
rw_data_prepare();
|
||||
for(test_y=0; test_y<76800; test_y++)
|
||||
{
|
||||
write_data(temp);
|
||||
temp++;
|
||||
}/* write */
|
||||
|
||||
/* read */
|
||||
temp=0;
|
||||
{
|
||||
for(test_y=0; test_y<320; test_y++)
|
||||
{
|
||||
for(test_x=0; test_x<240; test_x++)
|
||||
{
|
||||
if( lcd_read_gram(test_x,test_y) != temp++)
|
||||
{
|
||||
printf(" LCD GRAM ERR!!\r\n");
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf(" TEST PASS!\r\n");
|
||||
}/* read */
|
||||
}
|
||||
|
||||
void ssd1289_init(void)
|
||||
{
|
||||
lcd_port_init();
|
||||
@@ -510,7 +472,23 @@ static rt_err_t lcd_control(rt_device_t dev, rt_uint8_t cmd, void *args)
|
||||
|
||||
void rt_hw_lcd_init(void)
|
||||
{
|
||||
extern struct rt_device_graphic_ops ssd1289_ops;
|
||||
/* LCD RESET */
|
||||
/* PF10 : LCD RESET */
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOF, ENABLE);
|
||||
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
|
||||
GPIO_Init(GPIOF,&GPIO_InitStructure);
|
||||
|
||||
GPIO_ResetBits(GPIOF,GPIO_Pin_10);
|
||||
GPIO_SetBits(GPIOF,GPIO_Pin_10);
|
||||
/* wait for lcd reset */
|
||||
rt_thread_delay(1);
|
||||
}
|
||||
|
||||
/* register lcd device */
|
||||
_lcd_device.type = RT_Device_Class_Graphic;
|
||||
|
||||
Reference in New Issue
Block a user