Skip to content

Commit

Permalink
Merge pull request #41 from BackSlasher/master
Browse files Browse the repository at this point in the history
Terminal demo: Changed pins to USB TX/RX
  • Loading branch information
vroland committed Nov 28, 2020
2 parents 1ae9748 + 7c7f3c1 commit 858d172
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions examples/terminal/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Quickstart:

1. Build and flush: `idf.py build && idf.py flash -b 921600`
2. Write to the TTY, e.g. `script -f /dev/ttyUSB0`

Known Issues:

- With ESP-IDF 4.0, there is seems to be an issue with the UART
Expand Down
13 changes: 8 additions & 5 deletions examples/terminal/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
#include "epd_driver.h"
#include "st.h"

#define ECHO_TEST_TXD (GPIO_NUM_1)
#define ECHO_TEST_RXD (GPIO_NUM_3)
#define USB_TXD (GPIO_NUM_1)
#define SERIAL_RXD (GPIO_NUM_3)

#define ECHO_TEST_RTS (UART_PIN_NO_CHANGE)
#define ECHO_TEST_CTS (UART_PIN_NO_CHANGE)

Expand Down Expand Up @@ -79,13 +80,15 @@ void app_main() {
.use_ref_tick = true,
};
uart_param_config(UART_NUM_1, &uart_config);
ESP_ERROR_CHECK(uart_set_pin(UART_NUM_1, GPIO_NUM_15, GPIO_NUM_14, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
// Change here to modify tx/rx pins
ESP_ERROR_CHECK(uart_set_pin(UART_NUM_1, USB_TXD, SERIAL_RXD, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
ESP_ERROR_CHECK(uart_driver_install(UART_NUM_1, BUF_SIZE, 1024, 0, NULL, 0));

// Still log to the serial output
//esp_log_set_vprintf(log_to_uart);
// Needed if reusing the USB TX/RX
esp_log_set_vprintf(log_to_uart);

//ESP_LOGI("term", "listening\n");
ESP_LOGI("term", "listening\n");

tnew(cols, rows);
selinit();
Expand Down

0 comments on commit 858d172

Please sign in to comment.