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
018a67a7
Commit
018a67a7
authored
Apr 18, 2017
by
devsaurus
Browse files
establish flushing of uart to leverage buffering putchar()
parent
b72cb34d
Changes
3
Hide whitespace changes
Inline
Side-by-side
components/base_nodemcu/uart.c
View file @
018a67a7
...
...
@@ -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 @
018a67a7
...
...
@@ -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 @
018a67a7
...
...
@@ -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