14
14
15
15
props = {}
16
16
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
+
17
36
class Instance (Module ):
18
37
def __init__ (self , driver , instance ):
19
38
self .driver = driver
@@ -27,6 +46,8 @@ class Instance(Module):
27
46
module .description = "Instance {}" .format (self .instance )
28
47
29
48
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 ))
30
51
module .depends (":platform:uart" )
31
52
return True
32
53
@@ -55,7 +76,22 @@ class Instance(Module):
55
76
56
77
def init (module ):
57
78
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
+ """
59
95
60
96
def prepare (module , options ):
61
97
device = options [":target" ]
0 commit comments