Slave Implementation of WANOT Slave
Dependencies: SX1276Lib mbed-src
Diff: SuperSlot.cpp
- Revision:
- 0:80ebf9b1dd4f
diff -r 000000000000 -r 80ebf9b1dd4f SuperSlot.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SuperSlot.cpp Mon May 23 22:28:07 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