Added channel_get() to the cc2x3x RF drivers

ico
George Oikonomou 2012-04-30 17:04:55 +01:00
parent d66241fd97
commit 43f2790357
5 changed files with 15 additions and 8 deletions

View File

@ -104,6 +104,7 @@ PROCESS(cc2430_rf_process, "CC2430 RF driver");
/*---------------------------------------------------------------------------*/
static uint8_t rf_initialized = 0;
static uint8_t __data rf_flags;
static uint8_t rf_channel;
static int on(void); /* prepare() needs our prototype */
static int off(void); /* transmit() needs our prototype */
@ -194,9 +195,17 @@ cc2430_rf_channel_set(uint8_t channel)
cc2430_rf_command(ISRXON);
rf_channel = channel;
return (int8_t) channel;
}
/*---------------------------------------------------------------------------*/
uint8_t
cc2430_rf_channel_get()
{
return rf_channel;
}
/*---------------------------------------------------------------------------*/
/**
* Select RF transmit power.
*

View File

@ -74,6 +74,7 @@ extern const struct radio_driver cc2430_rf_driver;
void cc2430_rf_command(uint8_t command);
int8_t cc2430_rf_channel_set(uint8_t channel);
uint8_t cc2430_rf_channel_get();
uint8_t cc2430_rf_power_set(uint8_t new_power);
void cc2430_rf_set_addr(unsigned pan, unsigned addr, const uint8_t *ieee_addr);

View File

@ -121,6 +121,7 @@
extern const struct radio_driver cc2530_rf_driver;
/*---------------------------------------------------------------------------*/
int8_t cc2530_rf_channel_set(uint8_t channel);
#define cc2530_rf_channel_get() ((uint8_t)((FREQCTRL + 44) / 5))
uint8_t cc2530_rf_power_set(uint8_t new_power);
void cc2530_rf_set_addr(uint16_t pan);
/*---------------------------------------------------------------------------*/

View File

@ -39,7 +39,7 @@
#include "dev/watchdog.h"
#include "dev/slip.h"
#include "dev/leds.h"
#include "cc253x.h"
#include "dev/cc2530-rf.h"
static uint8_t prefix_set;
/*---------------------------------------------------------------------------*/
@ -116,9 +116,9 @@ PROCESS_THREAD(border_router_process, ev, data)
leds_off(LEDS_GREEN);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
}
cc2530_rf_channel_get();
/* We have created a new DODAG when we reach here */
PRINTF("On Channel %u\n", (uint8_t)((FREQCTRL + 44) / 5));
printf("On Channel %u\n", cc2530_rf_channel_get());
print_local_addresses();

View File

@ -40,10 +40,6 @@
#include "dev/slip.h"
#include "dev/leds.h"
#ifndef CC2430_RF_CONF_CHANNEL
#define CC2430_RF_CONF_CHANNEL 0xFF
#endif
static uint8_t prefix_set;
/*---------------------------------------------------------------------------*/
PROCESS(border_router_process, "Border Router process");
@ -123,7 +119,7 @@ PROCESS_THREAD(border_router_process, ev, data)
}
/* We have created a new DODAG when we reach here */
PRINTF("On Channel %u\n", CC2430_RF_CONF_CHANNEL);
PRINTF("On Channel %u\n", cc2430_rf_channel_get());
print_local_addresses();