mirror of https://github.com/ARMmbed/mbed-os.git
Remove usage of UARTSerial in Mbed OS Core diretories
Replace with BufferedSerial as UARTSerial has been deprecated.pull/12207/head
parent
5fa76279ef
commit
a74ffacf81
|
@ -56,7 +56,7 @@ int main()
|
|||
|
||||
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
|
||||
console.set_flow_control(SerialBase::RTS, STDIO_UART_RTS, NC);
|
||||
#elif CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_CTS
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "platform/FileHandle.h"
|
||||
#include "drivers/UARTSerial.h"
|
||||
#include "drivers/BufferedSerial.h"
|
||||
|
||||
/**
|
||||
* Macros for setting console flow control.
|
||||
|
@ -32,8 +32,9 @@
|
|||
|
||||
mbed::FileHandle *mbed::mbed_override_console(int)
|
||||
{
|
||||
static mbed::UARTSerial console(STDIO_UART_TX, STDIO_UART_RX,
|
||||
SERIAL_CONSOLE_BAUD_RATE);
|
||||
static mbed::BufferedSerial console(
|
||||
STDIO_UART_TX, STDIO_UART_RX, SERIAL_CONSOLE_BAUD_RATE
|
||||
);
|
||||
#if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS
|
||||
mbed::console.set_flow_control(SerialBase::RTS, STDIO_UART_RTS, NC);
|
||||
#elif CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_CTS
|
||||
|
|
|
@ -57,7 +57,7 @@ int main()
|
|||
|
||||
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
|
||||
console.set_flow_control(SerialBase::RTS, STDIO_UART_RTS, NC);
|
||||
#elif CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_CTS
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace mbed {
|
|||
*/
|
||||
|
||||
/** 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
|
||||
*/
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
"name": "drivers",
|
||||
"config": {
|
||||
"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
|
||||
},
|
||||
"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
|
||||
},
|
||||
"crc-table-size": {
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace mbed {
|
|||
*
|
||||
* Here are some examples:
|
||||
* @code
|
||||
* UARTSerial serial = UARTSerial(D1, D0);
|
||||
* BufferedSerial serial = BufferedSerial(D1, D0);
|
||||
* ATCmdParser at = ATCmdParser(&serial, "\r\n");
|
||||
* int value;
|
||||
* char buffer[100];
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
|
||||
"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
|
||||
},
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class DirHandle;
|
|||
* 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:
|
||||
* - 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;
|
||||
* - Raw HAL serial via serial_getc and serial_putc if
|
||||
* "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
|
||||
* mbed_target_override_console for more details.
|
||||
*
|
||||
* Example using UARTSerial:
|
||||
* Example using BufferedSerial:
|
||||
* @code
|
||||
* FileHandle *mbed::mbed_override_console(int) {
|
||||
* static UARTSerial my_serial(D0, D1);
|
||||
* static BufferedSerial my_serial(D0, D1);
|
||||
* return &my_serial;
|
||||
* }
|
||||
* @endcode
|
||||
|
|
|
@ -75,7 +75,7 @@ void mbed_error_vprintf(const char *format, va_list arg)
|
|||
void mbed_error_puts(const char *str)
|
||||
{
|
||||
// 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
|
||||
// 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
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "platform/mbed_atomic.h"
|
||||
#include "platform/mbed_critical.h"
|
||||
#include "platform/mbed_poll.h"
|
||||
#include "drivers/UARTSerial.h"
|
||||
#include "drivers/BufferedSerial.h"
|
||||
#include "hal/us_ticker_api.h"
|
||||
#include "hal/lp_ticker_api.h"
|
||||
#include "hal/static_pinmap.h"
|
||||
|
@ -150,7 +150,7 @@ extern serial_t stdio_uart;
|
|||
/* Private FileHandle to implement backwards-compatible functionality of
|
||||
* direct HAL serial access for default stdin/stdout/stderr.
|
||||
* 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 {
|
||||
public:
|
||||
|
@ -337,7 +337,7 @@ static FileHandle *default_console()
|
|||
|
||||
# if MBED_CONF_PLATFORM_STDIO_BUFFERED_SERIAL
|
||||
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
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue