Skip to content

Commit 6967362

Browse files
committed
docs: 增加PWM互补输出参数说明,补充模块实例参数传递示例
1 parent 577b504 commit 6967362

File tree

4 files changed

+60
-2
lines changed

4 files changed

+60
-2
lines changed

docs/code_gen/stm32/pwm.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ sidebar_position: 6
1010

1111
## 示例
1212

13+
第三个参数为`true`时,使用此定时器通道的互补输出。
14+
1315
```cpp
14-
STM32PWM pwm_timX_chX(&htimX, TIM_CHANNEL_1);
16+
STM32PWM pwm_timX_chX(&htimX, TIM_CHANNEL_X, false);
1517
```

docs/proj_man/add_mod.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,33 @@ xrobot_add_mod BlinkLED --instance-id myled
9393

9494
---
9595

96+
## 4. 将别的模块实例作为参数
97+
98+
你可以将别的模块实例作为参数传递给模块:
99+
100+
```yaml
101+
modules:
102+
- id: BlinkLED_0
103+
name: BlinkLED
104+
constructor_args:
105+
blink_cycle: 250
106+
- id: TestModule_0
107+
name: TestModule
108+
constructor_args:
109+
test_arg5: '@BlinkLED_0'
110+
```
111+
112+
会生成以下代码:
113+
114+
```cpp
115+
static BlinkLED BlinkLED_0(hw, appmgr, 250);
116+
static TestModule TestModule_0(hw, appmgr, BlinkLED_0);
117+
```
118+
119+
还支持`'@obj->GetMember()'`或`'@obj.member'`这样的语法,用于访问别的模块实例的成员。
120+
121+
---
122+
96123
## 5. 配置文件位置说明
97124

98125
| 配置类型 | 默认路径 | 内容 |

i18n/en/docusaurus-plugin-content-docs/current/code_gen/stm32/pwm.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ The code generation tool will parse all timer channels configured for PWM output
1010

1111
## Example
1212

13+
When the third parameter is set to `true`, the complementary output of this timer channel is used.
14+
1315
```cpp
14-
STM32PWM pwm_timX_chX(&htimX, TIM_CHANNEL_1);
16+
STM32PWM pwm_timX_chX(&htimX, TIM_CHANNEL_X, false);
1517
```

i18n/en/docusaurus-plugin-content-docs/current/proj_man/add_mod.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,33 @@ xrobot_add_mod BlinkLED --instance-id myled
9393

9494
---
9595

96+
## 4. Passing Other Module Instances as Arguments
97+
98+
You can pass other module instances as arguments to a module:
99+
100+
```yaml
101+
modules:
102+
- id: BlinkLED_0
103+
name: BlinkLED
104+
constructor_args:
105+
blink_cycle: 250
106+
- id: TestModule_0
107+
name: TestModule
108+
constructor_args:
109+
test_arg5: '@BlinkLED_0'
110+
```
111+
112+
The following code will be generated:
113+
114+
```cpp
115+
static BlinkLED BlinkLED_0(hw, appmgr, 250);
116+
static TestModule TestModule_0(hw, appmgr, BlinkLED_0);
117+
```
118+
119+
The syntax`'@obj->GetMember()'` or `'@obj.member'`is also supported, allowing access to members of other module instances.
120+
121+
---
122+
96123
## 5. Configuration File Locations
97124

98125
| Config Type | Default Path | Description |

0 commit comments

Comments
 (0)