Skip to content

Commit 1a6e58e

Browse files
committed
将文档放到RTduino文档中心
1 parent dcb5523 commit 1a6e58e

11 files changed

+2
-91
lines changed

README.md

Lines changed: 2 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,5 @@
11
# pinout-generator
22

3-
pinout-generator是为了方便用户将BSP对接到[RTduino](https://github.com/RTduino/RTduino)上而设计的一个自动化源文件生成工具。下面以 [stm32f103-blue-pill](https://github.com/RT-Thread/rt-thread/tree/master/bsp/stm32/stm32f103-blue-pill/applications/arduino_pinout) 为例,展示如何使用本软件,并将该BSP对接到RTduino上。
3+
使用教程:
44

5-
## 1 如何使用软件
6-
7-
### 1.1 创建工程项目
8-
9-
打开软件,进入**项目配置**页面。根据本次示例板卡,配置信息如下图。
10-
11-
![image-20231221191345958](figures/image-20231221191345958.png)
12-
13-
> 注意
14-
>
15-
> 完成项目配置后,请点击**保存配置**
16-
17-
### 1.2 进入引脚配置
18-
19-
stm32f103-blue-pill的引脚分配图如下:
20-
21-
![blue-pill-f103-pinout](figures/blue-pill-f103-pinout.jpg)
22-
23-
根据引脚分配图填写引脚配置。在空白页**右键菜单**唤起菜单项进行引脚添加或其他。
24-
25-
![image-20231221192548974](figures/image-20231221192548974.png)
26-
27-
针对本次stm32f103-blue-pill,完成引脚配置如下:
28-
29-
![image-20231221192719207](figures/image-20231221192719207.png)
30-
31-
### 1.3 进行功能配置
32-
33-
首先,了解一下各选项的一个含义:
34-
35-
- Serial2:除了RTduino终端串口另外支持的串口。
36-
- Serial3:除了RTduino终端串口另外支持的串口。
37-
- Timer:RTduino需要的默认定时器。
38-
- SPI设备名称:RTduino需要的默认SPI设备。
39-
- SPI-SS:SPI设备的SS(片选)引脚的编号。
40-
- LED引脚:RTduino默认的LED灯引脚。
41-
- I2C设备名称:RTduino需要的默认I2C设备。
42-
- 示例程序:RTduino对接Demo程序。
43-
- 循环打印<Hello!Arduino>。
44-
- LED灯以一定频率闪烁。
45-
- 作者信息:对接BSP的作者。
46-
- 工作频率:表示BSP工作的主频,是必填项。
47-
- PWM转SPI配置:部分BSP因为资源受限,可能会将已经对接的PWM设备引脚用作SPI的引脚,但是这里生成的代码仅仅只是一个框架,仍需用户**自行补充**(具体操作见下文)。
48-
49-
根据bsp需求,具体配置信息如下:
50-
51-
![image-20231221193651531](figures/image-20231221193651531.png)
52-
53-
### 1.4 生成代码
54-
55-
截至到这,已经完成了基本的对接配置工作,可以生成对应的工程了。
56-
57-
![image-20231221193952983](figures/image-20231221193952983.png)
58-
59-
这里对生成的文件进行一个简单的介绍:
60-
61-
- arduino_pinout
62-
- pins_arduino.c:保存了RT-Thread引脚和RTduino引脚的对应关系。
63-
- pins_arduino.h:保存了RTduino功能配置相关宏定义。
64-
- README.md:说明文档。
65-
- SConscript:RT-Thread工程构建脚本。
66-
- stm32f103-blue-pill-pinout.jpg:引脚分配图。
67-
- arduino_main.cpp:RTduino示例代码。
68-
- Kconfig.demo:menuconfig相关代码,这里需要**简单移植**(具体操作见下文)。
69-
- SConscript:RT-Thread工程构建脚本。
70-
- stm32f103-blue-pill.rdpg:pinout-generator的工程文件,用户可双击打开。
71-
72-
### 1.5 用户需自行修改
73-
74-
#### Kconfig移植
75-
76-
`Kconfig.demo`里卖的`Onboard Peripheral Drivers``On-chip Peripheral Drivers`的内容拷贝至bsp的board文件夹中的Kconfig文件(bsp/stm32/stm32f103-blue-pill/board/Kconfig),下图为`Onboard Peripheral Drivers`内容的拷贝示例。
77-
78-
![image-20231221222553471](figures/image-20231221222553471.png)
79-
80-
#### PWM转SPI代码移植(非必要,不支持可跳过此章节)
81-
82-
本bsp是不用支持这个选项的,但是这里为了演示该部分如何实现,这里我们配置pwm转spi的spi设备为`spi1`来进行一个本章节的简要介绍。
83-
84-
![image-20231221224018047](figures/image-20231221224018047.png)
85-
86-
![image-20231221224434767](figures/image-20231221224434767.png)
87-
88-
> 注意:
89-
>
90-
> 这次只是单纯使用CubeMX生成跟SPI引脚初始化有关的代码,生成完代码后,建议重新恢复CubeMX工程。
91-
92-
当选择了pwm转spi后,`pins_arduino.c`文件会生成如下代码,根据注释补充完整即可。补充完整请自行删除`#error`编译报警。
93-
94-
![image-20231221232940946](figures/image-20231221232940946.png)
5+
- [STM32对接RTduino](https://rtduino.github.io/RTduino/#/zh/contribute/adapt/bsp/stm32/stm32?id=_4-pinout-generator%e5%b7%a5%e5%85%b7)

figures/blue-pill-f103-pinout.jpg

-1.04 MB
Binary file not shown.
-44.9 KB
Binary file not shown.
-57.1 KB
Binary file not shown.
-73.1 KB
Binary file not shown.
-46.9 KB
Binary file not shown.
-113 KB
Binary file not shown.
-564 KB
Binary file not shown.
-453 KB
Binary file not shown.
-459 KB
Binary file not shown.

0 commit comments

Comments
 (0)