diff options
Diffstat (limited to 'master')
-rw-r--r-- | master/CMakeLists.txt | 8 | ||||
-rw-r--r-- | master/README.md | 0 | ||||
-rw-r--r-- | master/main/CMakeLists.txt | 2 | ||||
-rw-r--r-- | master/main/main.c | 34 |
4 files changed, 44 insertions, 0 deletions
diff --git a/master/CMakeLists.txt b/master/CMakeLists.txt new file mode 100644 index 0000000..664d458 --- /dev/null +++ b/master/CMakeLists.txt @@ -0,0 +1,8 @@ +# For more information about build system see +# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html +# The following five lines of boilerplate have to be in your project's +# CMakeLists in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.16) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(main) diff --git a/master/README.md b/master/README.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/master/README.md diff --git a/master/main/CMakeLists.txt b/master/main/CMakeLists.txt new file mode 100644 index 0000000..cf2c455 --- /dev/null +++ b/master/main/CMakeLists.txt @@ -0,0 +1,2 @@ +idf_component_register(SRCS "main.c" + INCLUDE_DIRS ".") diff --git a/master/main/main.c b/master/main/main.c new file mode 100644 index 0000000..ee170bc --- /dev/null +++ b/master/main/main.c @@ -0,0 +1,34 @@ +#include <stdio.h> +#include "driver/uart.h" + +#define ECHECK(...) ESP_ERROR_CHECK(__VA_ARGS__) + +QueueHandle_t uart_queue; + +void uart_setup(void); + +void app_main(void) +{ + uart_setup(); + + char message[] = "Hello World\n"; + uart_write_bytes(UART_NUM_0, message, sizeof(message)); +} + +void uart_setup(void) +{ + // stty -F /dev/ttyUSB0 cs8 -parenb -crtscts -cstopb + uart_config_t uart_config = { + .baud_rate = 9600, + .data_bits = UART_DATA_8_BITS, + .parity = UART_PARITY_DISABLE, + .stop_bits = UART_STOP_BITS_1, + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, + .source_clk = UART_SCLK_DEFAULT, + }; + + #define UART_BUFFER_SIZE 2048 + ECHECK(uart_param_config(UART_NUM_0, &uart_config)); + ECHECK(uart_driver_install(UART_NUM_0, UART_BUFFER_SIZE, UART_BUFFER_SIZE, 10, &uart_queue, 0)); +} + |