This commit is contained in:
Alex Hirzel 2021-03-23 16:25:34 -07:00 committed by GitHub
commit 93891b0ced
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 540 additions and 0 deletions

View file

@ -0,0 +1,4 @@
#define configUSE_COUNTING_SEMAPHORES (1)
#include_next <FreeRTOSConfig.h>

View file

@ -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

View file

@ -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);
}