Commit 01b94f31 authored by Joo Aun Saw's avatar Joo Aun Saw Committed by Johny Mattsson
Browse files

uart: feed rx data to both lua console and on-data callback

parent a3712ac9
......@@ -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;
......
......@@ -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++;
......
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