Skip to content

Commit 498bedb

Browse files
committed
Merge pull request #138 from ARMmbed/fix_default_baudrate
Changed console initialization
2 parents 9a06854 + b6dfee0 commit 498bedb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

source/retarget.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <errno.h>
2424
#include "minar/minar.h"
2525
#include "mbed-hal/init_api.h"
26+
#include "mbed-hal/serial_api.h"
2627
#include "core_generic.h"
2728

2829
#if defined(__ARMCC_VERSION)
@@ -101,15 +102,16 @@ FileHandle::~FileHandle() {
101102
}
102103

103104
#if DEVICE_SERIAL
104-
extern int stdio_uart_inited;
105-
extern serial_t stdio_uart;
105+
static int stdio_uart_inited;
106+
static serial_t stdio_uart;
106107
#endif
107108

108109
static void init_serial() {
109110
#if DEVICE_SERIAL
110111
if (stdio_uart_inited) return;
111112
serial_init(&stdio_uart, STDIO_UART_TX, STDIO_UART_RX);
112113
serial_baud(&stdio_uart, STDIO_DEFAULT_BAUD);
114+
stdio_uart_inited = 1;
113115
#endif
114116
}
115117

0 commit comments

Comments
 (0)