add shell comands

master
Harald Pichler 2017-09-01 11:18:20 +02:00
parent 13c4934a37
commit 7a6bab7b10
4 changed files with 34 additions and 7 deletions

View File

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

View File

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

View File

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

View File

@ -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<<PORF )) PRINTD("Power-on reset.\n");
@ -239,7 +247,7 @@ uint8_t i;
/* Initialize process subsystem */
process_init();
/* etimers must be started before ctimer_init */
process_start(&etimer_process, NULL);
ctimer_init();
@ -312,7 +320,7 @@ uint8_t i;
#endif
process_start(&sensors_process, NULL);
serial_line_init();
/* Autostart other processes */
autostart_start(autostart_processes);