Master Implementation of WANOT

Dependencies:   SX1276Lib mbed

Committer:
semsem
Date:
Mon May 23 22:25:40 2016 +0000
Revision:
0:8b449140caa2
V0.2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
semsem 0:8b449140caa2 1 #include "WANOT.h"
semsem 0:8b449140caa2 2
semsem 0:8b449140caa2 3 /*
semsem 0:8b449140caa2 4 * Global variables declarations
semsem 0:8b449140caa2 5 */
semsem 0:8b449140caa2 6
semsem 0:8b449140caa2 7 volatile SuperSlotStates SuperSlotState = SetUp_Beacon_Phase;
semsem 0:8b449140caa2 8 Timeout SwitchState;
semsem 0:8b449140caa2 9
semsem 0:8b449140caa2 10 void SwitchState_Fn(void)
semsem 0:8b449140caa2 11 {
semsem 0:8b449140caa2 12 switch(SuperSlotState) {
semsem 0:8b449140caa2 13 case SetUp_Beacon_Phase:
semsem 0:8b449140caa2 14 debug("Switching to SetUp Phase State !!\n\r");
semsem 0:8b449140caa2 15 SuperSlotState = SetUp_Phase;
semsem 0:8b449140caa2 16 SwitchState.attach(&SwitchState_Fn,SET_UP_INTERVAL);
semsem 0:8b449140caa2 17 break;
semsem 0:8b449140caa2 18
semsem 0:8b449140caa2 19 case SetUp_Phase:
semsem 0:8b449140caa2 20 debug("Switching to TDMA Phase State !!\n\r");
semsem 0:8b449140caa2 21 SuperSlotState = TDMA_Phase;
semsem 0:8b449140caa2 22 SwitchState.attach(&SwitchState_Fn,TDMA_INTERVAL);
semsem 0:8b449140caa2 23 break;
semsem 0:8b449140caa2 24
semsem 0:8b449140caa2 25 case TDMA_Phase:
semsem 0:8b449140caa2 26 debug("SuperSlot States finished\n\r\n\r\n\r");
semsem 0:8b449140caa2 27 debug("Switching to SetUp Beacon State !! \n\r");
semsem 0:8b449140caa2 28 SuperSlotState = SetUp_Beacon_Phase;
semsem 0:8b449140caa2 29 SwitchState.attach(&SwitchState_Fn, BEACON_SET_UP_INTERVAL);
semsem 0:8b449140caa2 30 break;
semsem 0:8b449140caa2 31
semsem 0:8b449140caa2 32 }
semsem 0:8b449140caa2 33 }
semsem 0:8b449140caa2 34
semsem 0:8b449140caa2 35 void SuperSlotInit ()
semsem 0:8b449140caa2 36 {
semsem 0:8b449140caa2 37
semsem 0:8b449140caa2 38 debug("Switching to SetUp Beacon State !! \n\r");
semsem 0:8b449140caa2 39 SuperSlotState = SetUp_Beacon_Phase;
semsem 0:8b449140caa2 40 SwitchState.attach(&SwitchState_Fn, BEACON_SET_UP_INTERVAL);
semsem 0:8b449140caa2 41 }