From 78f49388f86b6a6b9870694d84e175187affaae8 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Thu, 3 Apr 2014 19:29:21 +0200 Subject: update echo server --- main.c | 3 +-- shell.c | 42 ------------------------------------------ shell.h | 8 -------- 3 files changed, 1 insertion(+), 52 deletions(-) delete mode 100644 shell.c delete mode 100644 shell.h diff --git a/main.c b/main.c index 9f2b7fb..d3e142c 100644 --- a/main.c +++ b/main.c @@ -27,8 +27,7 @@ void worker() { if (length > 0) { debug_led(1, 1); - char lstr = ((char) length) + '0'; - write(&usart0, &lstr, sizeof(lstr)); + write(&usart0, buffer, length); } else { debug_led(2, 1); WAIT_CYCLES(30000); diff --git a/shell.c b/shell.c deleted file mode 100644 index b45e2cb..0000000 --- a/shell.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "shell.h" -#include -#include -#include -#include "tshield/tshield.h" - -#define MAX_ARGS 5 -#define IN_LENGTH 80 - -static int process_command(int argc, char **argv); - -void shell() { - char in[IN_LENGTH]; - int argc; - char *argv[MAX_ARGS]; - - while(1) { - printf ("root@arduino$ "); - - fgets(in, IN_LENGTH, stdin); - printf("got: %d\n", in[0]); - - argc = 0; - char *p = strtok (in," \n\r"); - while (p != NULL && argc < MAX_ARGS) { - argv[argc] = p; - argc += 1; - p = strtok(NULL, " \n\r"); - } - printf("%d\n", process_command(argc, argv)); - } -} - -static int process_command(int argc, char **argv) { - if (argc < 1) return -1; - - if (strcmp(argv[0], "led") == 0) { - return 0; - } - - return -1; -} \ No newline at end of file diff --git a/shell.h b/shell.h deleted file mode 100644 index 346beae..0000000 --- a/shell.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef COMMAND_H -#define COMMAND_H - -#define SHELL_BAUD 115200 - -void shell(); - -#endif \ No newline at end of file -- cgit v1.2.3