nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32
https://nodemcu.readthedocs.io
MIT License
7.64k stars 3.12k forks source link

Add support for the builtin USB CDC console on the ESP32C3 [WIP] #3532

Closed pjsg closed 2 years ago

pjsg commented 2 years ago

Fixes #3526.

If the USB CDC console is configured, then it appears as the default console for the Lua REPL. It also appears as UART 0 and bumps the other uart(s) down one. The baud rate cannot be configured as there is no actual serial line.

When configured this way, stdin and stdout are connected to this device. Unfortunately, async reading is not possible at the moment. Thus the input side is handled by doing blocking reads in a seperate thread, and then posting the data into the Lua environment. Happily this is very similar to how the uart code works.

pjsg commented 2 years ago

What is puzzling me at the moment is how the command line echo works. In particular, I'm not getting the linefeeds echoed.

pjsg commented 2 years ago

This got a whole bunch of other stuff merged into it.