uses interface CC2420Strobe as SFLUSHRX;
uses interface CC2420Register as TXCTRL;
uses interface AMPacket;
-
uses interface Resource as SpiResource;
-
- uses interface Leds;
uses interface FrameUtility;
}
signal Resource.granted();
}
- void switchToUnbufferedMode()
- {
- uint16_t mdmctrol1;
- call CSN.set();
- call CSN.clr();
- call MDMCTRL1.read(&mdmctrol1);
- call CSN.set();
- mdmctrol1 &= ~0x0003;
- mdmctrol1 |= 0x0000;
- call CSN.clr();
- call MDMCTRL1.write(mdmctrol1);
- call CSN.set();
- }
-
- void switchToBufferedMode()
- {
- uint16_t mdmctrol1;
- call CSN.set();
- call CSN.clr();
- call MDMCTRL1.read(&mdmctrol1);
- mdmctrol1 &= ~0x03;
- call MDMCTRL1.write(mdmctrol1);
- call CSN.set();
- }
-
/***************** CC2420Power Commands ****************/
async command error_t CC2420Power.startVReg() {
atomic {
// Always read at least one byte from the RXFIFO before
// issuing the SFLUSHRX command strobe" (CC2420 Datasheet)
call CSN.clr();
- call RXFIFO_REGISTER.read(&dummy); // reading 1 byte would be enough...
+ call RXFIFO_REGISTER.read(&dummy); // reading the byte
call CSN.set();
call CSN.clr();
// "SFLUSHRX command strobe should be issued twice to ensure
async command bool CC2420Config.needsSync(){
atomic return m_needsSync;
}
+
/**
* Sync must be called to commit software parameters configured on
* the microcontroller (through the CC2420Config interface) to the
/***************** StartupAlarm Events ****************/
async event void StartupAlarm.fired() {
if ( m_state == S_VREG_STARTING ) {
- cc2420_status_t status;
- do {
- status = call SNOP.strobe();
- } while (!(status & CC2420_STATUS_XOSC16M_STABLE));
m_state = S_VREG_STARTED;
call RSTN.clr();
call RSTN.set();