Example #1
0
//constructor called from GUI
scannar::scannar(string str):
    lineNumber(1),
    found(false),
    numOfOp(0)

{

    srcCode = str;
    initialiseMap();

}
Example #2
0
/*
=================================================================
Defualt Constructor
=================================================================
*/
cTileMap::cTileMap(vector<cTexture*> tileTextList, int tMap[][8])
{
	spritePos2D.x = 0.0f;
	spritePos2D.y = 0.0f;
	setSpriteTexCoordData();
	spriteTranslation = glm::vec2(0.0f, 0.0f);
	spriteScaling = glm::vec2(1.0f, 1.0f);
	spriteRotation = 0.0f;
	spriteCentre = glm::vec2(0.0f, 0.0f);
	tileTextureList = tileTextList;
	initialiseMap(tMap);
}
Example #3
0
int main(void)
{

	/* Disable watchdog: not required for this application */

	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	setupStateMachine();

	setupTimer();

	setupIO();

	initialiseMap();

	UART_Init(UART0, 9600, 32, 32, false);

	I2C_SetPrescaler(64);
	DS3231_Init();

	UC_BTN_Init(APP_TICK_MS);

	TLC5916_Init(&tlc, SR_ShiftOut, tlcLatchFn, tlcOEFn);

	TLC5916_OutputEnable(&tlc, true);

	uint8_t displayBytes[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	TLC5916_ClockOut(displayBytes, 10, &tlc);

	/* All processing interrupt based from here */
	
	sei();

	/* First get the time from the DS3231.
	 * Don't worry about the state machine or any events, just get the time
	 * and see if it's greater than the compile time
	 */

	DS3231_ReadDeviceDateTime(NULL);

	while ( !DS3231_IsIdle() ) { I2C_Task(); }
	DS3231_GetDateTime(&tm);

	DS3231_SetRate(DS3231_RATE_1HZ);
	DS3231_SQWINTControl(DS3231_SQW);
	DS3231_UpdateControl();

	while ( !DS3231_IsIdle() ) { I2C_Task(); }

	s_unixtime = time_to_unix_seconds(&tm);

	if (s_unixtime < COMPILE_TIME_INT)
	{
		TM compile_time = COMPILE_TIME_STRUCT;
		DS3231_SetDeviceDateTime(&compile_time, false, NULL);

		while ( !DS3231_IsIdle() ) { I2C_Task(); }

		s_unixtime = COMPILE_TIME_INT;
	}
	
	updateUnixTimeDigits();
	
	//putTimeToUART();
	
	s_displayDirty = true;
	
	while (true)
	{
		
		if (TMR8_Tick_TestAndClear(&appTick))
		{
			applicationTick();
		}

		if (TMR8_Tick_TestAndClear(&heartbeatTick))
		{
			s_BlinkState = !s_BlinkState;
			s_displayDirty |= true;
		}

		if (PCINT_TestAndClear(secondTickVector))
		{
			s_bTick = !s_bTick;
			if (s_bTick && (SM_GetState(&sm) == (SM_STATEID)DISPLAY))
			{
				s_unixtime++;
				updateUnixTimeDigits();
				s_displayDirty |= true;
			}
			
			for(uint8_t i = 0; i < (uint8_t)SM_GetState(&sm); ++i)
			{
				//IO_Control(HB_PORT, HB_PIN, IO_OFF);
				//IO_Control(HB_PORT, HB_PIN, IO_ON);
			}
		}
		
		if (s_displayDirty)
		{
			updateDisplay();
			s_displayDirty |= false;
		}

		I2C_Task();
	}
}