houss red
/
Master_F
Master Implementation of WANOT
Diff: SuperSlot.cpp
- Revision:
- 0:8b449140caa2
diff -r 000000000000 -r 8b449140caa2 SuperSlot.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SuperSlot.cpp Mon May 23 22:25:40 2016 +0000 @@ -0,0 +1,41 @@ +#include "WANOT.h" + +/* + * Global variables declarations + */ + +volatile SuperSlotStates SuperSlotState = SetUp_Beacon_Phase; +Timeout SwitchState; + +void SwitchState_Fn(void) +{ + switch(SuperSlotState) { + case SetUp_Beacon_Phase: + debug("Switching to SetUp Phase State !!\n\r"); + SuperSlotState = SetUp_Phase; + SwitchState.attach(&SwitchState_Fn,SET_UP_INTERVAL); + break; + + case SetUp_Phase: + debug("Switching to TDMA Phase State !!\n\r"); + SuperSlotState = TDMA_Phase; + SwitchState.attach(&SwitchState_Fn,TDMA_INTERVAL); + break; + + case TDMA_Phase: + debug("SuperSlot States finished\n\r\n\r\n\r"); + debug("Switching to SetUp Beacon State !! \n\r"); + SuperSlotState = SetUp_Beacon_Phase; + SwitchState.attach(&SwitchState_Fn, BEACON_SET_UP_INTERVAL); + break; + + } +} + +void SuperSlotInit () +{ + + debug("Switching to SetUp Beacon State !! \n\r"); + SuperSlotState = SetUp_Beacon_Phase; + SwitchState.attach(&SwitchState_Fn, BEACON_SET_UP_INTERVAL); +} \ No newline at end of file