K20 EVM - Kinetis Cortex-M4 TFT LCD 테스트
Cortex-M4 코어를 가진 K20 EVM보를 이용하여 TFT-LCD 출력 테스트를 했다.
50Mhz에서 400x320 픽셀의 TFT LCD에 1프레임 출력하는데 18ms정도 소요된다.
[NET-EVB SM] 확장 테스트 보드를 이용하여 SD Card의 BMP이미지를 출력하도록 했다.
K20 EVM TFT LCD 출력 테스트 동영상
K20 TFT LCD 드라이버 소스코드정리
//-----------------------------------------------------------------------------
#define _SPI0_IO_INIT() PORTD_PCR0 = PORT_PCR_MUX(0x2);\
PORTD_PCR1 = PORT_PCR_MUX(0x2);\
PORTD_PCR2 = PORT_PCR_MUX(0x2);\
PORTD_PCR3 = PORT_PCR_MUX(0x2);
#define TFT_DRV_HD66791 0
#define TFT_DRV_COM44 1
#define LCD_LAT_BIT BIT16
#define LCD_LAT_PORT GPIOB
#define LCD_LAT_ON() sbi(LCD_LAT_PORT, LCD_LAT_BIT)
#define LCD_LAT_OFF() cbi(LCD_LAT_PORT, LCD_LAT_BIT)
#define LCD_DATA_LATCH() LCD_LAT_ON();LCD_LAT_OFF();
#define LCD_EN_BIT BIT17
#define LCD_EN_PORT GPIOB
#define LCD_ENABLE() cbi(LCD_EN_PORT, LCD_EN_BIT)
#define LCD_DISABLE() sbi(LCD_EN_PORT, LCD_EN_BIT)
#define LCD_RST_BIT //BIT8
#define LCD_RST_PORT //PORTB
#define LCD_RST_ON() //Sbi(LCD_RST_PORT, LCD_RST_BIT)
#define LCD_RST_OFF() //Cbi(LCD_RST_PORT, LCD_RST_BIT)
#define LCD_RS_BIT BIT0
#define LCD_RS_PORT GPIOA
#define LCD_RS_OFF() cbi(LCD_RS_PORT, LCD_RS_BIT)
#define LCD_RS_ON() sbi(LCD_RS_PORT, LCD_RS_BIT)
#define LCD_WR_BIT BIT3
#define LCD_WR_PORT GPIOA
#define LCD_WR_OFF() cbi(LCD_WR_PORT, LCD_WR_BIT)
#define LCD_WR_ON() sbi(LCD_WR_PORT, LCD_WR_BIT)
#define LCD_RD_BIT ///BIT9
#define LCD_RD_PORT //PORTB
#define LCD_RD_OFF() //Cbi(LCD_RD_PORT, LCD_RD_BIT)
#define LCD_RD_ON() //Sbi(LCD_RD_PORT, LCD_RD_BIT)
#define LCD_BL_BIT BIT3
#define LCD_BL_PORT GPIOC
#define LCD_BL_OFF() cbi(LCD_BL_PORT, LCD_BL_BIT)
#define LCD_BL_ON() sbi(LCD_BL_PORT, LCD_BL_BIT)
#define _LCD_DAT_OUT(Data) PORTD = (Data>>8);\
LCD_DATA_LATCH();\
PORTD = (Data&0xFF);
#define TFTGpioInit() SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;\
SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK;\
SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\
SIM_SCGC5 |= SIM_SCGC5_PORTD_MASK;\
PORTA_PCR0 = PORT_PCR_MUX(1);\
PORTA_PCR3 = PORT_PCR_MUX(1);\
PORTB_PCR16 = PORT_PCR_MUX(1);\
PORTB_PCR17 = PORT_PCR_MUX(1);\
PORTC_PCR3 = PORT_PCR_MUX(1);\
PORTD_PCR0 = PORT_PCR_MUX(1);\
PORTD_PCR1 = PORT_PCR_MUX(1);\
PORTD_PCR2 = PORT_PCR_MUX(1);\
PORTD_PCR3 = PORT_PCR_MUX(1);\
PORTD_PCR4 = PORT_PCR_MUX(1);\
PORTD_PCR5 = PORT_PCR_MUX(1);\
PORTD_PCR6 = PORT_PCR_MUX(1);\
PORTD_PCR7 = PORT_PCR_MUX(1);\
Sbi(GPIOA_PDDR, (BIT0|BIT3));\
Sbi(GPIOB_PDDR, (BIT16|BIT17));\
Sbi(GPIOD_PDDR, 0xFF);
반응형