Remove usage of UARTSerial in Mbed OS Core diretories

Replace with BufferedSerial as UARTSerial has been deprecated.
pull/12207/head
Hugues Kamba 2020-01-07 14:56:39 +00:00
parent 5fa76279ef
commit a74ffacf81
10 changed files with 18 additions and 17 deletions

View File

@ -56,7 +56,7 @@ int main()
FileHandle *mbed::mbed_override_console(int) FileHandle *mbed::mbed_override_console(int)
{ {
static UARTSerial console(STDIO_UART_TX, STDIO_UART_RX, SERIAL_CONSOLE_BAUD_RATE); static BufferedSerial console(STDIO_UART_TX, STDIO_UART_RX, SERIAL_CONSOLE_BAUD_RATE);
#if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS #if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS
console.set_flow_control(SerialBase::RTS, STDIO_UART_RTS, NC); console.set_flow_control(SerialBase::RTS, STDIO_UART_RTS, NC);
#elif CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_CTS #elif CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_CTS

View File

@ -16,7 +16,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include "platform/FileHandle.h" #include "platform/FileHandle.h"
#include "drivers/UARTSerial.h" #include "drivers/BufferedSerial.h"
/** /**
* Macros for setting console flow control. * Macros for setting console flow control.
@ -32,8 +32,9 @@
mbed::FileHandle *mbed::mbed_override_console(int) mbed::FileHandle *mbed::mbed_override_console(int)
{ {
static mbed::UARTSerial console(STDIO_UART_TX, STDIO_UART_RX, static mbed::BufferedSerial console(
SERIAL_CONSOLE_BAUD_RATE); STDIO_UART_TX, STDIO_UART_RX, SERIAL_CONSOLE_BAUD_RATE
);
#if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS #if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS
mbed::console.set_flow_control(SerialBase::RTS, STDIO_UART_RTS, NC); mbed::console.set_flow_control(SerialBase::RTS, STDIO_UART_RTS, NC);
#elif CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_CTS #elif CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_CTS

View File

@ -57,7 +57,7 @@ int main()
FileHandle *mbed::mbed_override_console(int) FileHandle *mbed::mbed_override_console(int)
{ {
static UARTSerial console(STDIO_UART_TX, STDIO_UART_RX, SERIAL_CONSOLE_BAUD_RATE); static BufferedSerial console(STDIO_UART_TX, STDIO_UART_RX, SERIAL_CONSOLE_BAUD_RATE);
#if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS #if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS
console.set_flow_control(SerialBase::RTS, STDIO_UART_RTS, NC); console.set_flow_control(SerialBase::RTS, STDIO_UART_RTS, NC);
#elif CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_CTS #elif CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_CTS

View File

@ -39,7 +39,7 @@ namespace mbed {
*/ */
/** A base class for serial port implementations /** A base class for serial port implementations
* Can't be instantiated directly (use UnbufferedSerial or UARTSerial) * Can't be instantiated directly (use UnbufferedSerial or BufferedSerial)
* *
* @note Synchronization level: Set by subclass * @note Synchronization level: Set by subclass
*/ */

View File

@ -2,11 +2,11 @@
"name": "drivers", "name": "drivers",
"config": { "config": {
"uart-serial-txbuf-size": { "uart-serial-txbuf-size": {
"help": "Default TX buffer size for a UARTSerial instance (unit Bytes))", "help": "Default TX buffer size for a BufferedSerial instance (unit Bytes))",
"value": 256 "value": 256
}, },
"uart-serial-rxbuf-size": { "uart-serial-rxbuf-size": {
"help": "Default RX buffer size for a UARTSerial instance (unit Bytes))", "help": "Default RX buffer size for a BufferedSerial instance (unit Bytes))",
"value": 256 "value": 256
}, },
"crc-table-size": { "crc-table-size": {

View File

@ -39,7 +39,7 @@ namespace mbed {
* *
* Here are some examples: * Here are some examples:
* @code * @code
* UARTSerial serial = UARTSerial(D1, D0); * BufferedSerial serial = BufferedSerial(D1, D0);
* ATCmdParser at = ATCmdParser(&serial, "\r\n"); * ATCmdParser at = ATCmdParser(&serial, "\r\n");
* int value; * int value;
* char buffer[100]; * char buffer[100];

View File

@ -12,7 +12,7 @@
}, },
"stdio-buffered-serial": { "stdio-buffered-serial": {
"help": "(Applies if target.console-uart is true and stdio-minimal-console-only is false.) Use UARTSerial driver to obtain buffered serial I/O on stdin/stdout/stderr. If false, unbuffered serial_getc and serial_putc are used directly.", "help": "(Applies if target.console-uart is true and stdio-minimal-console-only is false.) Use BufferedSerial driver to obtain buffered serial I/O on stdin/stdout/stderr. If false, unbuffered serial_getc and serial_putc are used directly.",
"value": false "value": false
}, },

View File

@ -100,7 +100,7 @@ class DirHandle;
* to give the target a chance to specify a FileHandle for the console. * to give the target a chance to specify a FileHandle for the console.
* *
* If this is not provided or returns NULL, the console will be: * If this is not provided or returns NULL, the console will be:
* - UARTSerial if configuration option "platform.stdio-buffered-serial" is * - BufferedSerial if configuration option "platform.stdio-buffered-serial" is
* true and the target has DEVICE_SERIAL; * true and the target has DEVICE_SERIAL;
* - Raw HAL serial via serial_getc and serial_putc if * - Raw HAL serial via serial_getc and serial_putc if
* "platform.stdio-buffered-serial" is false and the target has DEVICE_SERIAL; * "platform.stdio-buffered-serial" is false and the target has DEVICE_SERIAL;
@ -121,10 +121,10 @@ FileHandle *mbed_target_override_console(int fd);
* by mbed_target_override_console, else will default to serial - see * by mbed_target_override_console, else will default to serial - see
* mbed_target_override_console for more details. * mbed_target_override_console for more details.
* *
* Example using UARTSerial: * Example using BufferedSerial:
* @code * @code
* FileHandle *mbed::mbed_override_console(int) { * FileHandle *mbed::mbed_override_console(int) {
* static UARTSerial my_serial(D0, D1); * static BufferedSerial my_serial(D0, D1);
* return &my_serial; * return &my_serial;
* } * }
* @endcode * @endcode

View File

@ -75,7 +75,7 @@ void mbed_error_vprintf(const char *format, va_list arg)
void mbed_error_puts(const char *str) void mbed_error_puts(const char *str)
{ {
// Writing the string to the console in a critical section is // Writing the string to the console in a critical section is
// potentially beneficial - for example in UARTSerial it // potentially beneficial - for example in BufferedSerial it
// forces the "unbuffered" mode that makes sure all characters // forces the "unbuffered" mode that makes sure all characters
// go out now. If we made the call not in a critical section, // go out now. If we made the call not in a critical section,
// it would go to the software buffer and we would be reliant // it would go to the software buffer and we would be reliant

View File

@ -30,7 +30,7 @@
#include "platform/mbed_atomic.h" #include "platform/mbed_atomic.h"
#include "platform/mbed_critical.h" #include "platform/mbed_critical.h"
#include "platform/mbed_poll.h" #include "platform/mbed_poll.h"
#include "drivers/UARTSerial.h" #include "drivers/BufferedSerial.h"
#include "hal/us_ticker_api.h" #include "hal/us_ticker_api.h"
#include "hal/lp_ticker_api.h" #include "hal/lp_ticker_api.h"
#include "hal/static_pinmap.h" #include "hal/static_pinmap.h"
@ -150,7 +150,7 @@ extern serial_t stdio_uart;
/* Private FileHandle to implement backwards-compatible functionality of /* Private FileHandle to implement backwards-compatible functionality of
* direct HAL serial access for default stdin/stdout/stderr. * direct HAL serial access for default stdin/stdout/stderr.
* This is not a particularly well-behaved FileHandle for a stream, which * This is not a particularly well-behaved FileHandle for a stream, which
* is why it's not public. People should be using UARTSerial. * is why it's not public. People should be using BufferedSerial.
*/ */
class DirectSerial : public FileHandle { class DirectSerial : public FileHandle {
public: public:
@ -337,7 +337,7 @@ static FileHandle *default_console()
# if MBED_CONF_PLATFORM_STDIO_BUFFERED_SERIAL # if MBED_CONF_PLATFORM_STDIO_BUFFERED_SERIAL
static const serial_pinmap_t console_pinmap = get_uart_pinmap(STDIO_UART_TX, STDIO_UART_RX); static const serial_pinmap_t console_pinmap = get_uart_pinmap(STDIO_UART_TX, STDIO_UART_RX);
static UARTSerial console(console_pinmap, MBED_CONF_PLATFORM_STDIO_BAUD_RATE); static BufferedSerial console(console_pinmap, MBED_CONF_PLATFORM_STDIO_BAUD_RATE);
# if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS # if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS
static const serial_fc_pinmap_t fc_pinmap = get_uart_fc_pinmap(STDIO_UART_RTS, NC); static const serial_fc_pinmap_t fc_pinmap = get_uart_fc_pinmap(STDIO_UART_RTS, NC);
console.serial_set_flow_control(SerialBase::RTS, fc_pinmap); console.serial_set_flow_control(SerialBase::RTS, fc_pinmap);