Skip to content

Commit 9dcd787

Browse files
committed
Serial: Deprecate the class and promote UnbufferedSerial instead
1 parent c374f52 commit 9dcd787

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

drivers/Serial.h

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ namespace mbed {
3333
* @{
3434
*/
3535

36-
/** A serial port (UART) for communication with other serial devices
36+
/** @deprecated
37+
* A serial port (UART) for communication with other serial devices
3738
*
3839
* Can be used for Full Duplex communication, or Simplex by specifying
3940
* one pin as NC (Not Connected)
@@ -53,15 +54,20 @@ namespace mbed {
5354
* }
5455
* @endcode
5556
*/
56-
class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
57+
class
58+
MBED_DEPRECATED_SINCE(
59+
"mbed-os-6.0.0",
60+
"Use UnbufferedSerial instead."
61+
) Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
5762

5863
public:
5964
#if DEVICE_SERIAL_ASYNCH
6065
using SerialBase::read;
6166
using SerialBase::write;
6267
#endif
6368

64-
/** Create a Serial port, connected to the specified transmit and receive pins
69+
/** @deprecated
70+
* Create a Serial port, connected to the specified transmit and receive pins
6571
*
6672
* @param tx Transmit pin
6773
* @param rx Receive pin
@@ -71,9 +77,11 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
7177
* @note
7278
* Either tx or rx may be specified as NC (Not Connected) if unused
7379
*/
80+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
7481
Serial(PinName tx, PinName rx, const char *name = NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
7582

76-
/** Create a Serial port, connected to the specified transmit and receive pins
83+
/** @deprecated
84+
* Create a Serial port, connected to the specified transmit and receive pins
7785
*
7886
* @param static_pinmap reference to structure which holds static pinmap.
7987
* @param name The name of the stream associated with this serial port (optional)
@@ -82,10 +90,13 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
8290
* @note
8391
* Either tx or rx may be specified as NC (Not Connected) if unused
8492
*/
93+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
8594
Serial(const serial_pinmap_t &static_pinmap, const char *name = NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
95+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
8696
Serial(const serial_pinmap_t &&, const char * = NULL, int = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) = delete; // prevent passing of temporary objects
8797

88-
/** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
98+
/** @deprecated
99+
* Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
89100
*
90101
* @param tx Transmit pin
91102
* @param rx Receive pin
@@ -94,31 +105,38 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
94105
* @note
95106
* Either tx or rx may be specified as NC (Not Connected) if unused
96107
*/
108+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
97109
Serial(PinName tx, PinName rx, int baud);
98110

99-
/** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
111+
/** @deprecated
112+
* Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
100113
*
101114
* @param static_pinmap reference to structure which holds static pinmap.
102115
* @param baud The baud rate of the serial port
103116
*
104117
* @note
105118
* Either tx or rx may be specified as NC (Not Connected) if unused
106119
*/
120+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
107121
Serial(const serial_pinmap_t &static_pinmap, int baud);
122+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
108123
Serial(const serial_pinmap_t &&, int) = delete; // prevent passing of temporary objects
109124

110125
/* Stream gives us a FileHandle with non-functional poll()/readable()/writable. Pass through
111126
* the calls from the SerialBase instead for backwards compatibility. This problem is
112127
* part of why Stream and Serial should be deprecated.
113128
*/
129+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
114130
bool readable()
115131
{
116132
return SerialBase::readable();
117133
}
134+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
118135
bool writable()
119136
{
120137
return SerialBase::writeable();
121138
}
139+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
122140
bool writeable()
123141
{
124142
return SerialBase::writeable();

0 commit comments

Comments
 (0)