rt-thread-official/bsp/mini4020/lcdc.h

69 lines
2.2 KiB
C
Raw Normal View History

#ifndef LCD_GENERAL_H_INCLUDED
#define LCD_GENERAL_H_INCLUDED
#include <rtgui/rtgui.h>
#include <rtgui/driver.h>
#include <rtgui/rtgui_server.h>
#include <rtgui/rtgui_system.h>
#define LCDWIDTH 320
#define LCDHEIGHT 240
//Macro for SIZE register setting
#define XMAX ((LCDWIDTH/16) << 20)
#define YMAX (LCDHEIGHT)
//Macro for PCR register setting
#define TFT ((U32)1 << 31)
#define COLOR (1 << 30) //1Ϊɫ<CEAA><C9AB>.
#define PBSIZE (0 << 28)
#define BPIX (4 << 25) //<2F><EFBFBD><E6B4A2><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>Ӧ16bit
#define PIXPOL (0 << 24) //<2F><><EFBFBD>ؼ<EFBFBD><D8BC>ԡ<EFBFBD><D4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>صļ<D8B5><C4BC><EFBFBD>,<2C><><EFBFBD><EFBFBD>Ч //0<<24
#define FLMPOL (1 << 23) //<2F><><EFBFBD>б<EFBFBD>־<EFBFBD><D6BE><EFBFBD>ԡ<EFBFBD><D4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>־<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>,<2C><><EFBFBD><EFBFBD>Ч.
#define LPPOL (1 << 22) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD><D4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źŵļ<C5B5><C4BC><EFBFBD>,<2C><><EFBFBD><EFBFBD>Ч.
#define CLKPOL (0 << 21) //LCD <20><>λʱ<CEBB>Ӽ<EFBFBD><D3BC>ԡ<EFBFBD><D4A1><EFBFBD><EFBFBD><EFBFBD>LCD <20><>λʱ<CEBB>ӵ<EFBFBD><D3B5><EFBFBD>Ч<EFBFBD>صļ<D8B5><C4BC><EFBFBD>,<2C>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD>Ч.
#define OEPOL (1 << 20) //<2F><><EFBFBD><EFBFBD>ʹ<EFBFBD>ܼ<EFBFBD><DCBC>ԡ<EFBFBD><D4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>źŵļ<C5B5><C4BC><EFBFBD>,<2C><><EFBFBD><EFBFBD>Ч.
#define END_SEL (0 << 18) //ӡ<>ڰ<EFBFBD><DAB0><EFBFBD>ʽѡ<CABD><D1A1>,Сӡ<D0A1>ڰ<EFBFBD>.
#define ACD_SEL (0 << 15) //ACDʱ<44><CAB1>Դѡ<D4B4><D1A1><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4BBBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>,ʹ<><CAB9>FLM <20><>ΪACD <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
#define ACD (0 << 8 ) //<2F><><EFBFBD><EFBFBD>ģʽ.
#define PCD (10)
//Macro for HCR regiter setting //ˮƽ<CBAE><C6BD><EFBFBD>üĴ<C3BC><C4B4><EFBFBD>.
#define H_WIDTH ((U32)46 << 26)
#define H_WAIT_1 (20 << 8)
#define H_WAIT_2 (20)
//Macro for VCR register setting //<2F><>ֱ<EFBFBD><D6B1><EFBFBD>üĴ<C3BC><C4B4><EFBFBD>.
#define V_WIDTH ((U32)10 << 26)
#define PASS_FRAME_WAIT (0 <<16)
#define V_WAIT_1 (3 << 8)
#define V_WAIT_2 (3)
//Macro for LGPR register setting
#define GRAY (4) //<2F>Ҷȵȼ<C8B5>.
//Macro for PWMR register setting
#define SCR (0 << 9) //ʱ<><CAB1>Դѡ<D4B4><D1A1>.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
#define CC_EN (0 << 8) //<2F>Աȶȿ<C8B6><C8BF><EFBFBD>ʹ<EFBFBD><CAB9>,<2C><>.
#define PW (64) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ,
//Macro for DMACR register setting
#define BL ((U32)1 << 31) //<2F>̶<EFBFBD><CCB6><EFBFBD><EFBFBD><EFBFBD>.
#define HM (7 << 16)
#define TM (3)
void lcd_set_pixel(rtgui_color_t *c, int x, int y);
void lcd_get_pixel(rtgui_color_t *c, int x, int y);
void lcd_draw_hline(rtgui_color_t *c, int x1, int x2, int y) ;
void lcd_draw_vline(rtgui_color_t *c, int x, int y1, int y2) ;
void lcd_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y) ;
void lcd_update(rtgui_rect_t *rect);
rt_uint8_t * lcd_get_framebuffer(void);
rt_err_t sep4020_lcd_init(void);
#endif