Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/uart_repl_test/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define configUSE_COUNTING_SEMAPHORES (1)

#include_next <FreeRTOSConfig.h>

9 changes: 9 additions & 0 deletions examples/uart_repl_test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
PROGRAM=uart_repl_test.c
EXTRA_COMPONENTS=extras/stdin_uart_interrupt extras/uart_repl
ESPBAUD=921600

include ../../common.mk

serial:
screen $(ESPPORT) 115200

31 changes: 31 additions & 0 deletions examples/uart_repl_test/uart_repl_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <stdlib.h>
#include <string.h> /* strlen */

#include <espressif/esp_common.h>
#include <espressif/user_interface.h>
#include <esp/uart.h>
#include <FreeRTOS.h>
#include <task.h>

#include <uart_repl/uart_repl.h>


void handle_command(char const d[]) {
if (!strcmp(d, "ts") || !strcmp(d, "time")) {
printf("the tick count since boot is: %u\n", xTaskGetTickCount());
} else if (!strcmp(d, "help")) {
printf("commands include ts, time\n");
} else {
printf("command not recognized, try help\n");
}
}


void user_init(void) {
uart_set_baud(0, 115200);

printf("\n\nWelcome to the uart REPL demo. try \"help\"\n");
uart_repl_init(&handle_command);
}


9 changes: 9 additions & 0 deletions extras/uart_repl/component.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Component makefile for extras/uart_repl

# expected anyone using this library includes it as 'uart_repl/uart_repl.h'
INC_DIRS += $(uart_repl_ROOT)..

# args for passing into compile rule generation
uart_repl_SRC_DIR = $(uart_repl_ROOT)

$(eval $(call component_compile_rules,uart_repl))
Loading