From c755385b06fa2d602aad915245ec6609a93f87f0 Mon Sep 17 00:00:00 2001 From: Edwin Date: Wed, 11 May 2022 14:14:16 +0800 Subject: [PATCH] debug lcd --- .../libraries/hal_drivers/drv_lcd.c | 3 +-- firmware/Camera/User/lcd.c | 3 +-- .../GreedySnake_Client/User/lcd.c | 3 +-- .../GreedySnake_Server/User/lcd.c | 3 +-- firmware/IIC_Sensor/User/lcd.c | 3 +-- firmware/Integrated_Test/User/lcd.c | 3 +-- firmware/OV2640_to_LCD/User/lcd_st7789.c | 21 ++++++++++--------- firmware/Record_Play/User/lcd.c | 3 +-- firmware/TcpClient/User/lcd.c | 3 +-- 9 files changed, 19 insertions(+), 26 deletions(-) diff --git a/firmware/CH32V307_RTT_VC_RC_by_es8388/CH32V307_RTT_VC_RC/libraries/hal_drivers/drv_lcd.c b/firmware/CH32V307_RTT_VC_RC_by_es8388/CH32V307_RTT_VC_RC/libraries/hal_drivers/drv_lcd.c index 0f66dc6..fb58292 100644 --- a/firmware/CH32V307_RTT_VC_RC_by_es8388/CH32V307_RTT_VC_RC/libraries/hal_drivers/drv_lcd.c +++ b/firmware/CH32V307_RTT_VC_RC_by_es8388/CH32V307_RTT_VC_RC/libraries/hal_drivers/drv_lcd.c @@ -86,10 +86,9 @@ static rt_err_t lcd_fsmc_init(void) /* CS: PG12——PD7*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_ResetBits(GPIOD,GPIO_Pin_7); readWriteTiming.FSMC_AddressSetupTime = 0x01; readWriteTiming.FSMC_AddressHoldTime = 0x00; diff --git a/firmware/Camera/User/lcd.c b/firmware/Camera/User/lcd.c index eebd3ad..bc6e0c9 100644 --- a/firmware/Camera/User/lcd.c +++ b/firmware/Camera/User/lcd.c @@ -74,10 +74,9 @@ void lcd_fsmc_init(void) /* CS: PD7*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_ResetBits(GPIOD,GPIO_Pin_7); readWriteTiming.FSMC_AddressSetupTime = 0x01; readWriteTiming.FSMC_AddressHoldTime = 0x00; diff --git a/firmware/GreedySnake_Net/GreedySnake_Client/User/lcd.c b/firmware/GreedySnake_Net/GreedySnake_Client/User/lcd.c index eebd3ad..bc6e0c9 100644 --- a/firmware/GreedySnake_Net/GreedySnake_Client/User/lcd.c +++ b/firmware/GreedySnake_Net/GreedySnake_Client/User/lcd.c @@ -74,10 +74,9 @@ void lcd_fsmc_init(void) /* CS: PD7*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_ResetBits(GPIOD,GPIO_Pin_7); readWriteTiming.FSMC_AddressSetupTime = 0x01; readWriteTiming.FSMC_AddressHoldTime = 0x00; diff --git a/firmware/GreedySnake_Net/GreedySnake_Server/User/lcd.c b/firmware/GreedySnake_Net/GreedySnake_Server/User/lcd.c index eebd3ad..bc6e0c9 100644 --- a/firmware/GreedySnake_Net/GreedySnake_Server/User/lcd.c +++ b/firmware/GreedySnake_Net/GreedySnake_Server/User/lcd.c @@ -74,10 +74,9 @@ void lcd_fsmc_init(void) /* CS: PD7*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_ResetBits(GPIOD,GPIO_Pin_7); readWriteTiming.FSMC_AddressSetupTime = 0x01; readWriteTiming.FSMC_AddressHoldTime = 0x00; diff --git a/firmware/IIC_Sensor/User/lcd.c b/firmware/IIC_Sensor/User/lcd.c index eebd3ad..bc6e0c9 100644 --- a/firmware/IIC_Sensor/User/lcd.c +++ b/firmware/IIC_Sensor/User/lcd.c @@ -74,10 +74,9 @@ void lcd_fsmc_init(void) /* CS: PD7*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_ResetBits(GPIOD,GPIO_Pin_7); readWriteTiming.FSMC_AddressSetupTime = 0x01; readWriteTiming.FSMC_AddressHoldTime = 0x00; diff --git a/firmware/Integrated_Test/User/lcd.c b/firmware/Integrated_Test/User/lcd.c index eebd3ad..bc6e0c9 100644 --- a/firmware/Integrated_Test/User/lcd.c +++ b/firmware/Integrated_Test/User/lcd.c @@ -74,10 +74,9 @@ void lcd_fsmc_init(void) /* CS: PD7*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_ResetBits(GPIOD,GPIO_Pin_7); readWriteTiming.FSMC_AddressSetupTime = 0x01; readWriteTiming.FSMC_AddressHoldTime = 0x00; diff --git a/firmware/OV2640_to_LCD/User/lcd_st7789.c b/firmware/OV2640_to_LCD/User/lcd_st7789.c index 94b6fb7..1ac722a 100644 --- a/firmware/OV2640_to_LCD/User/lcd_st7789.c +++ b/firmware/OV2640_to_LCD/User/lcd_st7789.c @@ -62,12 +62,12 @@ void LCD_FSMCInit(void) RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE, ENABLE); - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_14 | GPIO_Pin_15; + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOE, &GPIO_InitStructure); @@ -78,12 +78,12 @@ void LCD_FSMCInit(void) GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - /* CS : PD11*/ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + /* CS : PD7*/ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_ResetBits(GPIOD, GPIO_Pin_11); + GPIO_ResetBits(GPIOD, GPIO_Pin_7); readWriteTiming.FSMC_AddressSetupTime = 0x01; readWriteTiming.FSMC_AddressHoldTime = 0x00; @@ -130,7 +130,7 @@ void LCD_FSMCInit(void) void LCD_GPIOInit(void) { GPIO_InitTypeDef GPIO_InitStructure; - RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO | RCC_APB2Periph_TIM1, ENABLE); + RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_TIM1, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; @@ -152,6 +152,7 @@ void LCD_GPIOInit(void) TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2; #endif + TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Disable; TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable; TIM_OCInitStructure.TIM_Pulse = 50; TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_High; @@ -184,9 +185,9 @@ void LCD_Init(void) LCD_WriteCmd(0x04); LCD_ReadData(); // dummy read - id1 = LCD_ReadData(); // manufacturer ID ����0X85 - id2 = LCD_ReadData(); // version ID ����0X85 - id3 = LCD_ReadData(); // module/driver ID ����0X52 + id1 = LCD_ReadData(); // manufacturer ID 读取0X85 + id2 = LCD_ReadData(); // version ID 读取0X85 + id3 = LCD_ReadData(); // module/driver ID 读取0X52 printf("LCD manufacturer ID = 0x%x, ", id1); printf("version ID = 0x%x, ", id2); diff --git a/firmware/Record_Play/User/lcd.c b/firmware/Record_Play/User/lcd.c index eebd3ad..bc6e0c9 100644 --- a/firmware/Record_Play/User/lcd.c +++ b/firmware/Record_Play/User/lcd.c @@ -74,10 +74,9 @@ void lcd_fsmc_init(void) /* CS: PD7*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_ResetBits(GPIOD,GPIO_Pin_7); readWriteTiming.FSMC_AddressSetupTime = 0x01; readWriteTiming.FSMC_AddressHoldTime = 0x00; diff --git a/firmware/TcpClient/User/lcd.c b/firmware/TcpClient/User/lcd.c index eebd3ad..bc6e0c9 100644 --- a/firmware/TcpClient/User/lcd.c +++ b/firmware/TcpClient/User/lcd.c @@ -74,10 +74,9 @@ void lcd_fsmc_init(void) /* CS: PD7*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); - GPIO_ResetBits(GPIOD,GPIO_Pin_7); readWriteTiming.FSMC_AddressSetupTime = 0x01; readWriteTiming.FSMC_AddressHoldTime = 0x00; -- Gitee