rt-thread/bsp/swm320-lq100/Libraries/SWM320_StdPeriph_Driver/SWM320_lcd.h

97 lines
3.4 KiB
C
Raw Normal View History

2018-12-24 17:17:27 +08:00
#ifndef __SWM320_LCD_H__
#define __SWM320_LCD_H__
typedef struct
{
uint8_t Interface; //LCD<43><44><EFBFBD>ӿڣ<D3BF>LCD_INTERFACE_RGB<47><42>LCD_INTERFACE_I80<38><30>LCD_INTERFACE_M68
/* RGBͬ<42><CDAC><EFBFBD>ӿڲ<D3BF><DAB2><EFBFBD> */
uint8_t Dir; //LCD_DIR_LANDSCAPE <20><><EFBFBD><EFBFBD> LCD_DIR_PORTRAIT <20><><EFBFBD><EFBFBD>
uint16_t HnPixel; //ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡֵ1024
uint16_t VnPixel; //<2F><>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡֵ 768
uint8_t Hfp; //horizonal front porch<63><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡֵ32
uint8_t Hbp; //horizonal back porch<63><68> <20><><EFBFBD><EFBFBD>ȡֵ128
uint8_t Vfp; //vertical front porch<63><68> <20><><EFBFBD><EFBFBD>ȡֵ8
uint8_t Vbp; //vertical back porch<63><68> <20><><EFBFBD><EFBFBD>ȡֵ32
uint8_t ClkDiv; //ϵͳʱ<CDB3>Ӿ<EFBFBD>ClkDiv<69><76>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DOCCLK<4C><4B>0 2<><32>Ƶ 1 4<><34>Ƶ 2 6<><36>Ƶ ... ... 31 64<36><34>Ƶ
uint8_t SamplEdge; //<2F><>Ļ<EFBFBD><C4BB>DOTCLK<4C><4B><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>LCD_SAMPLEDGE_RISE<53><45>LCD_SAMPLEDGE_FALL
uint8_t ClkAlways; //1 һֱ<D2BB><D6B1><EFBFBD><EFBFBD>DOTCLK 0 ֻ<>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>DOTCLK
uint8_t HsyncWidth; //HSYNC<4E>͵<EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٸ<EFBFBD>DOTCLK<4C><4B>ȡֵ<C8A1><D6B5>LCD_HSYNC_1DOTCLK<4C><4B>LCD_HSYNC_2DOTCLK<4C><4B>LCD_HSYNC_3DOTCLK<4C><4B>LCD_HSYNC_4DOTCLK
/* MPU<50><55>8080<38><30><EFBFBD>ӿڲ<D3BF><DAB2><EFBFBD> */
uint8_t T_CSf_WRf; //CSn<53>½<EFBFBD><C2BD>ص<EFBFBD>WRn<52>½<EFBFBD><C2BD>ص<EFBFBD>ʱ<EFBFBD>䣬ȡֵ0--3
uint8_t T_WRnHold; //WRn<52>͵<EFBFBD>ƽ<EFBFBD>ij<EFBFBD><C4B3><EFBFBD>ʱ<EFBFBD>䣬 ȡֵ0--7
uint8_t T_WRr_CSr; //WRn<52><6E><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>CSn<53><6E><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ʱ<EFBFBD>䣬ȡֵ0--3
uint8_t T_CSr_CSf; //CSn<53><6E><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>CSn<53>½<EFBFBD><C2BD>ص<EFBFBD>ʱ<EFBFBD>䣬ȡֵ0--7
uint8_t IntEOTEn; //End of Transter<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3>ж<EFBFBD>ʹ<EFBFBD><CAB9>
} LCD_InitStructure;
#define LCD_INTERFACE_RGB 0
#define LCD_INTERFACE_I80 1
#define LCD_INTERFACE_M68 2
#define LCD_DIR_LANDSCAPE 0 //<2F><><EFBFBD><EFBFBD>
#define LCD_DIR_PORTRAIT 1 //<2F><><EFBFBD><EFBFBD>
#define LCD_SAMPLEDGE_RISE 0 //<2F><>Ļ<EFBFBD><C4BB>DOTCLK<4C><4B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define LCD_SAMPLEDGE_FALL 1 //<2F><>Ļ<EFBFBD><C4BB>DOTCLK<4C><4B><EFBFBD>½<EFBFBD><C2BD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define LCD_HSYNC_1DOTCLK 0 //1<><31>DOTCLK
#define LCD_HSYNC_2DOTCLK 1
#define LCD_HSYNC_3DOTCLK 2
#define LCD_HSYNC_4DOTCLK 3
#define LCD_CLKDIV_2 0
#define LCD_CLKDIV_4 1
#define LCD_CLKDIV_6 2
#define LCD_CLKDIV_8 3
#define LCD_CLKDIV_10 4
#define LCD_CLKDIV_12 5
#define LCD_CLKDIV_14 6
#define LCD_CLKDIV_16 7
#define LCD_CLKDIV_18 8
#define LCD_CLKDIV_20 9
#define LCD_CLKDIV_22 10
#define LCD_CLKDIV_24 11
#define LCD_CLKDIV_26 12
#define LCD_CLKDIV_28 13
#define LCD_CLKDIV_30 14
#define LCD_CLKDIV_32 15
#define LCD_CLKDIV_34 16
#define LCD_CLKDIV_36 17
#define LCD_CLKDIV_38 18
#define LCD_CLKDIV_40 19
#define LCD_CLKDIV_42 20
#define LCD_CLKDIV_44 21
#define LCD_CLKDIV_46 22
#define LCD_CLKDIV_48 23
#define LCD_CLKDIV_50 24
#define LCD_CLKDIV_52 25
#define LCD_CLKDIV_54 26
#define LCD_CLKDIV_56 27
#define LCD_CLKDIV_58 28
#define LCD_CLKDIV_60 29
#define LCD_CLKDIV_62 30
#define LCD_CLKDIV_64 31
void LCD_Init(LCD_TypeDef *LCDx, LCD_InitStructure *initStruct);
void LCD_Start(LCD_TypeDef *LCDx);
uint32_t LCD_IsBusy(LCD_TypeDef *LCDx);
void LCD_I80_WriteReg(LCD_TypeDef *LCDx, uint16_t reg, uint16_t val[], uint16_t cnt);
void LCD_I80_WriteOneReg(LCD_TypeDef *LCDx, uint16_t reg, uint16_t val);
void LCD_I80_WriteData(LCD_TypeDef *LCDx, uint16_t data[], uint16_t cnt);
void LCD_I80_WriteOneData(LCD_TypeDef *LCDx, uint16_t val);
void LCD_INTEn(LCD_TypeDef *LCDx);
void LCD_INTDis(LCD_TypeDef *LCDx);
void LCD_INTClr(LCD_TypeDef *LCDx);
uint32_t LCD_INTStat(LCD_TypeDef *LCDx);
#endif //__SWM320_LCD_H__