Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
职场007
rt-thread
提交
7c6c12cb
R
rt-thread
项目概览
职场007
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
7c6c12cb
编写于
2月 09, 2023
作者:
Y
Yaochenger
提交者:
GitHub
2月 08, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[RTduino][ch32v208w-r0]ch32v208w-r0适配RTduino (#6917)
上级
20459ec4
变更
63
隐藏空白更改
内联
并排
Showing
63 changed file
with
403 addition
and
72 deletion
+403
-72
bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.c
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.h
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.c
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.h
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.c
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.h
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.h
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.c
+17
-3
bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.h
+6
-2
bsp/wch/risc-v/Libraries/ch32_drivers/drv_iwdt.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_iwdt.c
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_log.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_log.h
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.c
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.h
+6
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.c
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.h
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.c
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.h
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.c
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.h
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.c
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.h
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.c
bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.c
+1
-1
bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.h
bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.h
+1
-1
bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_eth.c
...ies/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_eth.c
+1
-1
bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_fsmc.c
...es/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_fsmc.c
+1
-1
bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_rng.c
...ies/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_rng.c
+1
-1
bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_sdio.c
...es/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_sdio.c
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.c
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.c
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.h
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.h
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.c
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.c
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.h
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.h
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.c
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.c
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.h
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.h
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.c
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.c
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.h
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.h
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.c
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.c
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.h
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.h
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.c
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.c
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.h
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.h
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.c
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.c
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.h
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.h
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbd.c
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbd.c
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbhs.h
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbhs.h
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_wdt.c
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_wdt.c
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/isr_sp.h
bsp/wch/risc-v/Libraries/ch56x_drivers/isr_sp.h
+1
-1
bsp/wch/risc-v/Libraries/ch56x_drivers/soc.h
bsp/wch/risc-v/Libraries/ch56x_drivers/soc.h
+1
-1
bsp/wch/risc-v/ch32v208w-r0/.config
bsp/wch/risc-v/ch32v208w-r0/.config
+63
-13
bsp/wch/risc-v/ch32v208w-r0/SConstruct
bsp/wch/risc-v/ch32v208w-r0/SConstruct
+1
-0
bsp/wch/risc-v/ch32v208w-r0/applications/SConscript
bsp/wch/risc-v/ch32v208w-r0/applications/SConscript
+5
-2
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_main.cpp
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_main.cpp
+28
-0
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/README.md
...risc-v/ch32v208w-r0/applications/arduino_pinout/README.md
+63
-0
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/Sconscript
...isc-v/ch32v208w-r0/applications/arduino_pinout/Sconscript
+9
-0
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/ch32v208w-pinout.png
...v208w-r0/applications/arduino_pinout/ch32v208w-pinout.png
+0
-0
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.c
...v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.c
+46
-0
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.h
...v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.h
+43
-0
bsp/wch/risc-v/ch32v208w-r0/applications/main.c
bsp/wch/risc-v/ch32v208w-r0/applications/main.c
+1
-1
bsp/wch/risc-v/ch32v208w-r0/board/Kconfig
bsp/wch/risc-v/ch32v208w-r0/board/Kconfig
+27
-0
bsp/wch/risc-v/ch32v208w-r0/board/board.c
bsp/wch/risc-v/ch32v208w-r0/board/board.c
+1
-1
bsp/wch/risc-v/ch32v208w-r0/board/board.h
bsp/wch/risc-v/ch32v208w-r0/board/board.h
+4
-1
bsp/wch/risc-v/ch32v208w-r0/board/linker_scripts/link.lds
bsp/wch/risc-v/ch32v208w-r0/board/linker_scripts/link.lds
+8
-0
bsp/wch/risc-v/ch32v208w-r0/rtconfig.h
bsp/wch/risc-v/ch32v208w-r0/rtconfig.h
+31
-2
bsp/wch/risc-v/ch32v208w-r0/rtconfig.py
bsp/wch/risc-v/ch32v208w-r0/rtconfig.py
+0
-2
未找到文件。
bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
@@ -144,8 +144,15 @@ static void ch32_hwtimer_init(struct rt_hwtimer_device *timer, rt_uint32_t state
tim
=
(
TIM_HandleTypeDef
*
)
timer
->
parent
.
user_data
;
tim_device
=
(
struct
ch32_hwtimer
*
)
timer
;
#if defined (SOC_RISCV_SERIES_CH32V2)
if
(
tim
->
instance
==
TIM1
)
#elif defined(SOC_RISCV_SERIES_CH32V3)
if
(
tim
->
instance
==
TIM1
||
tim
->
instance
==
TIM8
||
tim
->
instance
==
TIM9
||
tim
->
instance
==
TIM10
)
#else
#error " unsupported CH32 series! "
if
(
RT_NULL
)
#endif
{
RCC_APB2PeriphClockCmd
(
tim
->
rcc
,
ENABLE
);
prescaler_value
=
(
RCC_ClockStruct
.
PCLK2_Frequency
*
pclk2_doubler
/
10000
)
-
1
;
...
...
@@ -168,13 +175,13 @@ static void ch32_hwtimer_init(struct rt_hwtimer_device *timer, rt_uint32_t state
{
tim
->
init
.
TIM_CounterMode
=
TIM_CounterMode_Down
;
}
#if defined (SOC_RISCV_SERIES_CH32V3)
/* TIM6 and TIM7 only support counter up mode */
if
(
tim
->
instance
==
TIM6
||
tim
->
instance
==
TIM7
)
{
tim
->
init
.
TIM_CounterMode
=
TIM_CounterMode_Up
;
}
#endif
TIM_TimeBaseInit
(
tim
->
instance
,
&
tim
->
init
);
NVIC_InitStruct
.
NVIC_IRQChannel
=
tim_device
->
irqn
;
...
...
@@ -266,8 +273,15 @@ static rt_err_t ch32_hwtimer_control(struct rt_hwtimer_device *timer, rt_uint32_
ch32_get_pclk_doubler
(
&
pclk1_doubler
,
&
pclk2_doubler
);
RCC_GetClocksFreq
(
&
RCC_ClockStruct
);
#if defined (SOC_RISCV_SERIES_CH32V2)
if
(
tim
->
instance
==
TIM1
)
#elif defined(SOC_RISCV_SERIES_CH32V3)
if
(
tim
->
instance
==
TIM1
||
tim
->
instance
==
TIM8
||
tim
->
instance
==
TIM9
||
tim
->
instance
==
TIM10
)
#else
#error " unsupported CH32 series! "
if
(
RT_NULL
)
#endif
{
val
=
RCC_ClockStruct
.
PCLK2_Frequency
*
pclk2_doubler
/
freq
;
}
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
@@ -12,8 +12,12 @@
#define __DRV_HWTIMER_H__
#include <rtthread.h>
#if defined(SOC_RISCV_SERIES_CH32V3)
#include "ch32v30x_tim.h"
#endif
#if defined(SOC_RISCV_SERIES_CH32V2)
#include "ch32v20x_tim.h"
#endif
#ifdef BSP_USING_HWTIMER
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_iwdt.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_log.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
@@ -13,7 +13,12 @@
#include <rtthread.h>
#ifdef BSP_USING_PWM
#if defined(SOC_RISCV_SERIES_CH32V3)
#include "ch32v30x_tim.h"
#endif
#if defined(SOC_RISCV_SERIES_CH32V2)
#include "ch32v20x_tim.h"
#endif
#include <drivers/rt_drv_pwm.h>
#include <drivers/hwtimer.h>
#include <board.h>
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_eth.c
浏览文件 @
7c6c12cb
...
...
@@ -1432,7 +1432,7 @@ ITStatus ETH_GetDMAITStatus(uint32_t ETH_DMA_IT)
/*********************************************************************
* @fn ETH_DMAClearITPendingBit
*
* @brief Clears the ETHERNETs DMA IT pending bit.
* @brief Clears the ETHERNET
'
s DMA IT pending bit.
*
* @param ETH_DMA_IT - specifies the interrupt pending bit to clear.
* ETH_DMA_IT_NIS - Normal interrupt summary
...
...
bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_fsmc.c
浏览文件 @
7c6c12cb
...
...
@@ -249,7 +249,7 @@ void FSMC_NANDStructInit(FSMC_NANDInitTypeDef *FSMC_NANDInitStruct)
* FSMC_Bank1_NORSRAM2 - FSMC Bank1 NOR/SRAM2
* FSMC_Bank1_NORSRAM3 - FSMC Bank1 NOR/SRAM3
* FSMC_Bank1_NORSRAM4 - FSMC Bank1 NOR/SRAM4
* NewStateENABLE or DISABLE.
* NewState
£:
ENABLE or DISABLE.
*
* @return none
*/
...
...
bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_rng.c
浏览文件 @
7c6c12cb
...
...
@@ -117,7 +117,7 @@ void RNG_ClearFlag(uint8_t RNG_FLAG)
* RNG_IT_CEI - Clock Error Interrupt.
* RNG_IT_SEI - Seed Error Interrupt.
*
* @return bitstatusSET or RESET.
* @return bitstatus
£:
SET or RESET.
*/
ITStatus
RNG_GetITStatus
(
uint8_t
RNG_IT
)
{
...
...
bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_sdio.c
浏览文件 @
7c6c12cb
...
...
@@ -625,7 +625,7 @@ void SDIO_ClearFlag(uint32_t SDIO_FLAG)
* SDIO_IT_SDIOIT - SD I/O interrupt received interrupt
* SDIO_IT_CEATAEND - CE-ATA command completion signal received for CMD61 interrupt
*
* @return ITStatusSET or RESET
* @return ITStatus
£:
SET or RESET
*/
ITStatus
SDIO_GetITStatus
(
uint32_t
SDIO_IT
)
{
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbd.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbhs.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_wdt.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/isr_sp.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/Libraries/ch56x_drivers/soc.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/ch32v208w-r0/.config
浏览文件 @
7c6c12cb
...
...
@@ -47,6 +47,7 @@ CONFIG_RT_USING_MESSAGEQUEUE=y
#
# Memory Management
#
CONFIG_RT_PAGE_MAX_ORDER
=
11
# CONFIG_RT_USING_MEMPOOL is not set
CONFIG_RT_USING_SMALL_MEM
=
y
# CONFIG_RT_USING_SLAB is not set
...
...
@@ -115,17 +116,20 @@ CONFIG_RT_USING_SERIAL_V1=y
# CONFIG_RT_SERIAL_USING_DMA is not set
CONFIG_RT_SERIAL_RB_BUFSZ
=
64
# CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set
CONFIG_RT_USING_HWTIMER
=
y
# CONFIG_RT_USING_CPUTIME is not set
# CONFIG_RT_USING_I2C is not set
CONFIG_RT_USING_I2C
=
y
# CONFIG_RT_I2C_DEBUG is not set
CONFIG_RT_USING_I2C_BITOPS
=
y
# CONFIG_RT_I2C_BITOPS_DEBUG is not set
# CONFIG_RT_USING_PHY is not set
CONFIG_RT_USING_PIN
=
y
# CONFIG_RT_USING_ADC is not set
CONFIG_RT_USING_ADC
=
y
# CONFIG_RT_USING_DAC is not set
# CONFIG_RT_USING_NULL is not set
# CONFIG_RT_USING_ZERO is not set
# CONFIG_RT_USING_RANDOM is not set
# CONFIG_RT_USING_PWM is not set
CONFIG_RT_USING_PWM
=
y
# CONFIG_RT_USING_MTD_NOR is not set
# CONFIG_RT_USING_MTD_NAND is not set
# CONFIG_RT_USING_PM is not set
...
...
@@ -177,7 +181,8 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
#
# Socket is in the 'Network' category
#
# CONFIG_RT_USING_CPLUSPLUS is not set
CONFIG_RT_USING_CPLUSPLUS
=
y
# CONFIG_RT_USING_CPLUSPLUS11 is not set
#
# Network
...
...
@@ -194,6 +199,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_RT_USING_ULOG is not set
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
# CONFIG_RT_USING_ADT is not set
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set
...
...
@@ -739,7 +745,20 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
#
# Arduino libraries
#
# CONFIG_PKG_USING_RTDUINO is not set
CONFIG_PKG_USING_RTDUINO
=
y
CONFIG_PKG_RTDUINO_PATH
=
"/packages/arduino/RTduino"
# CONFIG_RTDUINO_NO_SETUP_LOOP is not set
CONFIG_RTDUINO_THREAD_SIZE
=
1536
CONFIG_RTDUINO_THREAD_PRIO
=
30
# CONFIG_RTDUINO_TINY_MODE is not set
# CONFIG_RTDUINO_SUPPORT_FLOAT_STRING is not set
# CONFIG_RTDUINO_USING_WIRE is not set
# CONFIG_RTDUINO_USING_SPI is not set
# CONFIG_RTDUINO_USING_SERVO is not set
# CONFIG_RTDUINO_USING_USBSERIAL is not set
# CONFIG_RTDUINO_USING_SHELL_CMD is not set
CONFIG_PKG_USING_RTDUINO_LATEST_VERSION
=
y
CONFIG_PKG_RTDUINO_VER
=
"latest"
#
# Projects
...
...
@@ -948,6 +967,11 @@ CONFIG_SOC_RISCV_SERIES_CH32V2=y
#
CONFIG_SOC_CH32V208WBU6
=
y
#
# Onboard Peripheral Drivers
#
# CONFIG_BSP_USING_ARDUINO is not set
#
# On-chip Peripheral Drivers
#
...
...
@@ -961,19 +985,45 @@ CONFIG_BSP_USING_UART1=y
# CONFIG_BSP_USING_UART6 is not set
# CONFIG_BSP_USING_UART7 is not set
# CONFIG_BSP_USING_UART8 is not set
# CONFIG_BSP_USING_ADC is not set
CONFIG_BSP_USING_ADC
=
y
CONFIG_BSP_USING_ADC1
=
y
# CONFIG_BSP_USING_ADC2 is not set
# CONFIG_ADC_CHANNEL_16 is not set
# CONFIG_ADC_CHANNEL_17 is not set
# CONFIG_BSP_USING_DAC is not set
# CONFIG_BSP_USING_SOFT_I2C is not set
CONFIG_BSP_USING_SOFT_I2C
=
y
CONFIG_BSP_USING_I2C1
=
y
#
# Notice: PC7 --> 39; PC6 --> 38
#
CONFIG_BSP_I2C1_SCL_PIN
=
38
CONFIG_BSP_I2C1_SDA_PIN
=
39
# CONFIG_BSP_USING_I2C2 is not set
# CONFIG_BSP_USING_SPI is not set
# CONFIG_BSP_USING_RTC is not set
CONFIG_LSI_VALUE
=
40000
# CONFIG_BSP_USING_IWDT is not set
# CONFIG_BSP_USING_CAN is not set
# CONFIG_BSP_USING_TIM is not set
#
# Onboard Peripheral Drivers
#
CONFIG_BSP_USING_TIM
=
y
CONFIG_BSP_USING_HWTIMER
=
y
# CONFIG_BSP_USING_PWM is not set
CONFIG_BSP_USING_TIM1
=
y
CONFIG_BSP_USING_TIM1_HWTIMER
=
y
# CONFIG_BSP_USING_TIM1_PWM is not set
# CONFIG_BSP_USING_TIM2 is not set
CONFIG_BSP_USING_TIM3
=
y
CONFIG_BSP_USING_TIM3_HWTIMER
=
y
# CONFIG_BSP_USING_TIM3_PWM is not set
CONFIG_BSP_USING_TIM4
=
y
CONFIG_BSP_USING_TIM4_HWTIMER
=
y
# CONFIG_BSP_USING_TIM4_PWM is not set
# CONFIG_BSP_USING_TIM5 is not set
# CONFIG_BSP_USING_TIM6 is not set
# CONFIG_BSP_USING_TIM7 is not set
# CONFIG_BSP_USING_TIM8 is not set
# CONFIG_BSP_USING_TIM9 is not set
# CONFIG_BSP_USING_TIM10 is not set
#
# Board extended module Drivers
...
...
bsp/wch/risc-v/ch32v208w-r0/SConstruct
浏览文件 @
7c6c12cb
...
...
@@ -24,6 +24,7 @@ env = Environment(tools = ['mingw'],
AS
=
rtconfig
.
AS
,
ASFLAGS
=
rtconfig
.
AFLAGS
,
CC
=
rtconfig
.
CC
,
CFLAGS
=
rtconfig
.
CFLAGS
,
AR
=
rtconfig
.
AR
,
ARFLAGS
=
'-rc'
,
CXX
=
rtconfig
.
CXX
,
LINK
=
rtconfig
.
LINK
,
LINKFLAGS
=
rtconfig
.
LFLAGS
)
env
.
PrependENVPath
(
'PATH'
,
rtconfig
.
EXEC_PATH
)
...
...
bsp/wch/risc-v/ch32v208w-r0/applications/SConscript
浏览文件 @
7c6c12cb
from
building
import
*
import
os
cwd
=
GetCurrentDir
()
src
=
Glob
(
'*.c'
)
cwd
=
GetCurrentDir
()
CPPPATH
=
[
cwd
]
src
=
Glob
(
'*.c'
)
if
GetDepend
([
'PKG_USING_RTDUINO'
])
and
not
GetDepend
([
'RTDUINO_NO_SETUP_LOOP'
]):
src
+=
[
'arduino_main.cpp'
]
group
=
DefineGroup
(
'Applications'
,
src
,
depend
=
[
''
],
CPPPATH
=
CPPPATH
)
...
...
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_main.cpp
0 → 100644
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-02-08 WangShun first version
*/
#include <Arduino.h>
void
setup
(
void
)
{
/* put your setup code here, to run once: */
pinMode
(
8
,
OUTPUT
);
Serial
.
begin
();
Serial
.
println
(
"Hello Arduino!"
);
}
void
loop
(
void
)
{
/* put your main code here, to run repeatedly: */
digitalWrite
(
8
,
HIGH
);
delay
(
500
);
digitalWrite
(
8
,
LOW
);
delay
(
500
);
}
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/README.md
0 → 100644
浏览文件 @
7c6c12cb
# CH32V208W-R0 开发板的Arduino生态兼容说明
## 1 RTduino - RT-Thread的Arduino生态兼容层
CH32V208W-R0开发板已经完整适配了
[
RTduino软件包
](
https://github.com/RTduino/RTduino
)
,即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见
[
RTduino软件包说明文档
](
https://github.com/RTduino/RTduino
)
。
### 1.1 如何开启针对本BSP的Arduino生态兼容层
Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings:
```
Kconfig
Hardware Drivers Config --->
Onboard Peripheral Drivers --->
[*] Compatible with Arduino Ecosystem (RTduino)
```
## 2 Arduino引脚排布
更多引脚布局相关信息参见
[
pins_arduino.c
](
pins_arduino.c
)
和
[
pins_arduino.h
](
pins_arduino.h
)
。
![
ch32v208w-pinout
](
ch32v208w-pinout.png
)
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| ------------------- | --------- | ---- | ------------------------------------------------------------------------- |
| 0 (D0) | PA9 | 是 | Serial2-TX,默认被RT-Thread的UART设备框架uart1接管 |
| 1 (D1) | PB0 | 是 | Serial2-RX,默认被RT-Thread的UART设备框架uart1接管 |
| 2 (D2) | PB4 | 是 | |
| 3 (D3) | PB6 | 是 | PWM4-CH1,默认被RT-Thread的PWM设备框架pwm4接管 |
| 4 (D4) | PB7 | 是 | PWM4-CH2,默认被RT-Thread的PWM设备框架pwm4接管 |
| 5 (D5) | PB8 | 是 | PWM4-CH3,默认被RT-Thread的PWM设备框架pwm4接管 |
| 6 (D6) | PB9 | 是 | PWM4-CH4,默认被RT-Thread的PWM设备框架pwm4接管 |
| 7 (D7) | PA8 | 否 | PWM1-CH1,默认被RT-Thread的PWM设备框架pwm1接管 |
| 8 (D8) | PB1 | 否 | PWM3-CH4,默认被RT-Thread的PWM设备框架pwm3接管 |
| 9 (D9) | PB0 | 否 | PWM3-CH3,默认被RT-Thread的PWM设备框架pwm3接管 |
| 10 (D10) | PB12 | 是 | |
| 11 (D11) | PB15 | 是 | |
| 12 (D12) | PB14 | 是 | |
| 13 (D13) | PB13 | 是 | |
| 14 (D14) | PB11 | 是 | I2C1-SDA,默认被RT-Thread的I2C设备框架i2c1接管 |
| 15 (D15) | PB10 | 是 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1接管 |
| 16 (A0) | PA0 | 否 | ADC1-CH0,默认被RT-Thread的ADC设备框架adc1接管 |
| 17 (A1) | PA1 | 否 | ADC1-CH1,默认被RT-Thread的ADC设备框架adc1接管 |
| 18 (A2) | PA2 | 否 | ADC1-CH2,默认被RT-Thread的ADC设备框架adc1接管 |
| 19 (A3) | PA3 | 否 | ADC1-CH3,默认被RT-Thread的ADC设备框架adc1接管 |
| 20 (A4) | PA4 | 否 | ADC1-CH4,默认被RT-Thread的ADC设备框架adc1接管 |
| 21 (A5) | PA5 | 否 | ADC1-CH5,默认被RT-Thread的ADC设备框架adc1接管 |
> 注意:
>
> 1. 驱动舵机和analogWrite函数要选择不同定时器发生的PWM信号引脚,由于硬件定时器4个通道需要保持相同的频率,如果采用相同的定时器发生的PWM分别驱动舵机和analogWrite,可能会导致舵机失效
## 3 通信
### 3.1 I2C总线
CH32V208W-R0 开发板的I2C总线是板上丝印的
`SCL/D15`
和
`SDA/D14`
引脚,这两个引脚默认是被RT-Thread I2C设备框架接管的,直接引用
`#include <Wire.h>`
(Arduino官方I2C头文件)即可使用。
### 3.2 SPI总线
目前本BSP不支持使用Arduino的SPI功能。
### 3.3 串口
本BSP通过
`Serial.`
方法调用
`uart1`
串口设备。详见
[
例程
](
https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp
)
。
\ No newline at end of file
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/Sconscript
0 → 100644
浏览文件 @
7c6c12cb
from
building
import
*
cwd
=
GetCurrentDir
()
src
=
Glob
(
'*.c'
)
+
Glob
(
'*.cpp'
)
inc
=
[
cwd
]
group
=
DefineGroup
(
'RTduino'
,
src
,
depend
=
[
'PKG_USING_RTDUINO'
],
CPPPATH
=
inc
)
Return
(
'group'
)
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/ch32v208w-pinout.png
0 → 100644
浏览文件 @
7c6c12cb
786.0 KB
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.c
0 → 100644
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-02-08 WangShun first version
*/
#include <Arduino.h>
#include <board.h>
#include "pins_arduino.h"
/*
* {Arduino Pin, RT-Thread Pin [, Device Name, Channel]}
* [] means optional
* Digital pins must NOT give the device name and channel.
* Analog pins MUST give the device name and channel(ADC, PWM or DAC).
* Arduino Pin must keep in sequence.
*/
const
pin_map_t
pin_map_table
[]
=
{
{
D0
,
GET_PIN
(
A
,
9
),
"uart1"
},
/* Serial1-TX */
{
D1
,
GET_PIN
(
A
,
10
),
"uart1"
},
/* Serial1-RX */
{
D2
,
GET_PIN
(
B
,
4
)},
{
D3
,
GET_PIN
(
B
,
6
),
"pwm4"
,
1
},
/* PWM */
{
D4
,
GET_PIN
(
B
,
7
),
"pwm4"
,
2
},
/* PWM */
{
D5
,
GET_PIN
(
B
,
8
),
"pwm4"
,
3
},
/* PWM */
{
D6
,
GET_PIN
(
B
,
9
),
"pwm4"
,
4
},
/* PWM */
{
D7
,
GET_PIN
(
A
,
8
),
"pwm1"
,
1
},
/* PWM */
{
D8
,
GET_PIN
(
B
,
1
),
"pwm3"
,
4
},
/* PWM */
{
D9
,
GET_PIN
(
B
,
0
),
"pwm3"
,
3
},
/* PWM */
{
D10
,
GET_PIN
(
B
,
12
)},
{
D11
,
GET_PIN
(
B
,
15
)},
{
D12
,
GET_PIN
(
B
,
14
)},
{
D13
,
GET_PIN
(
B
,
13
)},
{
D14
,
GET_PIN
(
B
,
11
),
"i2c1"
},
/* I2C-SDA (Wire) */
{
D15
,
GET_PIN
(
B
,
10
),
"i2c1"
},
/* I2C-SCL (Wire) */
{
A0
,
GET_PIN
(
A
,
0
),
"adc1"
,
0
},
/* ADC */
{
A1
,
GET_PIN
(
A
,
1
),
"adc1"
,
1
},
/* ADC */
{
A2
,
GET_PIN
(
A
,
2
),
"adc1"
,
2
},
/* ADC */
{
A3
,
GET_PIN
(
A
,
3
),
"adc1"
,
3
},
/* ADC */
{
A4
,
GET_PIN
(
A
,
4
),
"adc1"
,
4
},
/* ADC */
{
A5
,
GET_PIN
(
A
,
5
),
"adc1"
,
5
},
/* ADC */
};
bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.h
0 → 100644
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-02-08 WangShun first version
*/
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
/* pins alias. Must keep in sequence */
#define D0 (0)
#define D1 (1)
#define D2 (2)
#define D3 (3)
#define D4 (4)
#define D5 (5)
#define D6 (6)
#define D7 (7)
#define D8 (8)
#define D9 (9)
#define D10 (10)
#define D11 (11)
#define D12 (12)
#define D13 (13)
#define D14 (14)
#define D15 (15)
#define A0 (16)
#define A1 (17)
#define A2 (18)
#define A3 (19)
#define A4 (20)
#define A5 (21)
#define F_CPU 144000000L
/* CPU:144MHz */
/* Serial1 : PA9-TX PB0-RX */
#define RTDUINO_SERIAL2_DEVICE_NAME "uart1"
#endif
/* Pins_Arduino_h */
bsp/wch/risc-v/ch32v208w-r0/applications/main.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/ch32v208w-r0/board/Kconfig
浏览文件 @
7c6c12cb
...
...
@@ -9,6 +9,33 @@ config SOC_CH32V208WBU6
menu "Onboard Peripheral Drivers"
config BSP_USING_ARDUINO
bool "Compatible with Arduino Ecosystem (RTduino)"
select PKG_USING_RTDUINO
select BSP_USING_GPIO
select BSP_USING_ADC
select BSP_USING_ADC1
select BSP_USING_TIM
select BSP_USING_PWM
select BSP_USING_TIM1
select BSP_USING_TIM1_PWM
select BSP_USING_TIM1_PWM_CH1
select BSP_USING_TIM3
select BSP_USING_TIM3_PWM
select BSP_USING_TIM3_PWM_CH3
select BSP_USING_TIM3_PWM_CH4
select BSP_USING_TIM4
select BSP_USING_TIM4_PWM
select BSP_USING_TIM4_PWM_CH1
select BSP_USING_TIM4_PWM_CH2
select BSP_USING_TIM4_PWM_CH3
select BSP_USING_TIM4_PWM_CH4
select BSP_USING_SOFT_I2C
select BSP_USING_I2C1
imply RTDUINO_USING_SERVO
imply RTDUINO_USING_WIRE
default n
endmenu
menu "On-chip Peripheral Drivers"
...
...
bsp/wch/risc-v/ch32v208w-r0/board/board.c
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
bsp/wch/risc-v/ch32v208w-r0/board/board.h
浏览文件 @
7c6c12cb
/*
* Copyright (c) 2006-202
2
, RT-Thread Development Team
* Copyright (c) 2006-202
3
, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
...
...
@@ -12,7 +12,10 @@
#ifndef __BOARD_H__
#define __BOARD_H__
#include <rtthread.h>
#include "ch32v20x.h"
#include "drv_gpio.h"
#include "drv_pwm.h"
#define ch32v20x_PIN_NUMBERS 64
/* board configuration */
...
...
bsp/wch/risc-v/ch32v208w-r0/board/linker_scripts/link.lds
浏览文件 @
7c6c12cb
...
...
@@ -66,6 +66,14 @@ SECTIONS
__rtmsymtab_end = .;
. = ALIGN(4);
PROVIDE(__ctors_start__ = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE(__ctors_end__ = .);
. = ALIGN(4);
_etext = .;
} >FLASH AT>FLASH
.fini :
...
...
bsp/wch/risc-v/ch32v208w-r0/rtconfig.h
浏览文件 @
7c6c12cb
...
...
@@ -33,6 +33,7 @@
/* Memory Management */
#define RT_PAGE_MAX_ORDER 11
#define RT_USING_SMALL_MEM
#define RT_USING_SMALL_MEM_AS_HEAP
#define RT_USING_HEAP
...
...
@@ -73,7 +74,12 @@
#define RT_USING_SERIAL
#define RT_USING_SERIAL_V1
#define RT_SERIAL_RB_BUFSZ 64
#define RT_USING_HWTIMER
#define RT_USING_I2C
#define RT_USING_I2C_BITOPS
#define RT_USING_PIN
#define RT_USING_ADC
#define RT_USING_PWM
/* Using USB */
...
...
@@ -90,6 +96,7 @@
/* Socket is in the 'Network' category */
#define RT_USING_CPLUSPLUS
/* Network */
...
...
@@ -184,6 +191,10 @@
/* Arduino libraries */
#define PKG_USING_RTDUINO
#define RTDUINO_THREAD_SIZE 1536
#define RTDUINO_THREAD_PRIO 30
#define PKG_USING_RTDUINO_LATEST_VERSION
/* Projects */
...
...
@@ -222,14 +233,32 @@
#define SOC_CH32V208WBU6
/* Onboard Peripheral Drivers */
/* On-chip Peripheral Drivers */
#define BSP_USING_GPIO
#define BSP_USING_UART
#define BSP_USING_UART1
#define LSI_VALUE 40000
#define BSP_USING_ADC
#define BSP_USING_ADC1
#define BSP_USING_SOFT_I2C
#define BSP_USING_I2C1
/* Onboard Peripheral Drivers */
/* Notice: PC7 --> 39; PC6 --> 38 */
#define BSP_I2C1_SCL_PIN 38
#define BSP_I2C1_SDA_PIN 39
#define LSI_VALUE 40000
#define BSP_USING_TIM
#define BSP_USING_HWTIMER
#define BSP_USING_TIM1
#define BSP_USING_TIM1_HWTIMER
#define BSP_USING_TIM3
#define BSP_USING_TIM3_HWTIMER
#define BSP_USING_TIM4
#define BSP_USING_TIM4_HWTIMER
/* Board extended module Drivers */
...
...
bsp/wch/risc-v/ch32v208w-r0/rtconfig.py
浏览文件 @
7c6c12cb
...
...
@@ -18,8 +18,6 @@ else:
if
os
.
getenv
(
'RTT_EXEC_PATH'
):
EXEC_PATH
=
os
.
getenv
(
'RTT_EXEC_PATH'
)
print
(
EXEC_PATH
)
BUILD
=
'debug'
#BUILD = 'release'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录