summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxiaofan <[email protected]>2023-12-14 16:53:39 -0600
committerMeco Man <[email protected]>2023-12-16 19:23:10 +0800
commit8dee48fdaa815cd931b9a069948c89cd65370d1f (patch)
tree2089fa9f0d749301608c58910f82bcfd599ff116
parent2c1209db21e2ddad135d5a2d63e026e915e8498f (diff)
ch32_drivers: call rt_hw_pin_init explicitly
Signed-off-by: xiaofan <[email protected]>
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c1
-rw-r--r--bsp/wch/risc-v/ch32v103r-evt/board/board.c5
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/board/board.c5
-rw-r--r--bsp/wch/risc-v/ch32v307v-r1/board/board.c5
4 files changed, 15 insertions, 1 deletions
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c
index 02ba1f92c2..a03d0f563d 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c
@@ -576,6 +576,5 @@ int rt_hw_pin_init(void)
return rt_device_pin_register("pin", &_ch32_pin_ops, RT_NULL);
}
-INIT_BOARD_EXPORT(rt_hw_pin_init);
#endif /* BSP_USING_GPIO */
diff --git a/bsp/wch/risc-v/ch32v103r-evt/board/board.c b/bsp/wch/risc-v/ch32v103r-evt/board/board.c
index 50b95a7576..ffc26ea661 100644
--- a/bsp/wch/risc-v/ch32v103r-evt/board/board.c
+++ b/bsp/wch/risc-v/ch32v103r-evt/board/board.c
@@ -13,6 +13,7 @@
#include <stdint.h>
#include "drv_usart.h"
+#include "drv_gpio.h"
#include <rthw.h>
#include <rtthread.h>
@@ -75,6 +76,10 @@ void rt_hw_board_init()
/* System Tick Configuration, systick clock is HCLK/8 */
_SysTick_Config(SystemCoreClock / 8 / RT_TICK_PER_SECOND);
/* Call components board initial (use INIT_BOARD_EXPORT()) */
+#ifdef RT_USING_PIN
+ /* pin must initialized before i2c */
+ rt_hw_pin_init();
+#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
diff --git a/bsp/wch/risc-v/ch32v208w-r0/board/board.c b/bsp/wch/risc-v/ch32v208w-r0/board/board.c
index 03f33e6c4b..39dacaf049 100644
--- a/bsp/wch/risc-v/ch32v208w-r0/board/board.c
+++ b/bsp/wch/risc-v/ch32v208w-r0/board/board.c
@@ -11,6 +11,7 @@
#include "board.h"
#include <stdint.h>
#include "drv_usart.h"
+#include "drv_gpio.h"
#include <rthw.h>
#include <rtthread.h>
@@ -62,6 +63,10 @@ void rt_hw_board_init()
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
+#ifdef RT_USING_PIN
+ /* pin must initialized before i2c */
+ rt_hw_pin_init();
+#endif
/* Call components board initial (use INIT_BOARD_EXPORT()) */
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
diff --git a/bsp/wch/risc-v/ch32v307v-r1/board/board.c b/bsp/wch/risc-v/ch32v307v-r1/board/board.c
index 0c74613730..3f949af488 100644
--- a/bsp/wch/risc-v/ch32v307v-r1/board/board.c
+++ b/bsp/wch/risc-v/ch32v307v-r1/board/board.c
@@ -11,6 +11,7 @@
#include "board.h"
#include <stdint.h>
#include "drv_usart.h"
+#include "drv_gpio.h"
#include <rthw.h>
#include <rtthread.h>
@@ -48,6 +49,10 @@ void rt_hw_board_init()
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
+#ifdef RT_USING_PIN
+ /* pin must initialized before i2c */
+ rt_hw_pin_init();
+#endif
/* Call components board initial (use INIT_BOARD_EXPORT()) */
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();