@@ -48,28 +48,39 @@ namespace mbed {
48
48
*
49
49
*/
50
50
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> {
52
56
53
57
public:
54
58
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.
56
61
* @param tx Transmit pin
57
62
* @param rx Receive pin
58
63
* @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE)
59
64
*/
65
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
60
66
UARTSerial (PinName tx, PinName rx, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
61
67
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.
63
70
* @param static_pinmap reference to structure which holds static pinmap
64
71
* @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE)
65
72
*/
73
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
66
74
UARTSerial (const serial_pinmap_t &static_pinmap, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
67
75
76
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
68
77
virtual ~UARTSerial ();
69
78
70
- /* * Equivalent to POSIX poll(). Derived from FileHandle.
79
+ /* * @deprecated
80
+ * Equivalent to POSIX poll(). Derived from FileHandle.
71
81
* Provides a mechanism to multiplex input/output over a set of file handles.
72
82
*/
83
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
73
84
virtual short poll (short events) const ;
74
85
75
86
/* Resolve ambiguities versus our private SerialBase
@@ -78,7 +89,8 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
78
89
using FileHandle::readable;
79
90
using FileHandle::writable;
80
91
81
- /* * Write the contents of a buffer to a file
92
+ /* * @deprecated
93
+ * Write the contents of a buffer to a file
82
94
*
83
95
* Follows POSIX semantics:
84
96
*
@@ -90,9 +102,11 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
90
102
* @param length The number of bytes to write
91
103
* @return The number of bytes written, negative error on failure
92
104
*/
105
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
93
106
virtual ssize_t write (const void *buffer, size_t length);
94
107
95
- /* * Read the contents of a file into a buffer
108
+ /* * @deprecated
109
+ * Read the contents of a file into a buffer
96
110
*
97
111
* Follows POSIX semantics:
98
112
*
@@ -104,23 +118,29 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
104
118
* @param length The number of bytes to read
105
119
* @return The number of bytes read, 0 at end of file, negative error on failure
106
120
*/
121
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
107
122
virtual ssize_t read (void *buffer, size_t length);
108
123
109
- /* * Close a file
124
+ /* * @deprecated
125
+ * Close a file
110
126
*
111
127
* @return 0 on success, negative error code on failure
112
128
*/
129
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
113
130
virtual int close ();
114
131
115
- /* * Check if the file in an interactive terminal device
132
+ /* * @deprecated
133
+ * Check if the file in an interactive terminal device
116
134
*
117
135
* @return True if the file is a terminal
118
136
* @return False if the file is not a terminal
119
137
* @return Negative error code on failure
120
138
*/
139
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
121
140
virtual int isatty ();
122
141
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
124
144
*
125
145
* Not valid for a device type FileHandle like UARTSerial.
126
146
* In case of UARTSerial, returns ESPIPE
@@ -132,35 +152,43 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
132
152
* SEEK_END to start from end of file
133
153
* @return The new offset of the file, negative error code on failure
134
154
*/
155
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
135
156
virtual off_t seek (off_t offset, int whence);
136
157
137
- /* * Flush any buffers associated with the file
158
+ /* * @deprecated
159
+ * Flush any buffers associated with the file
138
160
*
139
161
* @return 0 on success, negative error code on failure
140
162
*/
163
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
141
164
virtual int sync ();
142
165
143
- /* * Set blocking or non-blocking mode
166
+ /* * @deprecated
167
+ * Set blocking or non-blocking mode
144
168
* The default is blocking.
145
169
*
146
170
* @param blocking true for blocking mode, false for non-blocking mode.
147
171
*/
172
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
148
173
virtual int set_blocking (bool blocking)
149
174
{
150
175
_blocking = blocking;
151
176
return 0 ;
152
177
}
153
178
154
- /* * Check current blocking or non-blocking mode for file operations.
179
+ /* * @deprecated
180
+ * Check current blocking or non-blocking mode for file operations.
155
181
*
156
182
* @return true for blocking mode, false for non-blocking mode.
157
183
*/
184
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
158
185
virtual bool is_blocking () const
159
186
{
160
187
return _blocking;
161
188
}
162
189
163
- /* * Enable or disable input
190
+ /* * @deprecated
191
+ * Enable or disable input
164
192
*
165
193
* Control enabling of device for input. This is primarily intended
166
194
* 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
173
201
* @return 0 on success
174
202
* @return Negative error code on failure
175
203
*/
204
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
176
205
virtual int enable_input (bool enabled);
177
206
178
- /* * Enable or disable output
207
+ /* * @deprecated
208
+ * Enable or disable output
179
209
*
180
210
* Control enabling of device for output. This is primarily intended
181
211
* 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
188
218
* @return 0 on success
189
219
* @return Negative error code on failure
190
220
*/
221
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
191
222
virtual int enable_output (bool enabled);
192
223
193
- /* * Register a callback on state change of the file.
224
+ /* * @deprecated
225
+ * Register a callback on state change of the file.
194
226
*
195
227
* The specified callback will be called on state changes such as when
196
228
* the file can be written to or read from.
@@ -207,22 +239,27 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
207
239
*
208
240
* @param func Function to call on state change
209
241
*/
242
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
210
243
virtual void sigio (Callback<void ()> func);
211
244
212
- /* * Setup interrupt handler for DCD line
245
+ /* * @deprecated
246
+ * Setup interrupt handler for DCD line
213
247
*
214
248
* If DCD line is connected, an IRQ handler will be setup.
215
249
* Does nothing if DCD is NC, i.e., not connected.
216
250
*
217
251
* @param dcd_pin Pin-name for DCD
218
252
* @param active_high a boolean set to true if DCD polarity is active low
219
253
*/
254
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
220
255
void set_data_carrier_detect (PinName dcd_pin, bool active_high = false );
221
256
222
- /* * Set the baud rate
257
+ /* * @deprecated
258
+ * Set the baud rate
223
259
*
224
260
* @param baud The baud rate
225
261
*/
262
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
226
263
void set_baud (int baud);
227
264
228
265
// Expose private SerialBase::Parity as UARTSerial::Parity
@@ -234,12 +271,14 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
234
271
using SerialBase::Forced1;
235
272
using SerialBase::Forced0;
236
273
237
- /* * Set the transmission format used by the serial port
274
+ /* * @deprecated
275
+ * Set the transmission format used by the serial port
238
276
*
239
277
* @param bits The number of bits in a word (5-8; default = 8)
240
278
* @param parity The parity used (None, Odd, Even, Forced1, Forced0; default = None)
241
279
* @param stop_bits The number of stop bits (1 or 2; default = 1)
242
280
*/
281
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
243
282
void set_format (int bits = 8 , Parity parity = UARTSerial::None, int stop_bits = 1 );
244
283
245
284
#if DEVICE_SERIAL_FC
@@ -252,38 +291,51 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
252
291
using SerialBase::CTS;
253
292
using SerialBase::RTSCTS;
254
293
255
- /* * Set the flow control type on the serial port
294
+ /* * @deprecated
295
+ * Set the flow control type on the serial port
256
296
*
257
297
* @param type the flow control type (Disabled, RTS, CTS, RTSCTS)
258
298
* @param flow1 the first flow control pin (RTS for RTS or RTSCTS, CTS for CTS)
259
299
* @param flow2 the second flow control pin (CTS for RTSCTS)
260
300
*/
301
+ MBED_DEPRECATED (" The class has been deprecated and will be removed in the future." )
261
302
void set_flow_control (Flow type, PinName flow1 = NC, PinName flow2 = NC);
262
303
#endif
263
304
264
305
private:
265
306
266
- /* * SerialBase lock override */
307
+ /* * @deprecated
308
+ * SerialBase lock override
309
+ */
267
310
virtual void lock (void );
268
311
269
- /* * SerialBase unlock override */
312
+ /* * @deprecated
313
+ * SerialBase unlock override
314
+ */
270
315
virtual void unlock (void );
271
316
272
- /* * Acquire mutex */
317
+ /* * @deprecated
318
+ * Acquire mutex
319
+ */
273
320
virtual void api_lock (void );
274
321
275
- /* * Release mutex */
322
+ /* * @deprecated
323
+ * Release mutex
324
+ */
276
325
virtual void api_unlock (void );
277
326
278
- /* * Unbuffered write - invoked when write called from critical section */
327
+ /* * @deprecated
328
+ * Unbuffered write - invoked when write called from critical section
329
+ */
279
330
ssize_t write_unbuffered (const char *buf_ptr, size_t length);
280
331
281
332
void enable_rx_irq ();
282
333
void disable_rx_irq ();
283
334
void enable_tx_irq ();
284
335
void disable_tx_irq ();
285
336
286
- /* * Software serial buffers
337
+ /* * @deprecated
338
+ * Software serial buffers
287
339
* By default buffer size is 256 for TX and 256 for RX. Configurable through mbed_app.json
288
340
*/
289
341
CircularBuffer<char , MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE> _rxbuf;
@@ -300,14 +352,16 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
300
352
bool _rx_enabled;
301
353
InterruptIn *_dcd_irq;
302
354
303
- /* * Device Hanged up
355
+ /* * @deprecated
356
+ * Device Hanged up
304
357
* Determines if the device hanged up on us.
305
358
*
306
359
* @return True, if hanged up
307
360
*/
308
361
bool hup () const ;
309
362
310
- /* * ISRs for serial
363
+ /* * @deprecated
364
+ * ISRs for serial
311
365
* Routines to handle interrupts on serial pins.
312
366
* Copies data into Circular Buffer.
313
367
* Reports the state change to File handle.
0 commit comments