From a39f7557428cdec2919b418cfcfbc1a3adb6b66a Mon Sep 17 00:00:00 2001 From: mmaroti Date: Sat, 27 Mar 2010 22:03:27 +0000 Subject: [PATCH] add support for IRIS (it was CC2420 specific) Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ --- apps/IPBaseStation/BaseStationC.nc | 4 ++++ apps/IPBaseStation/BaseStationP.nc | 18 +++++++++++++++--- apps/IPBaseStation/Reset.h | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/apps/IPBaseStation/BaseStationC.nc b/apps/IPBaseStation/BaseStationC.nc index 8c53be0a..cbb067a9 100644 --- a/apps/IPBaseStation/BaseStationC.nc +++ b/apps/IPBaseStation/BaseStationC.nc @@ -133,6 +133,10 @@ implementation { components IPAddressC; BaseStationP.IPAddress -> IPAddressC; +#ifdef PLATFORM_IRIS + BaseStationP.RadioChannel -> Radio; +#else components CC2420ControlC; BaseStationP.CC2420Config -> CC2420ControlC; +#endif } diff --git a/apps/IPBaseStation/BaseStationP.nc b/apps/IPBaseStation/BaseStationP.nc index 71645ca9..0a27e04e 100644 --- a/apps/IPBaseStation/BaseStationP.nc +++ b/apps/IPBaseStation/BaseStationP.nc @@ -65,7 +65,6 @@ */ #ifndef SIM -#include "CC2420.h" #endif #include "AM.h" #include "Serial.h" @@ -95,7 +94,12 @@ module BaseStationP { interface PacketLink; interface LowPowerListening; + +#ifdef PLATFORM_IRIS + interface RadioChannel; +#else interface CC2420Config; +#endif interface Leds; @@ -410,10 +414,16 @@ implementation case CONFIG_ECHO: break; case CONFIG_SET_PARM: +#ifdef PLATFORM_IRIS + // we should check the return value, hope it works + call RadioChannel.setChannel(cmd->rf.channel); + call IPAddress.setShortAddr(cmd->rf.addr); +#else call CC2420Config.setChannel(cmd->rf.channel); // IPAddress calls sync() for you, I think, so we'll put it second call IPAddress.setShortAddr(cmd->rf.addr); call CC2420Config.sync(); +#endif radioRetries = cmd->retx.retries; radioDelay = cmd->retx.delay; break; @@ -430,10 +440,12 @@ implementation return msg; } - +#ifdef PLATFORM_IRIS + event void RadioChannel.setChannelDone() { } +#else event void CC2420Config.syncDone(error_t error) { - } +#endif event void ConfigureSend.sendDone(message_t *msg, error_t error) { echo_busy = FALSE; diff --git a/apps/IPBaseStation/Reset.h b/apps/IPBaseStation/Reset.h index 59951ef3..550d5c29 100644 --- a/apps/IPBaseStation/Reset.h +++ b/apps/IPBaseStation/Reset.h @@ -44,7 +44,7 @@ void resetMote() { -#if defined(PLATFORM_MICA) || defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT) || defined(PLATFORM_MICAZ) +#if defined(PLATFORM_MICA) || defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT) || defined(PLATFORM_MICAZ) || defined(PLATFORM_IRIS) cli(); wdt_enable(0); while (1) { -- 2.39.2