diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-03-30 18:50:38 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-03-30 18:50:38 +0300 |
commit | 61fa7c81527016be164321c442fe5317daa260ee (patch) | |
tree | 27a71b6a2fa5b81b8e245ae64e5408f30c0e9095 /esp8266/esp_mphal.c | |
parent | 2e75a17bab9a3f3379546659e557f026ef70cabe (diff) |
esp8266: Switch back to accumulating input data via ring buffer.
But now it's generic ring buffer implemented via ringbuf.h, and is intended
for any type of input, including dupterm's, not just UART. The general
process work like this: an interrupt-driven input source puts data into
input_buf, and then signals new data available via call to
mp_hal_signal_input().
Diffstat (limited to 'esp8266/esp_mphal.c')
-rw-r--r-- | esp8266/esp_mphal.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/esp8266/esp_mphal.c b/esp8266/esp_mphal.c index 3681a028d..c8a88c725 100644 --- a/esp8266/esp_mphal.c +++ b/esp8266/esp_mphal.c @@ -39,6 +39,8 @@ extern void ets_wdt_disable(void); extern void wdt_feed(void); extern void ets_delay_us(); +STATIC byte input_buf_array[256]; +ringbuf_t input_buf = {input_buf_array, sizeof(input_buf_array)}; void mp_hal_debug_tx_strn_cooked(void *env, const char *str, uint32_t len); const mp_print_t mp_debug_print = {NULL, mp_hal_debug_tx_strn_cooked}; @@ -151,3 +153,7 @@ void __assert_func(const char *file, int line, const char *func, const char *exp nlr_raise(mp_obj_new_exception_msg(&mp_type_AssertionError, "C-level assert")); } + +void mp_hal_signal_input(void) { + system_os_post(UART_TASK_ID, 0, 0); +} |