Skip to content

Commit cc56117

Browse files
committed
docs: 统一时间戳/flash接口命名,规范配置字段命名,修正拼写
1 parent 6967362 commit cc56117

File tree

10 files changed

+93
-76
lines changed

10 files changed

+93
-76
lines changed

docs/basic_coding/core/core-def.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ sidebar_position: 1
4040
| `CHECK_ERR` | -6 | 校验失败 |
4141
| `NOT_SUPPORT`| -7 | 功能不支持 |
4242
| `NOT_FOUND` | -8 | 未找到对象 |
43-
| `NO_REPONSE` | -9 | 无响应 |
43+
| `NO_RESPONSE` | -9 | 无响应 |
4444
| `NO_MEM` | -10 | 内存不足 |
4545
| `NO_BUFF` | -11 | 缓冲区不足 |
4646
| `TIMEOUT` | -12 | 操作超时 |

docs/basic_coding/core/core-time.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ sidebar_position: 7
66

77
# 时间戳与时间差
88

9-
本模块定义了微秒级和毫秒级的时间戳类型 `TimestampUS``TimestampMS`,用于表示系统时钟时间,并可计算两个时间点之间的时间差。适用于定时器、延迟控制、性能分析等场景。
9+
本模块定义了微秒级和毫秒级的时间戳类型 `MicrosecondTimestamp``MillisecondTimestamp`,用于表示系统时钟时间,并可计算两个时间点之间的时间差。适用于定时器、延迟控制、性能分析等场景。
1010

11-
## TimestampUS
11+
## MicrosecondTimestamp
1212

1313
```cpp
14-
class TimestampUS {
14+
class MicrosecondTimestamp {
1515
public:
16-
TimestampUS();
17-
TimestampUS(uint64_t microsecond);
16+
MicrosecondTimestamp();
17+
MicrosecondTimestamp(uint64_t microsecond);
1818
operator uint64_t() const;
19-
TimeDiffUS operator-(const TimestampUS &old) const;
19+
Duration operator-(const MicrosecondTimestamp &old) const;
2020
};
2121
```
2222
2323
表示微秒级时间戳,支持隐式转换为 `uint64_t`,可计算时间差。
2424
25-
### TimeDiffUS
25+
### Duration
2626
2727
```cpp
28-
class TimeDiffUS {
28+
class Duration {
2929
public:
30-
TimeDiffUS(uint64_t diff);
30+
Duration(uint64_t diff);
3131
operator uint64_t() const;
3232
double ToSecond() const;
3333
float ToSecondf() const;
@@ -36,37 +36,37 @@ class TimeDiffUS {
3636
};
3737
```
3838

39-
表示两个 `TimestampUS` 之间的差值,单位为微秒。支持以秒/毫秒返回差值。
39+
表示两个 `MicrosecondTimestamp` 之间的差值,单位为微秒。支持以秒/毫秒返回差值。
4040

41-
## TimestampMS
41+
## MillisecondTimestamp
4242

4343
```cpp
44-
class TimestampMS {
44+
class MillisecondTimestamp {
4545
public:
46-
TimestampMS();
47-
TimestampMS(uint32_t millisecond);
46+
MillisecondTimestamp();
47+
MillisecondTimestamp(uint32_t millisecond);
4848
operator uint32_t() const;
49-
TimeDiffMS operator-(TimestampMS &old);
49+
Duration operator-(MillisecondTimestamp &old);
5050
};
5151
```
5252
5353
表示毫秒级时间戳,支持隐式转换为 `uint32_t`,可计算时间差。
5454
55-
### TimeDiffMS
55+
### Duration
5656
5757
```cpp
58-
class TimeDiffMS {
58+
class Duration {
5959
public:
60-
TimeDiffMS(uint32_t diff);
60+
Duration(uint32_t diff);
6161
operator uint32_t() const;
62-
double ToSecond();
63-
float ToSecondf();
62+
double ToSecond() const;
63+
float ToSecondf() const;
6464
uint64_t ToMicrosecond() const;
6565
uint32_t ToMillisecond() const;
6666
};
6767
```
6868

