diff --git a/examples/osd/arduino-settingsmanager/README.md b/examples/osd/arduino-settingsmanager/README.md index 336ea808d..8f5921ead 100644 --- a/examples/osd/arduino-settingsmanager/README.md +++ b/examples/osd/arduino-settingsmanager/README.md @@ -1,8 +1,37 @@ -Arduino compatibility example -============================= +Arduino shell example +===================== +This example start a shell on merkurboard serial0 line. +You can change the network parameters and store it in eeprom. make clean TARGET=osd-merkur-256 flash +start a terminal programm +------------------------- + +picocom -c -b 38400 --omap crcrlf /dev/ttyUSB0 + +? [ENTER] +Available commands: +?: shows this help +ccathresholds : stop a specific command +killall: stop all running commands +null: discard input +panid <0xabcd>: change panid (default 0xabcd) +ps: list all running processes +quit: exit shell +reboot: reboot the system +rfchannel : change radio channel (11 - 26) +saverfparam <> save radio parameters txpower, channel, panid to eeprom settingsmanager +txpower : change transmission power 0 (3dbm, default) to 15 (-17.2dbm) + +------------------------------------------------------------------------------ +quit picocom, you need to press Ctrl-a , then Ctrl-q + + + This example shows that it is now possible to re-use arduino sketches in Contiki. This example documents the necessary magic. Arduino specifies two routines, `setup` and `loop`. Before `setup` is called, the diff --git a/examples/osd/arduino-settingsmanager/extended-rf-api.c b/examples/osd/arduino-settingsmanager/extended-rf-api.c index ade7854d3..3d716ded3 100644 --- a/examples/osd/arduino-settingsmanager/extended-rf-api.c +++ b/examples/osd/arduino-settingsmanager/extended-rf-api.c @@ -32,12 +32,10 @@ * Example project demonstrating the extended RF API functionality */ #include "contiki.h" -#include "net/netstack.h" -#include "dev/radio.h" - #include #include -#include +#include "net/netstack.h" +#include "dev/radio.h" #include "extended-rf-api.h" /*---------------------------------------------------------------------------*/ struct rf_consts { diff --git a/examples/osd/arduino-settingsmanager/shell-merkur.c b/examples/osd/arduino-settingsmanager/shell-merkur.c index e41ecac37..f231435c0 100644 --- a/examples/osd/arduino-settingsmanager/shell-merkur.c +++ b/examples/osd/arduino-settingsmanager/shell-merkur.c @@ -38,22 +38,13 @@ */ #include "contiki.h" +#include +#include /* strtol */ #include "sys/cc.h" -#include "shell-sky.h" - -#include "dev/watchdog.h" - -#include "net/rime/rime.h" -#include "net/netstack.h" -#include "net/rime/timesynch.h" #include "dev/radio.h" -#include "sys/node-id.h" -#include "lib/settings.h" +#include "shell-merkur.h" #include "extended-rf-api.h" #include "params.h" -#include -#include -#include /* strtol */ /*---------------------------------------------------------------------------*/ PROCESS(shell_txpower_process, "txpower"); @@ -79,7 +70,7 @@ SHELL_COMMAND(ccathresholds_command, PROCESS(shell_saverfparam_process, "saverfparam"); SHELL_COMMAND(saverfparam_command, "saverfparam", - "saverfparam <> save parameters txpower, channel, panid to eeprom settingsmanager", + "saverfparam <> save radio parameters txpower, channel, panid to eeprom settingsmanager", &shell_saverfparam_process); /*---------------------------------------------------------------------------*/ @@ -204,6 +195,8 @@ PROCESS_THREAD(shell_saverfparam_process, ev, data) void shell_merkur_init(void) { + shell_ps_init(); + shell_reboot_init(); shell_register_command(&txpower_command); shell_register_command(&rfchannel_command); shell_register_command(&ccathresholds_command); diff --git a/examples/osd/arduino-settingsmanager/sketch.pde b/examples/osd/arduino-settingsmanager/sketch.pde index 2639b3a84..5c2159b8e 100644 --- a/examples/osd/arduino-settingsmanager/sketch.pde +++ b/examples/osd/arduino-settingsmanager/sketch.pde @@ -14,12 +14,8 @@ extern "C" { #include "arduino-process.h" #include "rest-engine.h" #include "net/netstack.h" -#include "lib/settings.h" -#include "shell.h" #include "serial-shell.h" #include "shell-merkur.h" -#include "dev/radio.h" -#include "extended-rf-api.h" extern resource_t res_led, res_battery, res_cputemp; @@ -35,14 +31,7 @@ void setup (void) led_status=0; // Seriell Shell serial_shell_init(); - shell_ps_init(); - shell_reboot_init(); shell_merkur_init(); -#if COFFEE - shell_coffee_init(); - shell_file_init(); -#endif - // init coap resourcen rest_init_engine (); #pragma GCC diagnostic ignored "-Wwrite-strings" diff --git a/platform/osd-merkur-256/params.c b/platform/osd-merkur-256/params.c index 94e4e5b63..6b866f025 100644 --- a/platform/osd-merkur-256/params.c +++ b/platform/osd-merkur-256/params.c @@ -294,7 +294,6 @@ params_get_ccathresholds(void) { settings_status_t params_save_panid(void) { radio_value_t value; - size_t size = 2; settings_status_t rx=SETTINGS_STATUS_OK;