diff options
| author | Rbb666 <[email protected]> | 2024-04-19 10:36:42 +0800 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2024-04-18 22:51:03 -0400 |
| commit | 61fac62521b81365e0d9eff0012510ff3d0fd876 (patch) | |
| tree | 6fdf47cca364538c7d5528f4db015d695e2e8469 | |
| parent | 24373e1ec310511adb5ea3dedaae29005cf6fc32 (diff) | |
[bsp][renesas]fix ra6m3 can't use lcd problem.
| -rw-r--r-- | bsp/renesas/libraries/HAL_Drivers/config/ra6m3/lcd_config.h | 31 | ||||
| -rw-r--r-- | bsp/renesas/libraries/HAL_Drivers/drv_lcd.c | 25 | ||||
| -rw-r--r-- | bsp/renesas/ra6m3-hmi-board/board/ports/lcd_port.h | 34 | ||||
| -rw-r--r-- | bsp/renesas/ra6m3-hmi-board/configuration.xml | 14 |
4 files changed, 59 insertions, 45 deletions
diff --git a/bsp/renesas/libraries/HAL_Drivers/config/ra6m3/lcd_config.h b/bsp/renesas/libraries/HAL_Drivers/config/ra6m3/lcd_config.h new file mode 100644 index 0000000000..92eda2da19 --- /dev/null +++ b/bsp/renesas/libraries/HAL_Drivers/config/ra6m3/lcd_config.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2006-2024, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2024-03-01 Rbb666 the first version + */ +#ifndef __LCD_CONFIG_H_ +#define __LCD_CONFIG_H_ + +typedef enum +{ + ROTATION_ZERO = 0, + ROTATION_090 = 90, + ROTATION_180 = 180, + ROTATION_270 = 270, +} bsp_rotation; + +#define LCD_WIDTH DISPLAY_HSIZE_INPUT0 +#define LCD_HEIGHT DISPLAY_VSIZE_INPUT0 +#define LCD_BITS_PER_PIXEL DISPLAY_BITS_PER_PIXEL_INPUT1 +#define LCD_PIXEL_FORMAT RTGRAPHIC_PIXEL_FORMAT_RGB565 +#define LCD_BUF_SIZE (LCD_WIDTH * LCD_HEIGHT * LCD_BITS_PER_PIXEL / 8) + +#define ENABLE_DOUBLE_BUFFER (0) + +#define LCD_BL_PIN BSP_IO_PORT_01_PIN_00 + +#endif diff --git a/bsp/renesas/libraries/HAL_Drivers/drv_lcd.c b/bsp/renesas/libraries/HAL_Drivers/drv_lcd.c index d133257aaf..1c1d770b7c 100644 --- a/bsp/renesas/libraries/HAL_Drivers/drv_lcd.c +++ b/bsp/renesas/libraries/HAL_Drivers/drv_lcd.c @@ -14,6 +14,8 @@ #ifdef BSP_USING_LCD #ifdef SOC_SERIES_R7FA8M85 #include <ra8/lcd_config.h> +#else +#include <ra6m3/lcd_config.h> #endif #include <drv_lcd.h> @@ -38,8 +40,6 @@ static uint16_t *lcd_current_working_buffer = (uint16_t *) &fb_background[0]; #ifdef SOC_SERIES_R7FA8M85 static uint8_t lcd_framebuffer[LCD_BUF_SIZE] BSP_ALIGN_VARIABLE(64) BSP_PLACE_IN_SECTION(".sdram"); -#else -static uint8_t lcd_framebuffer[LCD_BUF_SIZE] BSP_ALIGN_VARIABLE(64); #endif // G2D @@ -47,7 +47,9 @@ extern d2_device *d2_handle0; static d2_device **_d2_handle_user = &d2_handle0; static d2_renderbuffer *renderbuffer; +#ifdef SOC_SERIES_R7FA8M85 extern void ra8_mipi_lcd_init(void); +#endif rt_weak void DisplayVsyncCallback(display_callback_args_t *p_args) { @@ -260,6 +262,7 @@ static rt_err_t ra_lcd_control(rt_device_t device, int cmd, void *args) { case RTGRAPHIC_CTRL_RECT_UPDATE: { +#ifdef SOC_SERIES_R7FA8M85 struct rt_device_rect_info *info = (struct rt_device_rect_info *)args; #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) SCB_CleanInvalidateDCache_by_Addr((uint32_t *)lcd->lcd_info.framebuffer, sizeof(fb_background[0])); @@ -276,6 +279,7 @@ static rt_err_t ra_lcd_control(rt_device_t device, int cmd, void *args) fsp_err_t err = R_GLCDC_BufferChange(&g_display0_ctrl, (uint8_t *) lcd_current_working_buffer, DISPLAY_FRAME_LAYER_1); RT_ASSERT(err == 0); #endif +#endif /* SOC_SERIES_R7FA8M85 */ /* wait for vsync interrupt */ vsync_wait(); } @@ -316,11 +320,13 @@ static rt_err_t drv_lcd_init(struct rt_device *device) static void reset_lcd_panel(void) { +#ifdef LCD_RST_PIN rt_pin_mode(LCD_RST_PIN, PIN_MODE_OUTPUT); rt_pin_write(LCD_RST_PIN, PIN_LOW); rt_thread_mdelay(100); rt_pin_write(LCD_RST_PIN, PIN_HIGH); rt_thread_mdelay(100); +#endif } static rt_err_t ra_bsp_lcd_init(void) @@ -334,13 +340,14 @@ static rt_err_t ra_bsp_lcd_init(void) error = R_GLCDC_Open(&g_display0_ctrl, &g_display0_cfg); if (FSP_SUCCESS == error) { +#ifdef SOC_SERIES_R7FA8M85 /* config mipi */ ra8_mipi_lcd_init(); - +#endif /* Initialize g2d */ error = g2d_drv_hwInit(); - /** Display driver start */ + /* Display driver start */ error = R_GLCDC_Start(&g_display0_ctrl); } @@ -359,13 +366,11 @@ int rt_hw_lcd_init(void) _lcd.lcd_info.width = LCD_WIDTH; _lcd.lcd_info.bits_per_pixel = LCD_BITS_PER_PIXEL; _lcd.lcd_info.pixel_format = LCD_PIXEL_FORMAT; - +#ifdef SOC_SERIES_R7FA8M85 _lcd.lcd_info.framebuffer = (uint8_t *)lcd_framebuffer; - if (_lcd.lcd_info.framebuffer == NULL) - { - LOG_E("alloc lcd framebuffer fail"); - return -RT_ERROR; - } +#else + _lcd.lcd_info.framebuffer = (uint8_t *)&fb_background[0]; +#endif LOG_D("\nlcd framebuffer address:%#x", _lcd.lcd_info.framebuffer); memset(_lcd.lcd_info.framebuffer, 0x0, LCD_BUF_SIZE); diff --git a/bsp/renesas/ra6m3-hmi-board/board/ports/lcd_port.h b/bsp/renesas/ra6m3-hmi-board/board/ports/lcd_port.h deleted file mode 100644 index 1612751720..0000000000 --- a/bsp/renesas/ra6m3-hmi-board/board/ports/lcd_port.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2006-2023, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2018-07-28 liu2guang the first version for STM32F469NI-Discovery. - */ - -#ifndef __LCD_PORT_H_ -#define __LCD_PORT_H_ - -#include <rtthread.h> -#include <rtdevice.h> -#include <board.h> - -typedef enum -{ - ROTATION_ZERO = 0, - ROTATION_090 = 90, - ROTATION_180 = 180, - ROTATION_270 = 270, -} bsp_rotation; - -#define LCD_WIDTH DISPLAY_HSIZE_INPUT0 -#define LCD_HEIGHT DISPLAY_VSIZE_INPUT0 -#define LCD_BITS_PER_PIXEL DISPLAY_BITS_PER_PIXEL_INPUT1 -#define LCD_PIXEL_FORMAT RTGRAPHIC_PIXEL_FORMAT_RGB565 -#define LCD_BUF_SIZE (LCD_WIDTH * LCD_HEIGHT * LCD_BITS_PER_PIXEL / 8) - -#define LCD_BL_PIN BSP_IO_PORT_01_PIN_00 - -#endif /* __LCD_PORT_H_ */ diff --git a/bsp/renesas/ra6m3-hmi-board/configuration.xml b/bsp/renesas/ra6m3-hmi-board/configuration.xml index a3cd1a4f9a..e8a0dd2bbc 100644 --- a/bsp/renesas/ra6m3-hmi-board/configuration.xml +++ b/bsp/renesas/ra6m3-hmi-board/configuration.xml @@ -540,7 +540,7 @@ </module> <module id="module.driver.display_on_glcdc.467730287"> <property id="module.driver.display.name" value="g_display0"/> - <property id="module.driver.display.callback" value="_ra_port_display_callback"/> + <property id="module.driver.display.callback" value="DisplayVsyncCallback"/> <property id="module.driver.display.line_detect_ipl" value="board.icu.common.irq.priority12"/> <property id="module.driver.display.underflow_1_ipl" value="_disabled"/> <property id="module.driver.display.underflow_2_ipl" value="_disabled"/> @@ -952,6 +952,9 @@ <configSetting altId="glcdc0.lcd_data13.p301" configurationId="glcdc0.lcd_data13"/> <configSetting altId="glcdc0.lcd_data14.p302" configurationId="glcdc0.lcd_data14"/> <configSetting altId="glcdc0.lcd_data15.p303" configurationId="glcdc0.lcd_data15"/> + <configSetting altId="glcdc0.lcd_tcon0.p102" configurationId="glcdc0.lcd_tcon0"/> + <configSetting altId="glcdc0.lcd_tcon1.p103" configurationId="glcdc0.lcd_tcon1"/> + <configSetting altId="glcdc0.lcd_tcon2.p104" configurationId="glcdc0.lcd_tcon2"/> <configSetting altId="glcdc0.mode.rgb565.free" configurationId="glcdc0.mode"/> <configSetting altId="gpt0.gtioca.p512" configurationId="gpt0.gtioca"/> <configSetting altId="gpt0.mode.gtiocaorgtiocb.free" configurationId="gpt0.mode"/> @@ -983,6 +986,15 @@ <configSetting altId="p101.glcdc0.lcd_clk" configurationId="p101"/> <configSetting altId="p101.gpio_speed.gpio_speed_high" configurationId="p101.gpio_drivecapacity"/> <configSetting altId="p101.gpio_mode.gpio_mode_peripheral" configurationId="p101.gpio_mode"/> + <configSetting altId="p102.glcdc0.lcd_tcon0" configurationId="p102"/> + <configSetting altId="p102.gpio_speed.gpio_speed_high" configurationId="p102.gpio_drivecapacity"/> + <configSetting altId="p102.gpio_mode.gpio_mode_peripheral" configurationId="p102.gpio_mode"/> + <configSetting altId="p103.glcdc0.lcd_tcon1" configurationId="p103"/> + <configSetting altId="p103.gpio_speed.gpio_speed_high" configurationId="p103.gpio_drivecapacity"/> + <configSetting altId="p103.gpio_mode.gpio_mode_peripheral" configurationId="p103.gpio_mode"/> + <configSetting altId="p104.glcdc0.lcd_tcon2" configurationId="p104"/> + <configSetting altId="p104.gpio_speed.gpio_speed_high" configurationId="p104.gpio_drivecapacity"/> + <configSetting altId="p104.gpio_mode.gpio_mode_peripheral" configurationId="p104.gpio_mode"/> <configSetting altId="p106.glcdc0.lcd_data00" configurationId="p106"/> <configSetting altId="p106.gpio_speed.gpio_speed_high" configurationId="p106.gpio_drivecapacity"/> <configSetting altId="p106.gpio_mode.gpio_mode_peripheral" configurationId="p106.gpio_mode"/> |