69-
表示两个 `TimestampMS` 之间的差值,单位为毫秒。支持以秒/微秒返回差值。
69+
表示两个 `MillisecondTimestamp` 之间的差值,单位为毫秒。支持以秒/微秒返回差值。
7070

7171
## 溢出处理
7272

docs/basic_coding/driver/flash.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,17 @@ public:
2121
// 写入数据到指定偏移地址
2222
virtual ErrorCode Write(size_t offset, ConstRawData data) = 0;
2323

24-
size_t min_erase_size_; // 最小可擦除块大小(字节)
25-
size_t min_write_size_; // 最小可写入块大小(字节)
26-
RawData flash_area_; // 映射的闪存内存区域
24+
// 读取指定偏移地址的数据
25+
virtual ErrorCode Read(size_t offset, RawData data) = 0;
26+
27+
// 获取最小可擦除块大小
28+
size_t MinEraseSize() const { return min_erase_size_; }
29+
30+
// 获取最小可写入块大小
31+
size_t MinWriteSize() const { return min_write_size_; }
32+
33+
// 获取flash大小
34+
size_t Size() const { return flash_area_.size_; }
2735
};
2836
```
2937

docs/code_gen/stm32/uart.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ terminal_source: usb
6464

6565
# 终端相关配置(可选)
6666
Terminal:
67-
READ_BUFF_SIZE: 32 # 终端读取缓冲区大小
68-
MAX_LINE_SIZE: 32 # 每行最大字符数
69-
MAX_ARG_NUMBER: 5 # 每行最大参数个数
70-
MAX_HISTORY_NUMBER: 5 # 历史命令个数
71-
RunAsThread: true # 是否作为线程运行
72-
ThreadStackDepth: 1024 # 线程栈深度(仅在线程下有效)
73-
ThreadPriority: 3 # 线程优先级(仅在线程下有效)
67+
read_buff_size: 32 # 终端读取缓冲区大小
68+
max_line_size: 32 # 每行最大字符数
69+
max_arg_number: 5 # 每行最大参数个数
70+
max_history_number: 5 # 历史命令个数
71+
run_as_thread: true # 是否作为线程运行
72+
thread_stack_depth: 1024 # 线程栈深度(仅在线程下有效)
73+
thread_priority: 3 # 线程优先级(仅在线程下有效)
7474

7575
# 硬件串口配置
7676
USART:

docs/code_gen/stm32/watchdog.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ iwdg1_thread.Create(reinterpret_cast<LibXR::Watchdog *>(&iwdg1), iwdg1.ThreadFun
4242
IWDG:
4343
iwdg1:
4444
timeout_ms: 1000 # 溢出超时时间(毫秒)
45-
feed_ms: 250 # 喂狗周期(毫秒)
45+
feed_interval_ms: 250 # 喂狗周期(毫秒)
4646
4747
# Watchdog 相关全局配置
4848
Watchdog:
49-
RunAsThread: true # 是否作为线程运行(否则定时任务)
50-
ThreadStackDepth: 1024 # 线程栈深度(仅在线程下有效)
51-
ThreadPriority: 3 # 线程优先级(仅在线程下有效)
52-
FeedInterval: 250 # 定时任务喂狗周期(毫秒,默认250)
49+
run_as_thread: true # 是否作为线程运行(否则定时任务)
50+
feed_interval_ms: 1024 # 线程栈深度(仅在线程下有效)
51+
thread_stack_depth: 3 # 线程优先级(仅在线程下有效)
52+
thread_priority: 250 # 定时任务喂狗周期(毫秒,默认250)
5353
```
5454

5555
> *`RunAsThread: true`,则每个启用的 IWDG 会自动生成线程,线程参数可全局配置。

i18n/en/docusaurus-plugin-content-docs/current/basic_coding/core/core-def.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The `ErrorCode` enum defines a unified error code system used to represent vario
4040
| `CHECK_ERR` | -6 | Validation failed |
4141
| `NOT_SUPPORT` | -7 | Feature not supported |
4242
| `NOT_FOUND` | -8 | Object not found |
43-
| `NO_REPONSE` | -9 | No response |
43+
| `NO_RESPONSE` | -9 | No response |
4444
| `NO_MEM` | -10 | Insufficient memory |
4545
| `NO_BUFF` | -11 | Insufficient buffer |
4646
| `TIMEOUT` | -12 | Operation timeout |

i18n/en/docusaurus-plugin-content-docs/current/basic_coding/core/core-time.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ sidebar_position: 7
66

77
# Timestamps and Time Differences
88

9-
This module defines microsecond- and millisecond-level timestamp types `TimestampUS` and `TimestampMS`, which represent system clock times and can be used to compute the time difference between two points. It is suitable for scenarios such as timers, delay control, and performance analysis.
9+
This module defines microsecond- and millisecond-level timestamp types `MicrosecondTimestamp` and `MillisecondTimestamp`, which represent system clock times and can be used to compute the time difference between two points. It is suitable for scenarios such as timers, delay control, and performance analysis.
1010

11-
## TimestampUS
11+
## MicrosecondTimestamp
1212

1313
```cpp
14-
class TimestampUS {
14+
class MicrosecondTimestamp {
1515
public:
16-
TimestampUS();
17-
TimestampUS(uint64_t microsecond);
16+
MicrosecondTimestamp();
17+
MicrosecondTimestamp(uint64_t microsecond);
1818
operator uint64_t() const;
19-
TimeDiffUS operator-(const TimestampUS &old) const;
19+
Duration operator-(const MicrosecondTimestamp &old) const;
2020
};
2121
```
2222
2323
Represents a microsecond-level timestamp. Supports implicit conversion to `uint64_t` and can be used to compute time differences.
2424
25-
### TimeDiffUS
25+
### Duration
2626
2727
```cpp
28-
class TimeDiffUS {
28+
class Duration {
2929
public:
30-
TimeDiffUS(uint64_t diff);
30+
Duration(uint64_t diff);
3131
operator uint64_t() const;
3232
double ToSecond() const;
3333
float ToSecondf() const;
@@ -36,37 +36,37 @@ class TimeDiffUS {
3636
};
3737
```
3838

39-
Represents the time difference between two `TimestampUS` instances, in microseconds. Supports conversion to seconds and milliseconds.
39+
Represents the time difference between two `MicrosecondTimestamp` instances, in microseconds. Supports conversion to seconds and milliseconds.
4040

41-
## TimestampMS
41+
## MillisecondTimestamp
4242

4343
```cpp
44-
class TimestampMS {
44+
class MillisecondTimestamp {
4545
public:
46-
TimestampMS();
47-
TimestampMS(uint32_t millisecond);
46+
MillisecondTimestamp();
47+
MillisecondTimestamp(uint32_t millisecond);
4848
operator uint32_t() const;
49-
TimeDiffMS operator-(TimestampMS &old);
49+
Duration operator-(MillisecondTimestamp &old);
5050
};
5151
```
5252
5353
Represents a millisecond-level timestamp. Supports implicit conversion to `uint32_t` and can be used to compute time differences.
5454
55-
### TimeDiffMS
55+
### Duration
5656
5757
```cpp
58-
class TimeDiffMS {
58+
class Duration {
5959
public:
60-
TimeDiffMS(uint32_t diff);
60+
Duration(uint32_t diff);
6161
operator uint32_t() const;
62-
double ToSecond();
63-
float ToSecondf();
62+
double ToSecond() const;
63+
float ToSecondf() const;
6464
uint64_t ToMicrosecond() const;
6565
uint32_t ToMillisecond() const;
6666
};
6767
```
6868

