Skip to content

Commit ad778f7

Browse files
committed
[stm32] Document UART buffer config transition
1 parent 7a8c57d commit ad778f7

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

src/modm/platform/uart/stm32/module.lb

+37-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,25 @@
1414

1515
props = {}
1616

17+
descr_example = """
18+
```cpp
19+
using namespace modm::platform;
20+
// Using only hardware buffers for Tx and Rx (both 1 symbol)
21+
using UartN = BufferedUart<U(s)artHalN>;
22+
// using only TX software buffer
23+
using UartN = BufferedUart<U(s)artHalN, UartTxBuffer<512>>;
24+
// using only RX software buffer
25+
using UartN = BufferedUart<U(s)artHalN, UartRxBuffer<256>>;
26+
// using both TX and RX software buffers
27+
using UartN = BufferedUart<U(s)artHalN, UartTxBuffer<512>, UartRxBuffer<256>>;
28+
```
29+
"""
30+
31+
descr_buffer = """
32+
The buffer configuration is now implemented in C++.
33+
Please replace any `modm::platform::U(s)artN` type with:
34+
""" + descr_example
35+
1736
class Instance(Module):
1837
def __init__(self, driver, instance):
1938
self.driver = driver
@@ -27,6 +46,8 @@ class Instance(Module):
2746
module.description = "Instance {}".format(self.instance)
2847

2948
def prepare(self, module, options):
49+
module.add_alias(Alias(name="buffer.tx", description=descr_buffer))
50+
module.add_alias(Alias(name="buffer.rx", description=descr_buffer))
3051
module.depends(":platform:uart")
3152
return True
3253

@@ -55,7 +76,22 @@ class Instance(Module):
5576

5677
def init(module):
5778
module.name = ":platform:uart"
58-
module.description = "Universal Asynchronous Receiver Transmitter (UART)"
79+
module.description = """
80+
# Universal Asynchronous Receiver Transmitter (UART)
81+
82+
The UART buffer configuration is implemented as C++ template arguments:
83+
""" + descr_example + """
84+
85+
## Using FreeRTOS buffers
86+
87+
A special buffer implementation is available for FreeRTOS that uses the proper
88+
queue implementation to sleep and wake up the calling thread:
89+
90+
```cpp
91+
// using both TX and RX software buffers
92+
using UartTxRxN = BufferedUart<U(s)artHalN, UartTxBufferFreeRtos<512>, UartRxBufferFreeRtos<256>>;
93+
```
94+
"""
5995

6096
def prepare(module, options):
6197
device = options[":target"]

0 commit comments

Comments
 (0)