1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/shell/commands/sc_cc1100.c

69 lines
1.4 KiB
C

/**
* Shell commands for the cc110x driver without a transceiver
*
* Copyright (C) 2013 INRIA.
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License. See the file LICENSE in the top level directory for more
* details.
*
* @ingroup shell_commands
* @{
* @file sc_cc1100.c
* @brief provides shell commands to configure the cc110x driver
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @author Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
* @}
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "cc110x.h"
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 _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 {
printf("[cc1100] Got address: %i\n", cc1100_get_channel());
}
}