Merge pull request #1920 from devsaurus/uart_flush
ESP32: Establish flushing of uart to leverage buffering putchar().
This commit is contained in:
commit
8ee61c51cc
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue