예제 #1
0
void systemSetup(GlobalState *data) {

    rs232Setup2(); // configure USART2
    rs232Setup1(); // configure USART1
    i2CSetup();
    RFIDSetup();

#if FRONT_NOT_BACK
    initSPI1();
    initLCD();
    keypadSetup(); // configure keypad
    setupPWM();
#else
    LEDSetup();
#endif
    data->myRequestStatus = 0;
    data->displayPage = 0;
    data->keyFlag = FALSE;
    data->displayedKey = FALSE;
    data->keyPress = -1;
    data->cursorPos = 0;
    // Select Game Menu
    data->mode = -1;
    data->game = -1;
    // Find better way to do this
    data->mainMenuSpots[0] = 40;
    data->mainMenuSpots[1] = 80;
    data->mainMenuSpots[2] = 120;
    data->getInventory = FALSE;
    data->xbeeFlag = FALSE;
    data->goBack = FALSE;
    // Game Related Globals
    data->keyStatus = -1;
    memset(data->selectMove, 0, sizeof (int) * 4 * 3);
    data->selectMove[0][1] = 10;
    data->cardSelect[0] = 1;
    data->cardSelect[1] = 0;
    data->cardSelect[2] = 0;
    data->cardSelect[3] = 0;
    data->firstTime = TRUE;
    data->updateLEDFlag = TRUE;
    data->lastCards = 0;
    data->readCard = 0;
    data->dataBlockNum = 0;
    data->dataSlotNum = 0;
    memset(data->dataBlock, 0, sizeof (char) * CARDBLOCKSIZE);
    data->runGetUpdatedCards = FALSE;
    data->gotI2C = 0;
    data->sendI2C = 0;
    data->displayPage = 0;
    data->newDisplay = 0;
    data->newGame = 1;
    data->newKeyboard = 1;
    data->doneKeyboard = 0;
    OpenTimer0(TIMER_INT_OFF & T0_SOURCE_INT & T0_PS_1_32);

    return;
}
void main(void)
{
	WDTCTL = WDTPW | WDTHOLD;       //stop watchdog timer

	LEDSetup();
	buttonSetup();
	timerSetup();
	
	_BIS_SR(GIE);   //global interrupts enabled
	while(1)
	{

	}
}