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
01b94f31
Commit
01b94f31
authored
Aug 29, 2022
by
Joo Aun Saw
Committed by
Johny Mattsson
Aug 29, 2022
Browse files
uart: feed rx data to both lua console and on-data callback
parent
a3712ac9
Changes
2
Hide whitespace changes
Inline
Side-by-side
components/modules/uart.c
View file @
01b94f31
...
...
@@ -10,6 +10,10 @@
static
lua_State
*
gL
=
NULL
;
bool
uart_has_on_data_cb
(
unsigned
id
){
return
uart_status
[
id
].
receive_rf
!=
LUA_NOREF
;
}
bool
uart_on_data_cb
(
unsigned
id
,
const
char
*
buf
,
size_t
len
){
if
(
!
buf
||
len
==
0
)
return
false
;
...
...
components/platform/platform.c
View file @
01b94f31
...
...
@@ -65,6 +65,7 @@ uart_status_t uart_status[NUM_UART];
task_handle_t
uart_event_task_id
=
0
;
SemaphoreHandle_t
sem
=
NULL
;
extern
bool
uart_has_on_data_cb
(
unsigned
id
);
extern
bool
uart_on_data_cb
(
unsigned
id
,
const
char
*
buf
,
size_t
len
);
extern
bool
uart_on_error_cb
(
unsigned
id
,
const
char
*
buf
,
size_t
len
);
...
...
@@ -81,7 +82,7 @@ void uart_event_task( task_param_t param, task_prio_t prio ) {
unsigned
used
=
feed_lua_input
(
post
->
data
+
i
,
post
->
size
-
i
);
i
+=
used
;
}
else
{
if
(
uart_has_on_data_cb
(
id
))
{
char
ch
=
post
->
data
[
i
];
us
->
line_buffer
[
us
->
line_position
]
=
ch
;
us
->
line_position
++
;
...
...
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