Example #1
0
// Run the function of the next state
void state() {

    switch (NEXT_STATE) {

    case STATE_NO_SD:
        STATE = STATE_NO_SD;
        noSD();
        break;

    case STATE_SD_SETUP:
        STATE = STATE_SD_SETUP;
        sdSetup();
        break;

    case STATE_STANDBY:
        STATE = STATE_STANDBY;
        standby();
        break;

    case STATE_DATA_SETUP:
        STATE = STATE_DATA_SETUP;
        dataSetup();
        break;

    case STATE_DATA_COLLECT:
        STATE = STATE_DATA_COLLECT;
        dataCollect_fixed();
        break;

    case STATE_DATA_CONCLUDE:
        STATE = STATE_DATA_CONCLUDE;
        dataConclude();
        break;

    case STATE_WARNING:
        STATE = STATE_WARNING;
        warning();
        break;

    case STATE_ERROR:
        STATE = STATE_ERROR;
        error();
        break;

    } // End of switch

} // End of state
Example #2
0
int main(void)
{	
    // Bring all Outputs Low
    LATB = 0x0000;
    LATD = 0x0000;
    LATF = 0x0000;
    LATG = 0x0000;

    // Disable analog I/O on PORT B and G
    ANSB = 0x0000;
    ANSG = 0x0000;

    // Setup the GPS and USB UART
    usbSetup();
    gpsSetup();
    gsmSetup();
    sdSetup();

    // Clear and enable GSM and USB interrupts
    U1RX_Clear_Intr_Status_Bit;
    U3RX_Clear_Intr_Status_Bit;
    EnableIntU1RX;
    EnableIntU3RX;
    
    // Clear and enable GPS interrupt
//    U2RX_Clear_Intr_Status_Bit;
//    EnableIntU2RX;

    // Set up to echo GPS data
//    sendCommand(PMTK_SET_BAUD_9600);
//    DELAY_MS(100);
//    sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
//    sendCommand(PMTK_SET_NMEA_OUTPUT_OFF);    // Enable for log dump
//    DELAY_MS(100);
//    sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);      // Disable for log dump
//    DELAY_MS(100);

    // Start GPS data logger
//    startLOCUS();

    strToUSB("Starting SM5100B Communication...\n");

    // Loop Forever
    while(1)
    {
        blink(LED_GRN_P42);
        DELAY_MS(1000);

        // Print out logger info
//        displayLOCUSInfo();

    }

    // Disable Interrupts and close UART
    DisableIntU1RX;
    DisableIntU2RX;
    DisableIntU3RX;
    CloseUART1();
    CloseUART2();
    CloseUART3();
    
}