69-
Represents the time difference between two `TimestampMS` instances, in milliseconds. Supports conversion to seconds and microseconds.
69+
Represents the time difference between two `MillisecondTimestamp` instances, in milliseconds. Supports conversion to seconds and microseconds.
7070

7171
## Overflow Handling
7272

i18n/en/docusaurus-plugin-content-docs/current/basic_coding/driver/flash.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,25 @@ class Flash {
1515
public:
1616
Flash(size_t min_erase_size, size_t min_write_size, RawData flash_area);
1717

18-
// Erase a specified region (starting offset and size)
18+
// Erase the specified region (starting offset and length)
1919
virtual ErrorCode Erase(size_t offset, size_t size) = 0;
2020

21-
// Write data to a specified offset address
21+
// Write data to the specified offset
2222
virtual ErrorCode Write(size_t offset, ConstRawData data) = 0;
2323

24-
size_t min_erase_size_; // Minimum erasable block size (in bytes)
25-
size_t min_write_size_; // Minimum writable block size (in bytes)
26-
RawData flash_area_; // Mapped flash memory region
24+
// Read data from the specified offset
25+
virtual ErrorCode Read(size_t offset, RawData data) = 0;
26+
27+
// Get the minimum erasable block size
28+
size_t MinEraseSize() const { return min_erase_size_; }
29+
30+
// Get the minimum writable block size
31+
size_t MinWriteSize() const { return min_write_size_; }
32+
33+
// Get the size of the flash
34+
size_t Size() const { return flash_area_.size_; }
2735
};
36+
2837
```
2938
3039
## Usage Notes

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ terminal_source: usb
6565

6666
# Terminal-related settings (optional)
6767
Terminal:
68-
READ_BUFF_SIZE: 32 # Terminal read buffer size
69-
MAX_LINE_SIZE: 32 # Maximum line size
70-
MAX_ARG_NUMBER: 5 # Maximum argument number
71-
MAX_HISTORY_NUMBER: 5 # Maximum history number
72-
RunAsThread: true # Run as a thread
73-
ThreadStackDepth: 1024 # Thread stack depth (only effective under thread mode)
74-
ThreadPriority: 3 # Thread priority (only effective under thread mode)
68+
read_buff_size: 32 # Terminal read buffer size
69+
max_line_size: 32 # Maximum line size
70+
max_arg_number: 5 # Maximum argument number
71+
max_history_number: 5 # Maximum history number
72+
run_as_thread: true # Run as a thread
73+
thread_stack_depth: 1024 # Thread stack depth (only effective under thread mode)
74+
thread_priority: 3 # Thread priority (only effective under thread mode)
7575

7676
# Hardware UART configuration
7777
USART:

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ Configure watchdog behavior via `.config.yaml`:
4040
IWDG:
4141
iwdg1:
4242
timeout_ms: 1000 # Timeout in milliseconds
43-
feed_ms: 250 # Feed interval in milliseconds
43+
feed_interval_ms: 250 # Feed interval in milliseconds
4444
4545
# Global watchdog options
4646
Watchdog:
47-
RunAsThread: true # Whether to run as thread (otherwise uses timer)
48-
ThreadStackDepth: 1024 # Stack size for thread (only effective if thread enabled)
49-
ThreadPriority: 3 # Thread priority (only effective if thread enabled)
50-
FeedInterval: 250 # Feed interval in ms for timer mode (default 250)
47+
run_as_thread: true # Whether to run as thread (otherwise uses timer)
48+
feed_interval_ms: 1024 # Stack size for thread (only effective if thread enabled)
49+
thread_stack_depth: 3 # Thread priority (only effective if thread enabled)
50+
thread_priority: 250 # Feed interval in ms for timer mode (default 250)
5151
```
5252

5353
> * If `RunAsThread: true`, each enabled IWDG generates a thread; thread parameters are global.

0 commit comments

Comments
 (0)