Ubiquitous/RT_Thread: fix lcd drive for k210 ,before lcd drive can't work with spi.
This commit is contained in:
parent
fedd6affc9
commit
5b9cbad759
|
@ -37,7 +37,7 @@ static struct io_config
|
||||||
IOCONFIG(BSP_DVP_CMOS_HREF_PIN, FUNC_CMOS_HREF),
|
IOCONFIG(BSP_DVP_CMOS_HREF_PIN, FUNC_CMOS_HREF),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BSP_USING_LCD
|
#if 0 //here is a drv lcd bug now don't know why
|
||||||
IOCONFIG(BSP_LCD_CS_PIN, FUNC_SPI0_SS3), /* LCD CS PIN */
|
IOCONFIG(BSP_LCD_CS_PIN, FUNC_SPI0_SS3), /* LCD CS PIN */
|
||||||
IOCONFIG(BSP_LCD_WR_PIN, FUNC_SPI0_SCLK), /* LCD WR PIN */
|
IOCONFIG(BSP_LCD_WR_PIN, FUNC_SPI0_SCLK), /* LCD WR PIN */
|
||||||
IOCONFIG(BSP_LCD_DC_PIN, FUNC_GPIOHS2), /* LCD DC PIN */
|
IOCONFIG(BSP_LCD_DC_PIN, FUNC_GPIOHS2), /* LCD DC PIN */
|
||||||
|
@ -123,6 +123,9 @@ int io_config_init(void)
|
||||||
sysctl_set_power_mode(SYSCTL_POWER_BANK6, SYSCTL_POWER_V18);
|
sysctl_set_power_mode(SYSCTL_POWER_BANK6, SYSCTL_POWER_V18);
|
||||||
sysctl_set_power_mode(SYSCTL_POWER_BANK7, SYSCTL_POWER_V18);
|
sysctl_set_power_mode(SYSCTL_POWER_BANK7, SYSCTL_POWER_V18);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FACE_DETECT
|
||||||
|
sysctl_clock_enable(SYSCTL_CLOCK_AI);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(io_config_init);
|
INIT_BOARD_EXPORT(io_config_init);
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,9 @@ static void init_rst(void)
|
||||||
{
|
{
|
||||||
gpiohs_set_drive_mode(RST_GPIONUM, GPIO_DM_OUTPUT);
|
gpiohs_set_drive_mode(RST_GPIONUM, GPIO_DM_OUTPUT);
|
||||||
gpiohs_set_pin(RST_GPIONUM, GPIO_PV_LOW);
|
gpiohs_set_pin(RST_GPIONUM, GPIO_PV_LOW);
|
||||||
usleep(100000);
|
rt_thread_mdelay(10);
|
||||||
gpiohs_set_pin(RST_GPIONUM, GPIO_PV_HIGH);
|
gpiohs_set_pin(RST_GPIONUM, GPIO_PV_HIGH);
|
||||||
usleep(100000);
|
rt_thread_mdelay(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,17 +122,26 @@ void lcd_interrupt_enable(void)
|
||||||
lcd_ctl.mode = 1;
|
lcd_ctl.mode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcd_pre()
|
||||||
|
{
|
||||||
|
fpioa_set_function(37, FUNC_GPIOHS0 + RST_GPIONUM);
|
||||||
|
fpioa_set_function(38, FUNC_GPIOHS0 + DCX_GPIONUM);
|
||||||
|
fpioa_set_function(36, FUNC_SPI0_SS0 + LCD_SPI_SLAVE_SELECT);
|
||||||
|
fpioa_set_function(39, FUNC_SPI0_SCLK);
|
||||||
|
}
|
||||||
|
|
||||||
int lcd_init(void)
|
int lcd_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint8_t data = 0;
|
uint8_t data = 0;
|
||||||
|
lcd_pre();
|
||||||
tft_hard_init();
|
tft_hard_init();
|
||||||
/*soft reset*/
|
/*soft reset*/
|
||||||
tft_write_command(SOFTWARE_RESET);
|
tft_write_command(SOFTWARE_RESET);
|
||||||
usleep(100000);
|
rt_thread_mdelay(10);
|
||||||
/*exit sleep*/
|
/*exit sleep*/
|
||||||
tft_write_command(SLEEP_OFF);
|
tft_write_command(SLEEP_OFF);
|
||||||
usleep(100000);
|
rt_thread_mdelay(10);
|
||||||
/*pixel format*/
|
/*pixel format*/
|
||||||
tft_write_command(PIXEL_FORMAT_SET);
|
tft_write_command(PIXEL_FORMAT_SET);
|
||||||
data = 0x55;
|
data = 0x55;
|
||||||
|
@ -302,14 +311,8 @@ void lcd_draw_picture(uint16_t x1, uint16_t y1, uint16_t width, uint16_t height,
|
||||||
lcd_set_area(x1, y1, x1 + width - 1, y1 + height - 1);
|
lcd_set_area(x1, y1, x1 + width - 1, y1 + height - 1);
|
||||||
tft_write_word(ptr, width * height / 2, lcd_ctl.mode ? 2 : 0);
|
tft_write_word(ptr, width * height / 2, lcd_ctl.mode ? 2 : 0);
|
||||||
}
|
}
|
||||||
void lcd_pre()
|
|
||||||
{
|
|
||||||
fpioa_set_function(38, FUNC_GPIOHS0 + DCX_GPIONUM);
|
|
||||||
fpioa_set_function(36, FUNC_SPI0_SS3);
|
|
||||||
fpioa_set_function(39, FUNC_SPI0_SCLK);
|
|
||||||
fpioa_set_function(37, FUNC_GPIOHS0 + RST_GPIONUM);
|
|
||||||
|
|
||||||
}
|
|
||||||
void lcd_test0()
|
void lcd_test0()
|
||||||
{
|
{
|
||||||
char test[]={"xuos-intelligence framwork"};
|
char test[]={"xuos-intelligence framwork"};
|
||||||
|
|
|
@ -96,8 +96,9 @@
|
||||||
#define DIGITAL_GAMMA_CTL2 0xE3
|
#define DIGITAL_GAMMA_CTL2 0xE3
|
||||||
#define INTERFACE_CTL 0xF6
|
#define INTERFACE_CTL 0xF6
|
||||||
|
|
||||||
#define DCX_GPIONUM (2)
|
#define DCX_GPIONUM (5)
|
||||||
#define RST_GPIONUM (3)
|
#define RST_GPIONUM (4)
|
||||||
|
#define LCD_SPI_SLAVE_SELECT 3
|
||||||
|
|
||||||
#define SPI_CHANNEL 0
|
#define SPI_CHANNEL 0
|
||||||
#define SPI_SLAVE_SELECT 3
|
#define SPI_SLAVE_SELECT 3
|
||||||
|
|
Loading…
Reference in New Issue