diff --git a/bsp/renesas/README.md b/bsp/renesas/README.md index e1881c90fd..e97034442d 100644 --- a/bsp/renesas/README.md +++ b/bsp/renesas/README.md @@ -9,7 +9,8 @@ RA 系列 BSP 目前支持情况如下表所示: | [ra6m4-cpk](ra6m4-cpk) | Renesas 官方 CPK-RA6M4 开发板 | | [ra6m4-iot](ra6m4-iot) | Renesas 官方 IOT-RA6M4 开发板 | | [ra6m3-ek](ra6m3-ek) | Renesas 官方 RA6M3-EK 开发板 | -| **RA2 系列** | | +| [ra6m3-hmi-board](ra6m3-hmi-board) | Renesas 联合 RT-Thread RA6M3-HMI-Board 开发板 | +| **RA2 系列** | | | [ra2l1-cpk](ra2l1-cpk) | Renesas 官方 CPK-RA2L1 开发板 | 可以通过阅读相应 BSP 下的 README 来快速上手,如果想要使用 BSP 更多功能可参考 docs 文件夹下提供的说明文档,如下表所示: diff --git a/bsp/renesas/libraries/HAL_Drivers/drv_common.c b/bsp/renesas/libraries/HAL_Drivers/drv_common.c index 8435932922..9d72becfdc 100644 --- a/bsp/renesas/libraries/HAL_Drivers/drv_common.c +++ b/bsp/renesas/libraries/HAL_Drivers/drv_common.c @@ -20,7 +20,7 @@ #ifdef RT_USING_SERIAL_V2 #include #else - #error "Serial-v1 has been obsoleted, and please select serial-v2 as the default option" + #error "Serial-v1 has been obsoleted, and please select serial-v2 as the default option" #endif #endif diff --git a/bsp/renesas/libraries/HAL_Drivers/drv_eth.c b/bsp/renesas/libraries/HAL_Drivers/drv_eth.c index 747e2beabe..f34cc99614 100644 --- a/bsp/renesas/libraries/HAL_Drivers/drv_eth.c +++ b/bsp/renesas/libraries/HAL_Drivers/drv_eth.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2023, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -52,9 +52,6 @@ struct rt_ra6m3_eth #ifndef PHY_USING_INTERRUPT_MODE rt_timer_t poll_link_timer; #endif - - /* interface address info, hw address */ - rt_uint8_t dev_addr[MAX_ADDR_LEN]; }; static rt_uint8_t *Rx_Buff, *Tx_Buff; @@ -89,7 +86,7 @@ static void dump_hex(const rt_uint8_t *ptr, rt_size_t buflen) extern void phy_reset(void); /* EMAC initialization function */ -static rt_err_t rt_ra6m3_eth_init(rt_device_t dev) +static rt_err_t rt_ra6m3_eth_init(void) { fsp_err_t res; @@ -133,7 +130,7 @@ static rt_err_t rt_ra6m3_eth_control(rt_device_t dev, int cmd, void *args) /* get mac address */ if (args) { - SMEMCPY(args, ra6m3_eth_device.dev_addr, 6); + SMEMCPY(args, g_ether0_ctrl.p_ether_cfg->p_mac_address, 6); } else { @@ -385,16 +382,7 @@ static int rt_hw_ra6m3_eth_init(void) goto __exit; } - /* OUI 00-80-E1 STMICROELECTRONICS. */ - ra6m3_eth_device.dev_addr[0] = 0x00; - ra6m3_eth_device.dev_addr[1] = 0x80; - ra6m3_eth_device.dev_addr[2] = 0xE1; - /* generate MAC addr from 96bit unique ID (only for test). */ - ra6m3_eth_device.dev_addr[3] = (10 + 4); - ra6m3_eth_device.dev_addr[4] = (10 + 2); - ra6m3_eth_device.dev_addr[5] = (10 + 0); - - ra6m3_eth_device.parent.parent.init = rt_ra6m3_eth_init; + ra6m3_eth_device.parent.parent.init = NULL; ra6m3_eth_device.parent.parent.open = rt_ra6m3_eth_open; ra6m3_eth_device.parent.parent.close = rt_ra6m3_eth_close; ra6m3_eth_device.parent.parent.read = rt_ra6m3_eth_read; @@ -405,6 +393,8 @@ static int rt_hw_ra6m3_eth_init(void) ra6m3_eth_device.parent.eth_rx = rt_ra6m3_eth_rx; ra6m3_eth_device.parent.eth_tx = rt_ra6m3_eth_tx; + rt_ra6m3_eth_init(); + /* register eth device */ state = eth_device_init(&(ra6m3_eth_device.parent), "e0"); if (RT_EOK == state) diff --git a/bsp/renesas/libraries/HAL_Drivers/drv_lcd.c b/bsp/renesas/libraries/HAL_Drivers/drv_lcd.c index 7288e3c97d..60a5088a6c 100644 --- a/bsp/renesas/libraries/HAL_Drivers/drv_lcd.c +++ b/bsp/renesas/libraries/HAL_Drivers/drv_lcd.c @@ -32,7 +32,7 @@ struct drv_lcd_device struct drv_lcd_device _lcd; uint16_t screen_rotation; -uint16_t *lcd_current_working_buffer = (uint16_t *)&fb_background[0]; +uint16_t *lcd_current_working_buffer = (uint16_t *) &fb_background[0]; // jpeg and lvgl can only select one __WEAK void _ra_port_display_callback(display_callback_args_t *p_args) @@ -44,6 +44,18 @@ __WEAK void _ra_port_display_callback(display_callback_args_t *p_args) void turn_on_lcd_backlight(void) { +#ifdef BSP_USING_PWM5 +#define LCD_PWM_DEV_NAME "pwm5" +#define LCD_PWM_DEV_CHANNEL 0 + + struct rt_device_pwm *pwm_dev; + + /* turn on the LCD backlight */ + pwm_dev = (struct rt_device_pwm *)rt_device_find(LCD_PWM_DEV_NAME); + /* pwm frequency:100K = 10000ns */ + rt_pwm_set(pwm_dev, LCD_PWM_DEV_CHANNEL, 10000, 7000); + rt_pwm_enable(pwm_dev, LCD_PWM_DEV_CHANNEL); +#endif rt_pin_mode(LCD_BL_PIN, PIN_MODE_OUTPUT); /* LCD_BL */ rt_pin_write(LCD_BL_PIN, PIN_HIGH); } @@ -107,7 +119,7 @@ void ra_bsp_lcd_swap_buffer(void) void bsp_lcd_draw_pixel(uint32_t x, uint32_t y, uint16_t color) { // Verify pixel is within LCD range - if ((x < LCD_WIDTH) && (y < LCD_HEIGHT)) + if ((x <= LCD_WIDTH) && (y <= LCD_HEIGHT)) { switch (screen_rotation) { diff --git a/bsp/renesas/libraries/HAL_Drivers/drv_sdhi.c b/bsp/renesas/libraries/HAL_Drivers/drv_sdhi.c index f00ea82dfa..0919f813ef 100644 --- a/bsp/renesas/libraries/HAL_Drivers/drv_sdhi.c +++ b/bsp/renesas/libraries/HAL_Drivers/drv_sdhi.c @@ -491,7 +491,7 @@ struct rt_mmcsd_host *sdio_host_create(struct ra_sdhi *sdhi_des) ra_sdhi_enable_sdio_irq(host, 1); /* ready to change */ - mmcsd_change(host); +// mmcsd_change(host); return host; } @@ -508,3 +508,8 @@ int rt_hw_sdhi_init(void) return 0; } INIT_DEVICE_EXPORT(rt_hw_sdhi_init); + +void sdcard_change(void) +{ + mmcsd_change(host); +} diff --git a/bsp/renesas/libraries/HAL_Drivers/drv_sdhi.h b/bsp/renesas/libraries/HAL_Drivers/drv_sdhi.h index e65ea5c510..b92cb4561b 100644 --- a/bsp/renesas/libraries/HAL_Drivers/drv_sdhi.h +++ b/bsp/renesas/libraries/HAL_Drivers/drv_sdhi.h @@ -62,4 +62,6 @@ struct ra_sdhi sdmmc_device_t *media_device; }; +extern void sdcard_change(void); + #endif diff --git a/bsp/renesas/ra6m3-hmi-board/.cproject b/bsp/renesas/ra6m3-hmi-board/.cproject index 9e643ab073..d2c6e6484c 100644 --- a/bsp/renesas/ra6m3-hmi-board/.cproject +++ b/bsp/renesas/ra6m3-hmi-board/.cproject @@ -47,20 +47,21 @@