diff --git a/sys/shell/cc1100.c b/sys/shell/cc1100.c index 47901d7344..b9542e3b72 100644 --- a/sys/shell/cc1100.c +++ b/sys/shell/cc1100.c @@ -1,27 +1,43 @@ #include +#include +#include #include #ifdef MODULE_CC110X -void _cc1100_get_address_handler(char *str) { - radio_address_t addr = cc1100_get_address(); - printf("cc1100 address: %i\n", addr); +void _cc110x_get_set_address_handler(char *addr) { + int16_t a; + + a = atoi(addr+5); + if (strlen(addr) > 5) { + printf("[cc110x] Setting address %i ... ", a); + cc1100_set_address((radio_address_t)a); + if (cc1100_get_address() == (radio_address_t)a) { + puts("[OK]"); + } else { + puts("Error!"); + } + } + else { + printf("[cc1100] Got address: %i\n", cc1100_get_address()); + } } -void _cc1100_set_address_handler(char *str) { - int addr; - int res = sscanf(str, "cc1100_set_address %i", &addr); - if (res == 1) { - cc1100_set_address((radio_address_t)addr); - printf("Setting cc1100 address to %i: ", addr); - if (cc1100_get_address() == (radio_address_t)addr) { +void _cc110x_get_set_channel_handler(char *addr) { + int16_t a; + + a = atoi(addr+5); + if (strlen(addr) > 5) { + printf("[cc110x] Setting channel %i...", a); + cc1100_set_channel(a); + if (cc1100_get_channel() == a) { puts("OK"); } else { puts("Error!"); } - } else { - puts("usage: cc1100_set_address
"); + } + else { + printf("[cc1100] Got address: %i\n", cc1100_get_channel()); } } - #endif diff --git a/sys/shell/id.c b/sys/shell/id.c index 414997bac5..3807484ff3 100644 --- a/sys/shell/id.c +++ b/sys/shell/id.c @@ -8,7 +8,9 @@ void _id_handler(char *id) { newid = atoi(id+3); if (strlen(id) < 3) { +#ifdef MODULE_CONFIG printf("Current id: %u\n", sysconfig.id); +#endif } else { printf("Setting new id %lu\n", newid); diff --git a/sys/shell/shell_commands.c b/sys/shell/shell_commands.c index dd5372b99a..6023faf2a9 100644 --- a/sys/shell/shell_commands.c +++ b/sys/shell/shell_commands.c @@ -24,8 +24,8 @@ extern void _reset_current_handler(char* unused); #endif #ifdef MODULE_CC110X -extern void _cc110x_get_address_handler(char *unused); -extern void _cc110x_set_address_handler(char *ptr); +extern void _cc110x_get_set_address_handler(char *addr); +extern void _cc110x_get_set_channel_handler(char *addr); #endif #ifdef MODULE_TRANSCEIVER @@ -56,8 +56,8 @@ const shell_command_t _shell_command_list[] = { {"rstcur", "Resets coulomb counter.", _reset_current_handler}, #endif #ifdef MODULE_CC110X - {"cc110x_get_address", "", _cc110x_get_address_handler}, - {"cc110x_set_address", "", _cc110x_set_address_handler}, + {"addr", "Gets or sets the address for the CC1100 transceiver", _cc110x_get_set_address_handler}, + {"chan", "Gets or sets the channel for the CC1100 transceiver", _cc110x_get_set_channel_handler}, #endif #ifdef MODULE_TRANSCEIVER #ifdef MODULE_CC110X_NG