Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
8ee61c51
Commit
8ee61c51
authored
Apr 19, 2017
by
Johny Mattsson
Committed by
GitHub
Apr 19, 2017
Browse files
Merge pull request #1920 from devsaurus/uart_flush
ESP32: Establish flushing of uart to leverage buffering putchar().
parents
b72cb34d
018a67a7
Changes
3
Show whitespace changes
Inline
Side-by-side
components/base_nodemcu/uart.c
View file @
8ee61c51
...
...
@@ -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
;
...
...
components/platform/include/platform.h
View file @
8ee61c51
...
...
@@ -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
);
...
...
components/platform/platform.c
View file @
8ee61c51
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment