Skip to content

Commit 79054f1

Browse files
committed
Serial: Deprecate the class and promote UnbufferedSerial instead
1 parent b1b0673 commit 79054f1

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,7 +54,11 @@ 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 printf and puts instead to access the console, BufferedSerial for blocking applications or UnbufferedSerial if bypassing locks in IRQ or short of RAM."
61+
) Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
5762

5863
public:
5964
#if DEVICE_SERIAL_ASYNCH
@@ -67,7 +72,8 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
6772
using SerialBase::enable_input;
6873
using SerialBase::enable_output;
6974

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

82-
/** Create a Serial port, connected to the specified transmit and receive pins
89+
/** @deprecated
90+
* Create a Serial port, connected to the specified transmit and receive pins
8391
*
8492
* @param static_pinmap reference to structure which holds static pinmap.
8593
* @param name The name of the stream associated with this serial port (optional)
@@ -88,10 +96,13 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
8896
* @note
8997
* Either tx or rx may be specified as NC (Not Connected) if unused
9098
*/
99+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
91100
Serial(const serial_pinmap_t &static_pinmap, const char *name = NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
101+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
92102
Serial(const serial_pinmap_t &&, const char * = NULL, int = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) = delete; // prevent passing of temporary objects
93103

94-
/** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
104+
/** @deprecated
105+
* Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
95106
*
96107
* @param tx Transmit pin
97108
* @param rx Receive pin
@@ -100,31 +111,38 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
100111
* @note
101112
* Either tx or rx may be specified as NC (Not Connected) if unused
102113
*/
114+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
103115
Serial(PinName tx, PinName rx, int baud);
104116

105-
/** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
117+
/** @deprecated
118+
* Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
106119
*
107120
* @param static_pinmap reference to structure which holds static pinmap.
108121
* @param baud The baud rate of the serial port
109122
*
110123
* @note
111124
* Either tx or rx may be specified as NC (Not Connected) if unused
112125
*/
126+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
113127
Serial(const serial_pinmap_t &static_pinmap, int baud);
128+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
114129
Serial(const serial_pinmap_t &&, int) = delete; // prevent passing of temporary objects
115130

116131
/* Stream gives us a FileHandle with non-functional poll()/readable()/writable. Pass through
117132
* the calls from the SerialBase instead for backwards compatibility. This problem is
118133
* part of why Stream and Serial should be deprecated.
119134
*/
135+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
120136
bool readable()
121137
{
122138
return SerialBase::readable();
123139
}
140+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
124141
bool writable()
125142
{
126143
return SerialBase::writeable();
127144
}
145+
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
128146
bool writeable()
129147
{
130148
return SerialBase::writeable();

0 commit comments

Comments
 (0)