Master Implementation of WANOT

Dependencies:   SX1276Lib mbed

main.cpp

Committer:
semsem
Date:
2016-05-23
Revision:
0:8b449140caa2

File content as of revision 0:8b449140caa2:

#include"WANOT.h"

/*
 *  Global variables declarations
 */

/*!
 * Radio events function pointer
 */
RadioEvents_t RadioEvents;
SX1276MB1xAS Radio(NULL);

extern SuperSlotStates SuperSlotState;

Timer timer;
int begin, end;

int main()
{

    // verify the connection with the board
    while (Radio.Read(REG_VERSION) == 0x00) {
        debug("Radio could not be detected!\n\r\r", NULL);
        wait(1);
    }
    debug("WANOT Master Started...\n\r");

    char StoreRead[50];
    GPS_Read(StoreRead);

    SuperSlotInit();
    
    uint8_t SlaveLocalID = 1;

    while(1)    {

        switch(SuperSlotState) {
            case SetUp_Beacon_Phase:
                SetUp_Beacon();
                break;

            case SetUp_Phase:
                MasterSetUp();
                break;

            case TDMA_Phase:
                MasterTDMA(SlaveLocalID);
                SlaveLocalID++;
                break;

        }
    }

}