From 7a6bab7b1087281a6b5e2b2fb3d1507c7ecedf13 Mon Sep 17 00:00:00 2001 From: Harald Pichler Date: Fri, 1 Sep 2017 11:18:20 +0200 Subject: [PATCH] add shell comands --- core/dev/serial-line.c | 6 ++++-- examples/osd/arduino-settingsmanager/Makefile | 1 + .../osd/arduino-settingsmanager/sketch.pde | 20 +++++++++++++++++-- platform/osd-merkur-256/contiki-main.c | 14 ++++++++++--- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/core/dev/serial-line.c b/core/dev/serial-line.c index 6c54331d8..51ab95f7e 100644 --- a/core/dev/serial-line.c +++ b/core/dev/serial-line.c @@ -45,8 +45,10 @@ #error Change SERIAL_LINE_CONF_BUFSIZE in contiki-conf.h. #endif -#define IGNORE_CHAR(c) (c == 0x0d) -#define END 0x0a +//#define IGNORE_CHAR(c) (c == 0x0d) +//#define END 0x0a +#define IGNORE_CHAR(c) (c == 0x0a) +#define END 0x0d static struct ringbuf rxbuf; static uint8_t rxbuf_data[BUFSIZE]; diff --git a/examples/osd/arduino-settingsmanager/Makefile b/examples/osd/arduino-settingsmanager/Makefile index f0a939e52..c30609091 100644 --- a/examples/osd/arduino-settingsmanager/Makefile +++ b/examples/osd/arduino-settingsmanager/Makefile @@ -46,6 +46,7 @@ SMALL=1 # REST Engine shall use Erbium CoAP implementation APPS += er-coap APPS += rest-engine +APPS += serial-shell APPS += arduino include $(CONTIKI)/Makefile.include diff --git a/examples/osd/arduino-settingsmanager/sketch.pde b/examples/osd/arduino-settingsmanager/sketch.pde index 7097f38ac..e62a6ffc9 100644 --- a/examples/osd/arduino-settingsmanager/sketch.pde +++ b/examples/osd/arduino-settingsmanager/sketch.pde @@ -15,6 +15,8 @@ extern "C" { #include "rest-engine.h" #include "net/netstack.h" #include "lib/settings.h" +#include "shell.h" +#include "serial-shell.h" extern resource_t res_led, res_battery, res_cputemp; @@ -42,7 +44,7 @@ void setup (void) if(SETTINGS_STATUS_OK != status) { printf("settings-example: `set` failed: %d\n", status); } - status = settings_set_uint8(SETTINGS_KEY_CHANNEL, 26); + status = settings_set_uint8(SETTINGS_KEY_CHANNEL, 11); if(SETTINGS_STATUS_OK != status) { printf("settings-example: `set` failed: %d\n", status); } @@ -116,6 +118,20 @@ void setup (void) } printf("settings-example: Done.\n"); + // Seriell Shell + serial_shell_init(); + shell_blink_init(); + shell_ps_init(); + shell_reboot_init(); + shell_text_init(); + shell_time_init(); + +#if COFFEE + shell_coffee_init(); + shell_file_init(); +#endif + + // init coap resourcen rest_init_engine (); #pragma GCC diagnostic ignored "-Wwrite-strings" @@ -125,7 +141,7 @@ void setup (void) #pragma GCC diagnostic pop // NETSTACK_MAC.off(1); - mcu_sleep_set(128); + // mcu_sleep_set(128); } void loop (void) diff --git a/platform/osd-merkur-256/contiki-main.c b/platform/osd-merkur-256/contiki-main.c index 420871524..05490fdde 100644 --- a/platform/osd-merkur-256/contiki-main.c +++ b/platform/osd-merkur-256/contiki-main.c @@ -181,7 +181,7 @@ void initialize(void) { watchdog_init(); watchdog_start(); - + /* Generic or slip connection on uart0 */ rs232_init(RS232_PORT_0, USART_BAUD_38400,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); @@ -190,7 +190,15 @@ void initialize(void) /* Redirect stdout */ rs232_redirect_stdout(RS232_PORT_0); +#if 0 + /* Do it my way... */ + //UBRR0L = 8; UBRR0H = 0; UCSR0A = (0 << U2X0); // 115.2k err=-3.5% + //UBRR0L = 16; UBRR0H = 0; UCSR0A = (1 << U2X0); // 115.2k 2.1% + //UBRR0L = 3; UBRR0H = 0; UCSR0A = (1 << U2X0); // 500k 0% +#endif + rs232_set_input(RS232_PORT_0, serial_line_input_byte); + clock_init(); if(MCUSR & (1<