📄 tc025thea2_drv.c
字号:
#include "include/main.h"
#include "LCD/lcd.h"
#include "TC025THEA2_drv.h"
#include "LCD/lcdc.h"
#include "LCD/gpio.h"
#include "LCD/isr.h"
#ifdef _LCD_TC025THEA2_
#define CS 12
#define SCL 11
#define SDI 10
#define set_cs(d) gpio_set_data(GPIO_B, CS, (d))
#define set_scl(d) gpio_set_data(GPIO_B, SCL, (d))
#define set_sdi(d) gpio_set_data(GPIO_B, SDI, (d))
#define send_bit(b) do{ \
set_scl(0); \
set_sdi((b)); \
set_scl(1); \
}while(0)
//
// set_init() was redefined
//
#define set_init() do{ \
gpio_set_mode(GPIO_B, CS, GPIO_OUTPUT); \
gpio_set_mode(GPIO_B, SCL, GPIO_OUTPUT);\
gpio_set_mode(GPIO_B, SDI, GPIO_OUTPUT);\
gpio_set_data(GPIO_B, CS, 1); \
gpio_set_data(GPIO_B, SCL, 0); \
gpio_set_data(GPIO_B, SDI, 0); \
}while(0)
extern unsigned short int *GDI_BufAddr[];
void lcd_spi(unsigned int d)
{
int i;
set_init();
/* transfer start */
set_cs(0);
/* index register or instruction setting, MSB first */
for(i=15; i >= 0; i--) {
send_bit((d & (1 << i)) >> i);
}
/* transfer end */
set_scl(0);
set_sdi(0);
set_cs(1);
}
void lcd_power_on_(void)
{
lcd_spi(0x1701);
}
void lcdc_init_for_mp4_(int flag)
{
lcdc_tft_enable(
GDI_BufAddr[0], LCD_CLKDIV,
LCD_WIDTH*3, LCD_HEIGHT,
1, 24, 10,
2, 191, 72
);
intc_enable(INT_LCD, INT_IRQ);
lcd_power_on();
lcd_pwr_en(1);
lcd_light_en(1);
}
//end of error
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -