Skip to content

Commit 568df98

Browse files
committed
Add menuconfig option for USE_USB_SERIAL
Improve DX a lot for enabling serial over usb for boards like the S2 Mini. Signed-off-by: Peter M <[email protected]>
1 parent 1684239 commit 568df98

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Added a limited implementation of the OTP `ets` interface
1111
- Added `code:all_loaded/0` and `code:all_available/0`
12+
- Added menuconfig option for enabling USE_USB_SERIAL, eg. serial over USB for certain ESP32-S2 boards etc.
1213

1314
## [0.6.6] - Unreleased
1415

src/platforms/esp32/main/Kconfig.projbuild

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,18 @@ menu "AtomVM configuration"
2626
help
2727
Reboot the ESP32 device if the start/0 entrypoint does not return the `ok` atom.
2828

29+
config USE_USB_SERIAL
30+
bool "Enable USB CDC Serial"
31+
default n
32+
select TINYUSB_CDC_ENABLED
33+
help
34+
Enable USB CDC Serial functionality.
35+
36+
config TINYUSB_CDC_ENABLED
37+
bool "Enable TinyUSB CDC (requires 'idf.py add-dependency esp_tinyusb')"
38+
default y
39+
depends on USE_USB_SERIAL
40+
help
41+
Enable TinyUSB CDC functionality if USE_USB_SERIAL is enabled.
42+
2943
endmenu

src/platforms/esp32/main/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939

4040
// before enabling this:
4141
// idf.py add-dependency esp_tinyusb
42-
// and enable CDC in menu config
43-
#ifdef USE_USB_SERIAL
42+
// and enable USE_USB_SERIAL in menu config
43+
#ifdef CONFIG_USE_USB_SERIAL
4444
void init_usb_serial(void);
4545
#include "tinyusb.h"
4646
#include "tusb_cdc_acm.h"
@@ -70,7 +70,7 @@ void app_main()
7070
{
7171
esp32_sys_queue_init();
7272

73-
#ifdef USE_USB_SERIAL
73+
#ifdef CONFIG_USE_USB_SERIAL
7474
init_usb_serial();
7575
#endif
7676

@@ -151,7 +151,7 @@ void app_main()
151151
}
152152
}
153153

154-
#ifdef USE_USB_SERIAL
154+
#ifdef CONFIG_USE_USB_SERIAL
155155
void init_usb_serial()
156156
{
157157
/* Setting TinyUSB up */

0 commit comments

Comments
 (0)