2015-02-12 18:06:34 +01:00
|
|
|
/*
|
2013-06-22 05:11:53 +02:00
|
|
|
* Copyright (C) 2013 INRIA.
|
|
|
|
*
|
2014-07-31 19:45:27 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2015-02-12 18:06:34 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup sys_shell_commands
|
2013-06-22 05:11:53 +02:00
|
|
|
* @{
|
2015-02-12 18:06:34 +01:00
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Provides shell commands to configure the cc110x driver
|
|
|
|
*
|
|
|
|
* @author Oliver Hahm <oliver.hahm@inria.fr>
|
|
|
|
* @author Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
|
|
|
|
*
|
2013-06-22 05:11:53 +02:00
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2010-11-09 17:08:54 +01:00
|
|
|
#include <stdio.h>
|
2011-04-06 11:11:03 +02:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2013-06-22 05:11:53 +02:00
|
|
|
|
2014-10-26 22:02:18 +01:00
|
|
|
#include "cc110x_legacy_csma.h"
|
2013-06-22 05:11:53 +02:00
|
|
|
|
2012-03-01 22:12:25 +01:00
|
|
|
|
2014-02-21 19:10:24 +01:00
|
|
|
void _cc110x_get_set_address_handler(int argc, char **argv)
|
2013-06-22 05:11:53 +02:00
|
|
|
{
|
2014-02-21 19:10:24 +01:00
|
|
|
if (argc > 1) {
|
|
|
|
int16_t a = atoi(argv[1]);
|
2011-04-06 11:11:03 +02:00
|
|
|
|
|
|
|
printf("[cc110x] Setting address %i ... ", a);
|
|
|
|
cc1100_set_address((radio_address_t)a);
|
2013-06-22 05:11:53 +02:00
|
|
|
|
2013-06-24 22:37:35 +02:00
|
|
|
if (cc1100_get_address() == (radio_address_t)a) {
|
2011-04-06 11:11:03 +02:00
|
|
|
puts("[OK]");
|
2013-06-22 05:11:53 +02:00
|
|
|
}
|
|
|
|
else {
|
2011-04-06 11:11:03 +02:00
|
|
|
puts("Error!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
printf("[cc1100] Got address: %i\n", cc1100_get_address());
|
|
|
|
}
|
2010-11-09 17:08:54 +01:00
|
|
|
}
|
|
|
|
|
2014-02-21 19:10:24 +01:00
|
|
|
void _cc110x_get_set_channel_handler(int argc, char **argv)
|
2013-06-22 05:11:53 +02:00
|
|
|
{
|
2014-02-21 19:10:24 +01:00
|
|
|
if (argc > 1) {
|
|
|
|
int16_t a = atoi(argv[1]);
|
2013-06-22 05:11:53 +02:00
|
|
|
|
2011-04-06 11:11:03 +02:00
|
|
|
printf("[cc110x] Setting channel %i...", a);
|
|
|
|
cc1100_set_channel(a);
|
2013-06-22 05:11:53 +02:00
|
|
|
|
2013-06-24 22:37:35 +02:00
|
|
|
if (cc1100_get_channel() == a) {
|
2010-11-09 17:08:54 +01:00
|
|
|
puts("OK");
|
2013-06-22 05:11:53 +02:00
|
|
|
}
|
|
|
|
else {
|
2010-11-09 17:08:54 +01:00
|
|
|
puts("Error!");
|
|
|
|
}
|
2011-04-06 11:11:03 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
printf("[cc1100] Got address: %i\n", cc1100_get_channel());
|
2010-11-09 17:08:54 +01:00
|
|
|
}
|
|
|
|
}
|