Skip to content

Commit

Permalink
Merge pull request #417 from shorepine/tdeckremote
Browse files Browse the repository at this point in the history
Get remote UART access to T-Deck working again
  • Loading branch information
bwhitman authored Nov 9, 2024
2 parents ef7747d + 3306b3d commit 5d2422c
Show file tree
Hide file tree
Showing 16 changed files with 390 additions and 203 deletions.
10 changes: 0 additions & 10 deletions docs/tulip_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,16 +335,6 @@ def touch_callback(up):
print("up %d points x1 %d y1 %d" % (up, t[0], t[1]))

tulip.touch_callback(cb)

# Make your own elements on the BG with your own styling and set up your own callbacks to process them
tulip.bg_rect(200,200,50,50,23,1)
tulip.bg_touch_register(12, 200, 200, 50, 50) # 12 is an ID -- from 0-254
def bgt(id):
print("Got a click on id %d. up was %d" % (id, tulip.bg_touch_up(id)) # bg_touch_up returns 1 for touch up

tulip.bg_touch_callback(bgt)
tulip.bg_touch_callback() # turns off
tulip.bg_touch_del(12) # removes
```

## I2C / Grove / Mabee
Expand Down
2 changes: 2 additions & 0 deletions tulip/esp32s3/boards/MATOUCH7/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set(IDF_TARGET esp32s3)

set(MICROPY_PY_TINYUSB OFF)

set(BOARD_DEFINITION1 MATOUCH7)
set(BOARD_DEFINITION2 MAKERFABS)

Expand Down
1 change: 1 addition & 0 deletions tulip/esp32s3/boards/N16R8/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(IDF_TARGET esp32s3)

set(MICROPY_PY_TINYUSB ON)

set(BOARD_DEFINITION1 N16R8)
set(BOARD_DEFINITION2 TULIP_DIY)
Expand Down
2 changes: 2 additions & 0 deletions tulip/esp32s3/boards/N32R8/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set(IDF_TARGET esp32s3)

set(MICROPY_PY_TINYUSB ON)

set(BOARD_DEFINITION1 N32R8)
set(BOARD_DEFINITION2 TULIP_DIY)

Expand Down
1 change: 1 addition & 0 deletions tulip/esp32s3/boards/TDECK/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(IDF_TARGET esp32s3)

set(MICROPY_PY_TINYUSB OFF)

set(BOARD_DEFINITION1 N16R8)
set(BOARD_DEFINITION2 TDECK)
Expand Down
2 changes: 1 addition & 1 deletion tulip/esp32s3/boards/TDECK/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define MICROPY_PY_MACHINE_DAC (0)

// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
#define MICROPY_HW_ENABLE_UART_REPL (1)
#define MICROPY_HW_ENABLE_UART_REPL (0)

#define USB_SERIAL_JTAG_PACKET_SZ_BYTES 64

Expand Down
1 change: 1 addition & 0 deletions tulip/esp32s3/boards/TULIP4_R11/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(IDF_TARGET esp32s3)

set(MICROPY_PY_TINYUSB ON)


set(BOARD_DEFINITION1 TULIP4_R11)
Expand Down
1 change: 1 addition & 0 deletions tulip/esp32s3/boards/TULIP4_R11_DEBUG/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(IDF_TARGET esp32s3)

set(MICROPY_PY_TINYUSB ON)


set(BOARD_DEFINITION1 TULIP4_R11)
Expand Down
10 changes: 5 additions & 5 deletions tulip/esp32s3/esp32_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ list(APPEND MICROPY_SOURCE_DRIVERS
)



string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/tinyusb)
if(MICROPY_PY_TINYUSB)
set(TINYUSB_SRC "${MICROPY_DIR}/lib/tinyusb/src")
Expand Down Expand Up @@ -128,12 +127,14 @@ list(APPEND MICROPY_SOURCE_PORT
${MICROPY_PORT_DIR}/build/lv_mpy.c
${MICROPY_PORT_DIR}/network_common.c
${MICROPY_PORT_DIR}/esp_lcd_touch.c
${MICROPY_PORT_DIR}/uart.c
${MICROPY_PORT_DIR}/modsocket.c
${MICROPY_PORT_DIR}/mphalport.c
${MICROPY_PORT_DIR}/usb.c

${MICROPY_ESP32_DIR}/panichandler.c
${MICROPY_ESP32_DIR}/adc.c
${MICROPY_ESP32_DIR}/mphalport.c
#${MICROPY_ESP32_DIR}/usb_serial_jtag.c
${MICROPY_ESP32_DIR}/uart.c
${MICROPY_ESP32_DIR}/usb_serial_jtag.c
${MICROPY_ESP32_DIR}/gccollect.c
${MICROPY_ESP32_DIR}/fatfs_port.c
${MICROPY_ESP32_DIR}/machine_bitstream.c
Expand All @@ -156,7 +157,6 @@ list(APPEND MICROPY_SOURCE_PORT
${MICROPY_ESP32_DIR}/machine_rtc.c
${MICROPY_ESP32_DIR}/machine_sdcard.c
${MICROPY_ESP32_DIR}/modespnow.c
${MICROPY_ESP32_DIR}/usb.c
)

list(TRANSFORM MICROPY_SOURCE_BOARD PREPEND ${MICROPY_PORT_DIR}/)
Expand Down
9 changes: 7 additions & 2 deletions tulip/esp32s3/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,21 @@ void mp_task(void *pvParameter) {
#if MICROPY_PY_THREAD
mp_thread_init(pxTaskGetStackStart(NULL), TULIP_MP_TASK_STACK_SIZE / sizeof(uintptr_t));
#endif

#if CONFIG_USB_ENABLED
//usb_init();
usb_init();
#elif CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
#ifdef TDECK
//usb_serial_jtag_init();
fprintf(stderr, "init jtag\n");
usb_serial_jtag_init();
#endif
#endif

#if MICROPY_HW_ENABLE_UART_REPL
fprintf(stderr, "init uart repl\n");
uart_stdout_init();
#endif

machine_init();

//esp_err_t err = esp_event_loop_create_default();
Expand Down
1 change: 0 additions & 1 deletion tulip/esp32s3/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Set location of base MicroPython directory.
# Set location of base MicroPython directory.

set(MICROPY_PY_TINYUSB ON)

include(../esp32_common.cmake)
7 changes: 6 additions & 1 deletion tulip/esp32s3/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@
#define MICROPY_PY_MACHINE_I2S (0)
#define MICROPY_PY_BLUETOOTH (0)
#define MICROPY_BLUETOOTH_NIMBLE (0)
#ifdef TDECK
#define MICROPY_HW_USB_CDC (0)
#define MICROPY_HW_ESP_USB_SERIAL_JTAG (1)
#else
#define MICROPY_HW_USB_CDC (1)
#define MICROPY_HW_ENABLE_USBDEV (1)
#define MICROPY_HW_ESP_USB_SERIAL_JTAG (0)
#endif
#define MICROPY_HW_ENABLE_USBDEV (1)
#define MICROPY_ENABLE_SCHEDULER (1)
#define MICROPY_SCHEDULER_DEPTH (128)

Expand Down
Loading

0 comments on commit 5d2422c

Please sign in to comment.