Skip to content

Commit 5fa7627

Browse files
committed
Mark UARTSerial as deprecated
1 parent 18f677e commit 5fa7627

File tree

1 file changed

+81
-27
lines changed

1 file changed

+81
-27
lines changed

drivers/UARTSerial.h

Lines changed: 81 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,39 @@ namespace mbed {
4848
*
4949
*/
5050

51-
class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UARTSerial> {
51+
class
52+
MBED_DEPRECATED_SINCE(
53+
"mbed-os-6.0.0",
54+
"Use BufferedSerial instead."
55+
) UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UARTSerial> {
5256

5357
public:
5458

55-
/** Create a UARTSerial port, connected to the specified transmit and receive pins, with a particular baud rate.
59+
/** @deprecated
60+
* Create a UARTSerial port, connected to the specified transmit and receive pins, with a particular baud rate.
5661
* @param tx Transmit pin
5762
* @param rx Receive pin
5863
* @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE)
5964
*/
65+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
6066
UARTSerial(PinName tx, PinName rx, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
6167

62-
/** Create a UARTSerial port, connected to the specified transmit and receive pins, with a particular baud rate.
68+
/** @deprecated
69+
* Create a UARTSerial port, connected to the specified transmit and receive pins, with a particular baud rate.
6370
* @param static_pinmap reference to structure which holds static pinmap
6471
* @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE)
6572
*/
73+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
6674
UARTSerial(const serial_pinmap_t &static_pinmap, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
6775

76+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
6877
virtual ~UARTSerial();
6978

70-
/** Equivalent to POSIX poll(). Derived from FileHandle.
79+
/** @deprecated
80+
* Equivalent to POSIX poll(). Derived from FileHandle.
7181
* Provides a mechanism to multiplex input/output over a set of file handles.
7282
*/
83+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
7384
virtual short poll(short events) const;
7485

7586
/* Resolve ambiguities versus our private SerialBase
@@ -78,7 +89,8 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
7889
using FileHandle::readable;
7990
using FileHandle::writable;
8091

81-
/** Write the contents of a buffer to a file
92+
/** @deprecated
93+
* Write the contents of a buffer to a file
8294
*
8395
* Follows POSIX semantics:
8496
*
@@ -90,9 +102,11 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
90102
* @param length The number of bytes to write
91103
* @return The number of bytes written, negative error on failure
92104
*/
105+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
93106
virtual ssize_t write(const void *buffer, size_t length);
94107

95-
/** Read the contents of a file into a buffer
108+
/** @deprecated
109+
* Read the contents of a file into a buffer
96110
*
97111
* Follows POSIX semantics:
98112
*
@@ -104,23 +118,29 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
104118
* @param length The number of bytes to read
105119
* @return The number of bytes read, 0 at end of file, negative error on failure
106120
*/
121+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
107122
virtual ssize_t read(void *buffer, size_t length);
108123

109-
/** Close a file
124+
/** @deprecated
125+
* Close a file
110126
*
111127
* @return 0 on success, negative error code on failure
112128
*/
129+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
113130
virtual int close();
114131

115-
/** Check if the file in an interactive terminal device
132+
/** @deprecated
133+
* Check if the file in an interactive terminal device
116134
*
117135
* @return True if the file is a terminal
118136
* @return False if the file is not a terminal
119137
* @return Negative error code on failure
120138
*/
139+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
121140
virtual int isatty();
122141

123-
/** Move the file position to a given offset from from a given location
142+
/** @deprecated
143+
* Move the file position to a given offset from from a given location
124144
*
125145
* Not valid for a device type FileHandle like UARTSerial.
126146
* In case of UARTSerial, returns ESPIPE
@@ -132,35 +152,43 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
132152
* SEEK_END to start from end of file
133153
* @return The new offset of the file, negative error code on failure
134154
*/
155+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
135156
virtual off_t seek(off_t offset, int whence);
136157

137-
/** Flush any buffers associated with the file
158+
/** @deprecated
159+
* Flush any buffers associated with the file
138160
*
139161
* @return 0 on success, negative error code on failure
140162
*/
163+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
141164
virtual int sync();
142165

143-
/** Set blocking or non-blocking mode
166+
/** @deprecated
167+
* Set blocking or non-blocking mode
144168
* The default is blocking.
145169
*
146170
* @param blocking true for blocking mode, false for non-blocking mode.
147171
*/
172+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
148173
virtual int set_blocking(bool blocking)
149174
{
150175
_blocking = blocking;
151176
return 0;
152177
}
153178

154-
/** Check current blocking or non-blocking mode for file operations.
179+
/** @deprecated
180+
* Check current blocking or non-blocking mode for file operations.
155181
*
156182
* @return true for blocking mode, false for non-blocking mode.
157183
*/
184+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
158185
virtual bool is_blocking() const
159186
{
160187
return _blocking;
161188
}
162189

163-
/** Enable or disable input
190+
/** @deprecated
191+
* Enable or disable input
164192
*
165193
* Control enabling of device for input. This is primarily intended
166194
* for temporary power-saving; the overall ability of the device to operate for
@@ -173,9 +201,11 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
173201
* @return 0 on success
174202
* @return Negative error code on failure
175203
*/
204+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
176205
virtual int enable_input(bool enabled);
177206

178-
/** Enable or disable output
207+
/** @deprecated
208+
* Enable or disable output
179209
*
180210
* Control enabling of device for output. This is primarily intended
181211
* for temporary power-saving; the overall ability of the device to operate for
@@ -188,9 +218,11 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
188218
* @return 0 on success
189219
* @return Negative error code on failure
190220
*/
221+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
191222
virtual int enable_output(bool enabled);
192223

193-
/** Register a callback on state change of the file.
224+
/** @deprecated
225+
* Register a callback on state change of the file.
194226
*
195227
* The specified callback will be called on state changes such as when
196228
* the file can be written to or read from.
@@ -207,22 +239,27 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
207239
*
208240
* @param func Function to call on state change
209241
*/
242+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
210243
virtual void sigio(Callback<void()> func);
211244

212-
/** Setup interrupt handler for DCD line
245+
/** @deprecated
246+
* Setup interrupt handler for DCD line
213247
*
214248
* If DCD line is connected, an IRQ handler will be setup.
215249
* Does nothing if DCD is NC, i.e., not connected.
216250
*
217251
* @param dcd_pin Pin-name for DCD
218252
* @param active_high a boolean set to true if DCD polarity is active low
219253
*/
254+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
220255
void set_data_carrier_detect(PinName dcd_pin, bool active_high = false);
221256

222-
/** Set the baud rate
257+
/** @deprecated
258+
* Set the baud rate
223259
*
224260
* @param baud The baud rate
225261
*/
262+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
226263
void set_baud(int baud);
227264

228265
// Expose private SerialBase::Parity as UARTSerial::Parity
@@ -234,12 +271,14 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
234271
using SerialBase::Forced1;
235272
using SerialBase::Forced0;
236273

237-
/** Set the transmission format used by the serial port
274+
/** @deprecated
275+
* Set the transmission format used by the serial port
238276
*
239277
* @param bits The number of bits in a word (5-8; default = 8)
240278
* @param parity The parity used (None, Odd, Even, Forced1, Forced0; default = None)
241279
* @param stop_bits The number of stop bits (1 or 2; default = 1)
242280
*/
281+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
243282
void set_format(int bits = 8, Parity parity = UARTSerial::None, int stop_bits = 1);
244283

245284
#if DEVICE_SERIAL_FC
@@ -252,38 +291,51 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
252291
using SerialBase::CTS;
253292
using SerialBase::RTSCTS;
254293

255-
/** Set the flow control type on the serial port
294+
/** @deprecated
295+
* Set the flow control type on the serial port
256296
*
257297
* @param type the flow control type (Disabled, RTS, CTS, RTSCTS)
258298
* @param flow1 the first flow control pin (RTS for RTS or RTSCTS, CTS for CTS)
259299
* @param flow2 the second flow control pin (CTS for RTSCTS)
260300
*/
301+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
261302
void set_flow_control(Flow type, PinName flow1 = NC, PinName flow2 = NC);
262303
#endif
263304

264305
private:
265306

266-
/** SerialBase lock override */
307+
/** @deprecated
308+
* SerialBase lock override
309+
*/
267310
virtual void lock(void);
268311

269-
/** SerialBase unlock override */
312+
/** @deprecated
313+
* SerialBase unlock override
314+
*/
270315
virtual void unlock(void);
271316

272-
/** Acquire mutex */
317+
/** @deprecated
318+
* Acquire mutex
319+
*/
273320
virtual void api_lock(void);
274321

275-
/** Release mutex */
322+
/** @deprecated
323+
* Release mutex
324+
*/
276325
virtual void api_unlock(void);
277326

278-
/** Unbuffered write - invoked when write called from critical section */
327+
/** @deprecated
328+
* Unbuffered write - invoked when write called from critical section
329+
*/
279330
ssize_t write_unbuffered(const char *buf_ptr, size_t length);
280331

281332
void enable_rx_irq();
282333
void disable_rx_irq();
283334
void enable_tx_irq();
284335
void disable_tx_irq();
285336

286-
/** Software serial buffers
337+
/** @deprecated
338+
* Software serial buffers
287339
* By default buffer size is 256 for TX and 256 for RX. Configurable through mbed_app.json
288340
*/
289341
CircularBuffer<char, MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE> _rxbuf;
@@ -300,14 +352,16 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
300352
bool _rx_enabled;
301353
InterruptIn *_dcd_irq;
302354

303-
/** Device Hanged up
355+
/** @deprecated
356+
* Device Hanged up
304357
* Determines if the device hanged up on us.
305358
*
306359
* @return True, if hanged up
307360
*/
308361
bool hup() const;
309362

310-
/** ISRs for serial
363+
/** @deprecated
364+
* ISRs for serial
311365
* Routines to handle interrupts on serial pins.
312366
* Copies data into Circular Buffer.
313367
* Reports the state change to File handle.

0 commit comments

Comments
 (0)