@@ -98,6 +98,11 @@ impl<'a> Lpuart<'a, Buffered> {
9898 /// Create a new full duplex buffered LPUART.
9999 ///
100100 /// Any external pin will be placed into Disabled state upon Drop.
101+ ///
102+ /// ## SAFETY
103+ ///
104+ /// You must NOT call `core::mem::forget` on `Lpuart` if `rx_buffer` or `tx_buffer` are not
105+ /// `'static`. This will cause memory corruption.
101106 pub fn new_buffered < T : Instance > (
102107 _inner : Peri < ' a , T > ,
103108 tx_pin : Peri < ' a , impl TxPin < T > > ,
@@ -116,6 +121,11 @@ impl<'a> Lpuart<'a, Buffered> {
116121 /// Create a new buffered LPUART instance with RTS/CTS flow control.
117122 ///
118123 /// Any external pin will be placed into Disabled state upon Drop.
124+ ///
125+ /// ## SAFETY
126+ ///
127+ /// You must NOT call `core::mem::forget` on `Lpuart` if `rx_buffer` or `tx_buffer` are not
128+ /// `'static`. This will cause memory corruption.
119129 pub fn new_buffered_with_rtscts < T : Instance > (
120130 _inner : Peri < ' a , T > ,
121131 tx_pin : Peri < ' a , impl TxPin < T > > ,
@@ -146,6 +156,11 @@ impl<'a> Lpuart<'a, Buffered> {
146156 /// Create a new buffered LPUART with only RTS flow control (RX flow control).
147157 ///
148158 /// Any external pin will be placed into Disabled state upon Drop.
159+ ///
160+ /// ## SAFETY
161+ ///
162+ /// You must NOT call `core::mem::forget` on `Lpuart` if `rx_buffer` or `tx_buffer` are not
163+ /// `'static`. This will cause memory corruption.
149164 pub fn new_buffered_with_rts < T : Instance > (
150165 _inner : Peri < ' a , T > ,
151166 tx_pin : Peri < ' a , impl TxPin < T > > ,
@@ -174,6 +189,11 @@ impl<'a> Lpuart<'a, Buffered> {
174189 /// Create a new buffered LPUART with only CTS flow control (TX flow control).
175190 ///
176191 /// Any external pin will be placed into Disabled state upon Drop.
192+ ///
193+ /// ## SAFETY
194+ ///
195+ /// You must NOT call `core::mem::forget` on `Lpuart` if `rx_buffer` or `tx_buffer` are not
196+ /// `'static`. This will cause memory corruption.
177197 pub fn new_buffered_with_cts < T : Instance > (
178198 _inner : Peri < ' a , T > ,
179199 tx_pin : Peri < ' a , impl TxPin < T > > ,
@@ -224,6 +244,11 @@ impl<'a> LpuartTx<'a, Buffered> {
224244 /// Create a new TX-only LPUART.
225245 ///
226246 /// Any external pin will be placed into Disabled state upon Drop.
247+ ///
248+ /// ## SAFETY
249+ ///
250+ /// You must NOT call `core::mem::forget` on `LpuartTx` if `tx_buffer` is not `'static`.
251+ /// This will potentially send "garbage" data via the UART.
227252 pub fn new < T : Instance > (
228253 _inner : Peri < ' a , T > ,
229254 tx_pin : Peri < ' a , impl TxPin < T > > ,
@@ -241,6 +266,11 @@ impl<'a> LpuartTx<'a, Buffered> {
241266 /// Create a new TX-only buffered LPUART with CTS flow control.
242267 ///
243268 /// Any external pin will be placed into Disabled state upon Drop.
269+ ///
270+ /// ## SAFETY
271+ ///
272+ /// You must NOT call `core::mem::forget` on `LpuartTx` if `tx_buffer` is not `'static`.
273+ /// This will potentially send "garbage" data via the UART.
244274 pub fn new_with_cts < T : Instance > (
245275 _inner : Peri < ' a , T > ,
246276 tx_pin : Peri < ' a , impl TxPin < T > > ,
@@ -362,6 +392,11 @@ impl<'a> LpuartRx<'a, Buffered> {
362392 /// Create a new RX-only buffered LPUART.
363393 ///
364394 /// Any external pin will be placed into Disabled state upon Drop.
395+ ///
396+ /// ## SAFETY
397+ ///
398+ /// You must NOT call `core::mem::forget` on `LpuartRx` if `rx_buffer` is not `'static`.
399+ /// This will cause memory corruption.
365400 pub fn new < T : Instance > (
366401 _inner : Peri < ' a , T > ,
367402 rx_pin : Peri < ' a , impl RxPin < T > > ,
@@ -385,6 +420,11 @@ impl<'a> LpuartRx<'a, Buffered> {
385420 /// Create a new RX-only buffered LPUART with RTS flow control.
386421 ///
387422 /// Any external pin will be placed into Disabled state upon Drop.
423+ ///
424+ /// ## SAFETY
425+ ///
426+ /// You must NOT call `core::mem::forget` on `LpuartRx` if `rx_buffer` is not `'static`.
427+ /// This will cause memory corruption.
388428 pub fn new_with_rts < T : Instance > (
389429 _inner : Peri < ' a , T > ,
390430 rx_pin : Peri < ' a , impl RxPin < T > > ,
0 commit comments