Added default value for MBED_CONF_CORE_STDIO_CONVERT_NEWLINES

pull/1876/head
Christopher Haster 2016-06-16 05:53:11 -05:00
parent 1480c231e9
commit 54609f6d62
2 changed files with 5 additions and 4 deletions

View File

@ -88,7 +88,7 @@ FileHandle::~FileHandle() {
#if DEVICE_SERIAL #if DEVICE_SERIAL
extern int stdio_uart_inited; extern int stdio_uart_inited;
extern serial_t stdio_uart; extern serial_t stdio_uart;
#ifdef MBED_CONF_CORE_STDIO_CONVERT_NEWLINES #if MBED_CONF_CORE_STDIO_CONVERT_NEWLINES
static char stdio_in_prev; static char stdio_in_prev;
static char stdio_out_prev; static char stdio_out_prev;
#endif #endif
@ -230,7 +230,7 @@ extern "C" int PREFIX(_write)(FILEHANDLE fh, const unsigned char *buffer, unsign
if (fh < 3) { if (fh < 3) {
#if DEVICE_SERIAL #if DEVICE_SERIAL
if (!stdio_uart_inited) init_serial(); if (!stdio_uart_inited) init_serial();
#ifdef MBED_CONF_CORE_STDIO_CONVERT_NEWLINES #if MBED_CONF_CORE_STDIO_CONVERT_NEWLINES
for (unsigned int i = 0; i < length; i++) { for (unsigned int i = 0; i < length; i++) {
if (buffer[i] == '\n' && stdio_out_prev != '\r') { if (buffer[i] == '\n' && stdio_out_prev != '\r') {
serial_putc(&stdio_uart, '\r'); serial_putc(&stdio_uart, '\r');
@ -268,7 +268,7 @@ extern "C" int PREFIX(_read)(FILEHANDLE fh, unsigned char *buffer, unsigned int
// only read a character at a time from stdin // only read a character at a time from stdin
#if DEVICE_SERIAL #if DEVICE_SERIAL
if (!stdio_uart_inited) init_serial(); if (!stdio_uart_inited) init_serial();
#ifdef MBED_CONF_CORE_STDIO_CONVERT_NEWLINES #if MBED_CONF_CORE_STDIO_CONVERT_NEWLINES
while (true) { while (true) {
char c = serial_getc(&stdio_uart); char c = serial_getc(&stdio_uart);
if ((c == '\r' && stdio_in_prev != '\n') || if ((c == '\r' && stdio_in_prev != '\n') ||

View File

@ -2,7 +2,8 @@
"name": "core", "name": "core",
"config": { "config": {
"stdio-convert-newlines": { "stdio-convert-newlines": {
"help": "Enable conversion to standard newlines on stdin/stdout" "help": "Enable conversion to standard newlines on stdin/stdout",
"value": false
} }
} }
} }