Master Implementation of WANOT

Dependencies:   SX1276Lib mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SuperSlot.cpp Source File

SuperSlot.cpp

00001 #include "WANOT.h"
00002 
00003 /*
00004  *  Global variables declarations
00005  */
00006 
00007 volatile SuperSlotStates SuperSlotState = SetUp_Beacon_Phase;
00008 Timeout SwitchState;
00009 
00010 void SwitchState_Fn(void)
00011 {
00012     switch(SuperSlotState) {
00013         case SetUp_Beacon_Phase:
00014             debug("Switching to SetUp Phase State !!\n\r");
00015             SuperSlotState = SetUp_Phase;
00016             SwitchState.attach(&SwitchState_Fn,SET_UP_INTERVAL);
00017             break;
00018 
00019         case SetUp_Phase:
00020             debug("Switching to TDMA Phase State !!\n\r");
00021             SuperSlotState = TDMA_Phase;
00022             SwitchState.attach(&SwitchState_Fn,TDMA_INTERVAL);
00023             break;
00024 
00025         case TDMA_Phase:
00026             debug("SuperSlot States finished\n\r\n\r\n\r");
00027             debug("Switching to SetUp Beacon State !! \n\r");
00028             SuperSlotState = SetUp_Beacon_Phase;
00029             SwitchState.attach(&SwitchState_Fn, BEACON_SET_UP_INTERVAL);
00030             break;
00031 
00032     }
00033 }
00034 
00035 void SuperSlotInit ()
00036 {
00037 
00038     debug("Switching to SetUp Beacon State !! \n\r");
00039     SuperSlotState = SetUp_Beacon_Phase;
00040     SwitchState.attach(&SwitchState_Fn, BEACON_SET_UP_INTERVAL);
00041 }