Simple version of COM_MNG_TMTC_CODE for IITMSAT.

Dependencies:   mbed-rtos mbed FreescaleIAP SimpleDMA

COM_POWER_OFF_TX.h

Committer:
aniruddhv
Date:
2016-03-24
Revision:
137:489a93a04d6b
Parent:
12:ffdb29353058
Child:
144:4c20fcc105ce

File content as of revision 137:489a93a04d6b:

#define power_on_bae {\
    /*PENDING*/\
}

#define resume_bcn {\
    Base_tc *beacon_tc = new Short_tc;\
    beacon_tc->next_TC = NULL;\
    PUTshort_or_long(beacon_tc,0);\
    PUTcrc_pass(beacon_tc,0x1);\
    PUTexec_status(beacon_tc,0);\
    beacon_tc->TC_string[0] = 0x01;\
    beacon_tc->TC_string[1] = 0x41;\
    beacon_tc->TC_string[2] = 0x65;\
    beacon_tc->TC_string[3] = 0x11;\
    beacon_tc->TC_string[4] = 0x00;\
    beacon_tc->TC_string[5] = 0;\
    beacon_tc->TC_string[6] = 0;\
    beacon_tc->TC_string[7] = 0;\
    beacon_tc->TC_string[8] = 0x01;\
    uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\
    beacon_tc->TC_string[9]  = (crc16 & 0xFF00)>>8;\
    beacon_tc->TC_string[10] = (crc16 & 0x00FF);\
    Base_tm *tm_ptr = new Short_tm;\
    tm_ptr =  FCTN_CDMS_RLY_TMTC(beacon_tc);\
}

#define COM_POWER_OFF_TX {\
    /*gPC.puts("Inside COM_POWER_OFF_TX\r\n");*/\
    /*PENDING: POWER OFF TRANSMITTER*/\
    /*power_on_com_tx_pin = 0;*/\
    RX1M.attach(&rx_read, Serial::RxIrq);\
    gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
    /*PENDING: SWITCH RF RELAY TO BEACON*/\
    gFLAGS = gFLAGS | RF_SW_STATUS_FLAG;\
    if( gFLAGS & COM_AUTO_POWER_OFF_BAE_FLAG ){\
        power_on_bae;\
        gFLAGS = gFLAGS | BAE_SW_EN_FLAG;\
        gFLAGS & (~COM_AUTO_POWER_OFF_BAE_FLAG);\
        resume_bcn;\
    }\
    else{\
        if( gFLAGS & BAE_SW_EN_FLAG ){\
            resume_bcn;\
        }\
    }\
    gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);\
    gCOM_PA_COOLING_TIMEOUT.detach();\
    gFLAGS = gFLAGS & (~COM_TX_FLAG);\
    gFLAGS = gFLAGS & (~COM_SESSION_TIMEOUT_FLAG);\
    /*gPC.puts("completed com_power_off tx\r\n");*/\
}