Commit 018a67a7 authored by devsaurus's avatar devsaurus
Browse files

establish flushing of uart to leverage buffering putchar()

parent b72cb34d
......@@ -131,6 +131,7 @@ static int uart_write( lua_State* L )
if( len > 255 )
return luaL_error( L, "invalid number" );
platform_uart_send( id, (uint8_t)len );
platform_uart_flush( id );
}
else
{
......@@ -138,6 +139,7 @@ static int uart_write( lua_State* L )
buf = lua_tolstring( L, s, &len );
for( i = 0; i < len; i ++ )
platform_uart_send( id, buf[ i ] );
platform_uart_flush( id );
}
}
return 0;
......
......@@ -72,6 +72,7 @@ enum
static inline int platform_uart_exists( unsigned id ) { return id < NUM_UART; }
uint32_t platform_uart_setup( unsigned id, uint32_t baud, int databits, int parity, int stopbits );
void platform_uart_send( unsigned id, uint8_t data );
void platform_uart_flush( unsigned id );
int platform_uart_set_flow_control( unsigned id, int type );
......
......@@ -68,6 +68,12 @@ void platform_uart_send( unsigned id, uint8_t data )
putchar (data);
}
void platform_uart_flush( unsigned id )
{
if (id == CONSOLE_UART)
fflush (stdout);
}
// *****************************************************************************
// Sigma-Delta platform interface
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment