Esempio n. 1
0
void WorldInit()
{
	TimeSeedGenerator();
	DisplayInit();
	InitGame();
	LoadGame("Scenarios\\default.xml");
}
Esempio n. 2
0
int DrawInit(void)
{
	int iError;
	iError = DisplayInit();
	if (iError)
	{
		printf("DisplayInit error!\n");
		return -1;
	}

	iError = FontsInit();
	if (iError)
	{
		printf("FontsInit error!\n");
		return -1;
	}

	iError = EncodingInit();
	if (iError)
	{
		printf("EncodingInit error!\n");
		return -1;
	}
	return 0;
}
Esempio n. 3
0
void CoShutdown(int mode)
{
	if (!DisplayIsOn()) {
		DisplayInit();
	}

	DisplayString("Shutting down.\n");
	DisplayString("Done.\n");

	switch (mode) {
	case SD_WAIT:
		while (1)
			;
	case SD_OFF:
		HalShutdown();
		break;
	case SD_REBOOT:
		HalReboot();
		while (1)
			;
	default:
		while (1)
			;
	}
}
Esempio n. 4
0
int main(void) {
	PreSetupHardware();
	UartDebugInit();
	RtcInit();
#if defined(__SPKEAER__)
	SoundControlInit();
#endif
	XfsInit();
	GSMInit();
#if defined(__LED__)
	DisplayInit();
	SevenSegLedInit();
	SHT10TestInit();
#endif
	vTaskStartScheduler();
	return 0;
}
Esempio n. 5
0
static int __init PlayerLoadModule (void)
{

    report_init ();
    report_restricted_severity_levels(severity_fatal, severity_interrupt * 10);

    DisplayInit ();
    BackendInit ();

    register_dvb_backend       (MODULE_NAME, &DvbBackendOps);
    register_alsa_backend      (MODULE_NAME, &AlsaBackendOps);
#if defined (CONFIG_EXPORT_PLAYER_INTERFACE)
    register_player_interface  (MODULE_NAME, &PlayerInterfaceOps);
#endif

    PLAYER_DEBUG("Player2 backend loaded\n");

    return 0;
}
Esempio n. 6
0
File: stop.c Progetto: temoto/k411
void KernelStop(uint32_t error, uint32_t arg1, uint32_t arg2, uint32_t arg3, uint32_t arg4)
{
	if (in_stop) {
		/* Its recursive! */
		HalShutdown();
	}
	in_stop = 1;

	DisplayInit();
	DisplaySetAttr(0x4f);
	DisplayClear();

	DisplayString("An error has occured and Dux has been shutdown to prevent damage.\n\n");

	printf("STOP: %x (%x, %x, %x, %x)\n", error, arg1, arg2, arg3, arg4);
 
#ifdef DEBUG
	DisplayString("BREAK\n");
	HalBreak();
#else
	HalShutdown();
#endif
}
Esempio n. 7
0
int main()
{
	uint32_t i;
	int j;
	char uart_str[DISPLAY_CHARS_W+1];
	uart_str[DISPLAY_CHARS_W] = '\0';

	BoardInit(DCO_FREQ_16MHZ, LF_SRC_VLOCLK, CLK_DCO_1, CLK_LF_8);
	I2C_Init( I2C_MODE_MASTER, I2C_SMCLK_SRC );
	//UART_Init();
	__enable_interrupt();
	DisplayInit();
	DisplaySetMirror(1,1);
	DisplaySetVop(127);
	DisplaySetInversion(0);
	DisplayClear();

	const char* lines[] = {
			"Line 1\n",
			"Line 2\n",
			"Line 3\n",
			"4\n","5\n","6\n","7\n","8\n"};
	DisplayPut(img, sizeof img);
	DisplayPrint(lines[0]);
	DumbDelay(100);
	DisplaySetPos(DISPLAY_W_DOTS - DISPLAY_FONT_W * (strlen(lines[1])-1), DISPLAY_CHARS_H-1);
	DisplayPrint(lines[1]);
	j=0;
	while(1) {
		DumbDelay(1000);
		BoardLedToggle();
		//UART_Read(uart_str, DISPLAY_CHARS_W);
		//DisplayPrint(uart_str);
		//DisplayPrint("\n");
	}
}
Esempio n. 8
0
/***************************************************************************
 *   \brief initializes/restarts game (display, player position, enemies,...)
 *   \return void
 ***************************************************************************/
void GC_initGame()
{
  int i,j;
  
  // Initialize Display
  DisplayInit();
  DelayMs(200);
  
  // Initialize StateRegister
  stateRegister.restart = 0;
  stateRegister.shoot = 0;
  stateRegister.move = 0;
  stateRegister.finished = 0;
  
  //Initialize ShotArray
  for(i = SI_MAXSHOTS; i > 0 ; i--)
  {
    shotArray[i-1].x = 0;
    shotArray[i-1].y = 0;
  }
  
  //Initialize Player
  playerPositionX = SI_DISPWIDTH/2 - PL_SYMBOLWIDTH/2;
  //printf("playerPositionX = %d\n",playerPositionX);
  PL_drawPlayer(playerPositionX);
  
  //initialize enemy Line
  for(i = SI_ENEMYLINES; i > 0; i--)
  {
    for(j = EN_LOCATIONWIDTH; j > 0; j--)
      enemyArray[i-1].enemyLocations[j-1] = 0;
    EN_drawEnemyLine(i-1);
  }  
  
  //printf("GC_initGame(): Done\n");
}
Esempio n. 9
0
int main(int argc, char *argv[])  
{
	int iError;
	
	struct PageIdetify tPageIdetify;
	struct PageOpr *ptMainPageOpr;

	iError = PrintDeviceInit();
	if(iError){
		DebugPrint("Print device init error\n");
		goto error_exit;
	}
	DebugPrint("\nSupported print device\n");
	ShowPrintOpr();

	if(argc != 2){
		DebugPrint(DEBUG_ERR"exe <fontfile>\n");
		return -1;
	}

	iError = EncodingInit();
	if(iError){
		DebugPrint("Encoding init error\n");
		goto error_exit;
	}
	DebugPrint("\nSupported encoding\n");
	ShowEncodingOpr();

	iError = FontInit();
	if(iError){
		DebugPrint("Font init error\n");
		goto error_exit;
	}
	DebugPrint("\nSupported font\n");
	ShowFontOpr();
	
	iError = SetFontsDetail("freetype", argv[1], 20);
	if(iError){
		DebugPrint("This font can't be support. check the file format or file size\n");
		goto error_exit;
	}

	iError = DisplayInit();
	if(iError){
		DebugPrint("Display init error\n");
		goto error_exit;
	}
	DebugPrint("\nSupported display device\n");
	ShowDisOpr();
	
	SelectAndInitDefaultDisOpr("fb");
	if(iError){
		DebugPrint("Init default display opration error\n");
		goto error_exit;
	}

	iError = InputDeviceInit();
	AllInputFdInit();
	if(iError){
		DebugPrint("Input device init error\n");
		goto error_exit;
	}
	DebugPrint("\nSupported input device\n");
	ShowInputOpr();
	
	iError = PicFmtInit();
	if(iError){
		DebugPrint("Picture format init error\n");
		goto error_exit;
	}
	DebugPrint("\nSupported picture format\n");
	ShowPicFmtParser();

	iError = AllocVideoMem(5);
	if(iError){
		DebugPrint("Alloc video memory error\n");
		goto error_exit;
	}

	iError = MusicParserInit();
	if(iError){
		DebugPrint("MusicParser init error\n");
		goto error_exit;
	}
	DebugPrint("\nSupported music\n");
	ShowMusicParser();
	
	iError = PagesInit();
	if(iError){
		DebugPrint("Page init error\n");
		goto error_exit;
	}
	DebugPrint("\nCreated pages\n");
	ShowPageOpr();
	
	ptMainPageOpr = GetPageOpr("main");
	if(NULL == ptMainPageOpr){
		DebugPrint("GetPageOpr error\n");
		goto error_exit;
	}
	
	ptMainPageOpr->RunPage(&tPageIdetify);

	FreeAllVideoMem();
	FreeDirAndFileIcons();
	PrintDeviceExit();

exit:
	return 0;
error_exit:
	return -1;

}
Esempio n. 10
0
/* ./show_file [-s Size] [-f freetype_font_file] [-h HZK] <text_file> */
int main(int argc, char **argv)
{
	int iError;
	unsigned int dwFontSize = 16;
	char acHzkFile[128];
	char acFreetypeFile[128];
	char acTextFile[128];

	char cOpr;

	acHzkFile[0]  = '\0';
	acFreetypeFile[0] = '\0';
	acTextFile[0] = '\0';
	
	while ((iError = getopt(argc, argv, "s:f:h:")) != -1)
	{	/*СЎПо*/
		switch(iError)
		{
			case 's':
			{
				  dwFontSize = strtoul(optarg, NULL, 0);
				  break;
			}
			case 'f':
			{
				  strncpy(acFreetypeFile, optarg, 128);
				  acFreetypeFile[127] = '\0';
				  break;
			}
			case 'h':
			{
					strncpy(acHzkFile, optarg, 128);
					acHzkFile[127] = '\0';
					break;
			}
			default:
			{
				  printf("Usage: %s [-s Size] [-f font_file] [-h HZK] <text_file>\n", argv[0]);
				  return -1;
				  break;
			}
		}
	}

	if (optind >= argc)
	{
		printf("Usage: %s [-s Size] [-f font_file] [-h HZK] <text_file>\n", argv[0]);
		return -1;
	}

	strncpy(acTextFile, argv[optind], 128);
	acTextFile[127] = '\0';
		
	iError = DisplayInit();
	if (iError)
	{
		DBG_PRINTF("DisplayInit error!\n");
		return -1;
	}

	iError = FontsInit();
	if (iError)
	{
		DBG_PRINTF("FontsInit error!\n");
		return -1;
	}

	iError = EncodingInit();
	if (iError)
	{
		DBG_PRINTF("EncodingInit error!\n");
		return -1;
	}
		
	iError = OpenTextFile(acTextFile);
	if (iError)
	{
		DBG_PRINTF("OpenTextFile error!\n");
		return -1;
	}

	iError = SetTextDetail(acHzkFile, acFreetypeFile, dwFontSize);
	if (iError)
	{
		DBG_PRINTF("SetTextDetail error!\n");
		return -1;
	}

	iError = SelectAndInitDisplay("fb");
	if (iError)
	{
		DBG_PRINTF("SelectAndInitDisplay error!\n");
		return -1;
	}
	
	iError = ShowNextPage();
	if (iError)
	{
		DBG_PRINTF("Error to show first page\n");
		return -1;
	}

	while (1)
	{
		printf("Enter 'n' to show next page, 'u' to show previous page, 'q' to exit: ");

		do {
			cOpr = getchar();			
		} while ((cOpr != 'n') && (cOpr != 'u') && (cOpr != 'q'));

		if (cOpr == 'n')
		{
			ShowNextPage();
		}
		else if (cOpr == 'u')
		{
			ShowPrePage();			
		}
		else 
		{
			return 0;
		}			
	}
	return 0;
}
Esempio n. 11
0
/* video2lcd </dev/video0,1,,,>*/
int main(int argc, char **argv)
{	
	int iError;
	T_VideoDevice tVideoDevice;
	PT_VideoConvert ptVideoConvert;
	int iPixFormatOfVideo;
	int iPixFormatOfDisp;

	PT_VideoBuf ptVideoBufCur;
	T_VideoBuf tVideoBuf;
	T_VideoBuf tConvertBuf;

	T_VideoBuf tZoomBuf;
	T_VideoBuf tFrameBuf;
	
	int iLcdWidth,iLcdHeight,iLcdBpp;
	int iTopLeftX,iTopLeftY ;

	float k;

	if (argc != 2)
	{
		DBG_PRINTF("Usage:\n");
		DBG_PRINTF("%s video2lcd </dev/video0,1,,,>\n", argv[0]);
		return 0;
	}


	/*一系列的初始化*/

	/* 注册显示设备 */
	DisplayInit();
	/* 可能可支持多个显示设备: 选择和初始化指定的显示设备 */
	SelectAndInitDefaultDispDev("fb");
	GetDispResolution(&iLcdWidth, &iLcdHeight, &iLcdBpp);
	GetVideoBufForDisplay(&tFrameBuf);
	iPixFormatOfDisp = tFrameBuf.iPixelFormat;

	VideoInit();

	iError = VideoDeviceInit(argv[1], &tVideoDevice);
	if(iError)
	{
		DBG_PRINTF("VideoInit for %s error\n",argv[1]);
		return -1;
	}

	iPixFormatOfVideo = tVideoDevice.ptopr->GetFormat(&tVideoDevice);
	
	VideoConvertInit();
	ptVideoConvert = GetVideoConvertForFormat(iPixFormatOfVideo, iPixFormatOfDisp);
	if(ptVideoConvert == NULL)
	{
		DBG_PRINTF("Can not support this format convert !\n");
		return -1;
	}
	
	/*启动摄像头*/
	iError = tVideoDevice.ptopr->StartDevice(&tVideoDevice);
	if(iError)
	{
		DBG_PRINTF("Start device for %s error\n",argv[1]);
		return -1;
	}	

	memset(&tVideoBuf, 0, sizeof(tVideoBuf));
	memset(&tConvertBuf, 0, sizeof(tConvertBuf));
	tConvertBuf.tPixelDatas->iBpp = iLcdBpp;

	memset(&tZoomBuf, 0, sizeof(tZoomBuf));


	while(1)
	{
		/*读入摄像头数据*/
		iError = tVideoDevice.ptopr->GetFrame(&tVideoDevice, &tVideoBuf);
		if(iError)
		{
			DBG_PRINTF("GetFrame for %s error\n",argv[1]);
			return -1;
		}
		ptVideoBufCur = &tVideoBuf;
		
		/*转换为RGB数据*/
		if(iPixFormatOfVideo != iPixFormatOfDisp)
		{
			/*转换为RGB数据*/
			iError = ptVideoConvert->Covert(&tVideoBuf, &tConvertBuf);
			if(iError)
			{
				DBG_PRINTF("Covert for %s error\n",argv[1]);
				return -1;
			}
			ptVideoBufCur = &tConvertBuf;
		}
		
		/*如果图像分辨率,大于LCD,缩放*/
		if (ptVideoBufCur->tPixelDatas.iWidth > iLcdWidth  || ptVideoBufCur->tPixelDatas.iHeight> iLcdHeight)
		{
			/*确定缩放后的分辨率*/
			/* 把图片按比例缩放到VideoMem上, 居中显示
			 * 1. 先算出缩放后的大小
			 */
			k = (float)ptVideoBufCur->tPixelDatas.iHeight / ptVideoBufCur->tPixelDatas.iWidth;
			tZoomBuf.tPixelDatas.iWidth  = iLcdWidth;
			tZoomBuf.tPixelDatas.iHeight = iLcdWidth* k;
			if (tZoomBuf.tPixelDatas.iHeight > iLcdHeight)
			{
				tZoomBuf.tPixelDatas.iWidth  = iLcdHeight / k;
				tZoomBuf.tPixelDatas.iHeight = iLcdHeight;
			}
			tZoomBuf.tPixelDatas.iBpp 	   = iLcdBpp;
			tZoomBuf.tPixelDatas.iLineBytes  = tZoomBuf->tPixelDatas.iWidth * tZoomBuf.tPixelDatas.iBpp / 8;
			tZoomBuf.tPixelDatas.iTotalBytes = tZoomBuf->tPixelDatas.iLineBytes * tZoomBuf.tPixelDatas.iHeight;
			if(!tZoomBuf.tPixelDatas.aucPixelDatas)
			{
				tZoomBuf.tPixelDatas.aucPixelDatas = malloc(tZoomBuf.tPixelDatas.iTotalBytes);
			}
			if (tZoomBuf.tPixelDatas.aucPixelDatas == NULL)
			{
				PutVideoMem(ptVideoMem);
				return NULL;
			}
			
			PicZoom(&ptVideoBufCur.tPixelDatas, &tZoomBuf.tPixelDatas);
			ptVideoBufCur = &tZoomBuf;
		}

		/*合并进入frmaebuffer*/
		/* 接着算出居中显示时左上角坐标 */
		iTopLeftX = (iLcdWidth- ptVideoBufCur->tPixelDatas.iWidth) / 2;
		iTopLeftY = (iLcdHeight- ptVideoBufCur->tPixelDatas.iHeight) / 2;

		PicMerge(iTopLeftX,iTopLeftY,&ptVideoBufCur->tPixelDatas,&tFrameBuf.tPixelDatas);

		FlushPixelDataToDev(&tFrameBuf.tPixelDatas);
		iError = tVideoDevice.ptopr->PutFrame(&tVideoDevice, &tVideoBuf);
		if (iError)
		{
			DBG_PRINTF("PutFrame for %s error\n",argv[1]);
			return -1;
		}
		
		/*把framebuffer的数据刷到LCD上*/
		
	}
	


	/* 初始化调试模块: 可以通过"标准输出"也可以通过"网络"打印调试信息
	 * 因为下面马上就要用到DBG_PRINTF函数, 所以先初始化调试模块
	 */


	return 0;
}
Esempio n. 12
0
//MAIN function
void main (void)
{
	/*Variable Declaration*/
	char pass[PASS_LENGTH], x; 	//pass is the pass entered. 'x' stores temp data
	int loop; 					//variable for loops
	char attempts, entered;		//amount of passcode attempts. amount of data entered (when entering passcode)
	
	/*Setup*/
	{
	DisplayInit();
	settim0 ();
	init_scan();
	init_door();
		/*This section may cause issues on DEV board as it's not configured to hold P1.4 low during normal operation*/
		P1M1|=0x10;
		P1M2&=0xEF; //sets P1.4 to '10'(input mode)
		if((P1&0x10)==0x10) //if P1.4 is held high (Hardware override to wipe eeprom)
		{
			eeprom_clear(0);
			Write("done");
			while(1); //infinite loop, Hardware must be reset again.
		}
		//*************************************************************************************************************/
		
	for(loop=0;loop<PASS_LENGTH;++loop)
	{
		pass[loop]=PASS_NULL; //sets the passcode to PASS_NULL
	}
	entered=0;
	attempts=0;
	Write("init");
	//Should I shut the door here? Spec doesn't Spec and I would assume so.
	}
	
	
	//infinite loop begins
	while(1)
	{
		/*--idling state.--*/
		
		x=passcode_entering(pass,30);	//store data to pass, 30seconds till idle
		
		if(x==KEY_ENTER)	//enter has been pressed.
		{
			while(scan()==1)
			key_flag=0;
			//code check portion
			if (code_check(pass)==1)
			{
				
				//passcode is correct
				//enter open routine
				door_routine();
				//should include passcode change section.
				
				
				//clear passcode, ready for idling
				for(loop=0;loop<PASS_LENGTH;++loop)
				{
					pass[loop]=PASS_NULL; 			//clears stored passcode
				}
				entered=0;
				attempts=0;
				Write("shut");
			}
			else 
			{
				//passcode incorrect
				++attempts;
				if(attempts>=3) //third fail will lock door down
				{
					Write("Bar ");
					
					for(clock=0;clock<(120*clock_freq);) 
						{/*enter three minute loop*/}
					
					attempts=0;	//reset attempts to 0
				}
				for(loop=0;loop<PASS_LENGTH;++loop)
				{
					pass[loop]=PASS_NULL; //clears stored passcode
				}
				Write("shut");
			}
		}//end of 'if(x==KEY_ENTER)'
		
		//clears stored passcode
		for(loop=0;loop<PASS_LENGTH;++loop)
		{
			pass[loop]=PASS_NULL; 
		}
		Write("shut");
		
		if(x==0) //display
			{
				attempts=0; //clears attempts if passcode entering times out
			}
		
	}
	//end of while(1) loop

	/*Error catching Area*/
	Write("Err1");
	while(1);
	/*********************/
}
Esempio n. 13
0
/* ./show_file [-s Size] [-f freetype_font_file] [-h HZK] <text_file> */
int main(int argc, char **argv)
{
	int iError;
	unsigned int dwFontSize = 16;
	char acHzkFile[128];
	char acFreetypeFile[128];
	char acTextFile[128];

	char acDisplay[128];

	char cOpr;
	int bList = 0;

	T_InputEvent tInputEvent;

	acHzkFile[0]  = '\0';
	acFreetypeFile[0] = '\0';
	acTextFile[0] = '\0';

	strcpy(acDisplay, "fb");
	
	while ((iError = getopt(argc, argv, "ls:f:h:d:")) != -1)
	{
		switch(iError)
		{
			case 'l':
			{
				  bList = 1;
				  break;
			}
			case 's':
			{
				  dwFontSize = strtoul(optarg, NULL, 0);
				  break;
			}
			case 'f':
			{
				  strncpy(acFreetypeFile, optarg, 128);
				  acFreetypeFile[127] = '\0';
				  break;
			}			
			case 'h':
			{
					strncpy(acHzkFile, optarg, 128);
					acHzkFile[127] = '\0';
					break;
			}
			case 'd':
			{
				strncpy(acDisplay, optarg, 128);
				acDisplay[127] = '\0';
				break;
			}
			default:
			{
					printf("Usage: %s [-s Size] [-d display] [-f font_file] [-h HZK] <text_file>\n", argv[0]);
					printf("Usage: %s -l\n", argv[0]);
					return -1;
					break;
			}
		}
	}

	if (!bList && (optind >= argc))
	{
		printf("Usage: %s [-s Size] [-d display] [-f font_file] [-h HZK] <text_file>\n", argv[0]);
		printf("Usage: %s -l\n", argv[0]);
		return -1;
	}
		
	iError = DisplayInit();
	if (iError)
	{
		printf("DisplayInit error!\n");
		return -1;
	}

	iError = FontsInit();
	if (iError)
	{
		printf("FontsInit error!\n");
		return -1;
	}

	iError = EncodingInit();
	if (iError)
	{
		printf("EncodingInit error!\n");
		return -1;
	}


	iError = InputInit();
	if (iError)
	{
		printf("InputInit error!\n");
		return -1;
	}


	if (bList)
	{
		printf("supported display:\n");
		ShowDispOpr();

		printf("supported font:\n");
		ShowFontOpr();

		printf("supported encoding:\n");
		ShowEncodingOpr();

		printf("supported input:\n");
		ShowInputOpr();
		
		return 0;
	}

	strncpy(acTextFile, argv[optind], 128);
	acTextFile[127] = '\0';
		
	iError = OpenTextFile(acTextFile);
	if (iError)
	{
		printf("OpenTextFile error!\n");
		return -1;
	}

	iError = SetTextDetail(acHzkFile, acFreetypeFile, dwFontSize);
	if (iError)
	{
		printf("SetTextDetail error!\n");
		return -1;
	}

	DBG_PRINTF("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);

	iError = SelectAndInitDisplay(acDisplay);
	if (iError)
	{
		printf("SelectAndInitDisplay error!\n");
		return -1;
	}

	iError = AllInputDevicesInit();
	if (iError)
	{
		DBG_PRINTF("Error AllInputDevicesInit\n");
		return -1;
	}
	
	DBG_PRINTF("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
	iError = ShowNextPage();
	DBG_PRINTF("%s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
	if (iError)
	{
		printf("Error to show first page\n");
		return -1;
	}

	printf("Enter 'n' to show next page, 'u' to show previous page, 'q' to exit: ");

	while (1)
	{

		if (0 == GetInputEvent(&tInputEvent))
		{
			if (tInputEvent.iVal == INPUT_VALUE_DOWN)
			{
				ShowNextPage();
			}
			else if (tInputEvent.iVal == INPUT_VALUE_UP)
			{
				ShowPrePage();			
			}
			else if (tInputEvent.iVal == INPUT_VALUE_EXIT)
			{
				return 0;
			}
		}
	}
	return 0;
}
Esempio n. 14
0
//-----------------------------------------------------------------------
//
//		THIS CODE HAS THE MANUAL CHIP SELECT FOR THE DISPLAY
//
int main (void)
{
	//============== Local Variables =====================
	int encoderValue = 0;
	int16_t temp0, temp2, temp3;
	unsigned int temp1;
	int refreshValues = YES, i, t = 0, h = 0;
	double temptemp1, temptemp2;
	screen = 2;
	tempFormat = CEL;
	tempCharacter[0] = 'C';

	// Turning off watch dog timer
	MAP_WDT_A_holdTimer();

	//Configuring pins for peripheral/crystal usage.
	CS_setExternalClockSourceFrequency(32768,48000000);
	MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);
	MAP_FlashCtl_setWaitState(FLASH_BANK0, 2);
	MAP_FlashCtl_setWaitState(FLASH_BANK1, 2);
	CS_startHFXT(false);
	//Setting other clocks to speeds needed throughout the project
	MAP_CS_initClockSignal(CS_MCLK, CS_HFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);
	MAP_CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_4);
	MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ, GPIO_PIN3 | GPIO_PIN4, GPIO_PRIMARY_MODULE_FUNCTION);

	//Initialization functions for variable peripherals
	InitFunction();
	err = DisplayInit();
	err |= InitOneWire();
	err |= RF_Init();
	if(err)
	{
		printf("ERROR occured in initialization functions.\n");
	}

	//Setting variables to initial values
	temperatureOUT[0] = 250;	temperatureOUT[1] = 251;
	temperatureIN[0] = 220;		temperatureIN[1] = 221;
	humidityOUT[0] = 440;		humidityOUT[1] = 441;
	humidityIN[0] = 330;		humidityIN[1] = 331;
	pressure[0] = 60;			pressure[1] = 61;
	lux[0] = 9000;				lux[1] = 9001;
	lightIndex[0] = 1;			lightIndex[1] = 2;

	//Enable interupts and set the interupt for the One-Wire to have highest priority
	MAP_Interrupt_enableMaster();
	MAP_Interrupt_setPriority(INT_TA0_0, 0x00);

	//Keep process in infinite loop
	while(1)
	{
		while(!Setup) //'Setup' controls whether or not the user is view the data from
					  //the remote system, or is editing the time for the RTC
		{
	        if (status) //'status' is set high when the IQR pin is set high -- meaning there is a packet
	        			//available to be read in from the RF chip
	        {
	        	status = 0;
	        	r_rx_payload((uint8_t)PACKET_SIZE, &data);	//retrieve data
	        	sscanf(data, "<T%dP%dH%dL%d>", &temp0, &temp1, &temp2, &temp3);  //parse data
	        	temperatureOUT[0] = temp0;
	        	pressure[0] = temp1;
	        	humidityOUT[0] = temp2;
	        	lux[0] = temp3;
	        	calculateLighting(lux[0], lightIndexString[0], &lightIndex[0]); 	//Figure out the lighting condition

	        	//Convert to F if 'tempFormat' is set high when tempFormat is set high, indicating that there needs to be a
	        	//C to F convserion. The data is C from the sensors.
				if(tempFormat == FAR)
				{
					//C to F convserion
					temptemp2 =  ((float)temperatureOUT[0]);
					temperatureOUT[0] = (int)((temptemp2 * 1.8));
					temperatureOUT[0] += 320;
				}
	        }

	        //Tick is set high every second from the RTC interupt
			if(tick)
			{
				i = 0;
				MAP_SysTick_disableModule(); // disable the systick interupt during while getting the
											 // temperature and humidity data from sensor
				//Getting the temp and humidity data
				__delay_cycles(100);
				dht_start_read();
				t = dht_get_temp();
				h = dht_get_rh();
				MAP_SysTick_enableModule(); //Enable the systick interupt again
				__delay_cycles(100);

				//put the humidity and temperature values in the needed variables
				humidityIN[0] = h;
				temperatureIN[0] = t;

				//Convert to F if 'tempFormat' is set high when tempFormat is set high, indicating that there needs to be a
				//C to F convserion. The data is C from the sensors.
				if(tempFormat == FAR)
				{
					//C to F conversion
					temptemp1 =  ((float)temperatureIN[0]);
					temperatureIN[0] = (int)((temptemp1 * 1.8));
					temperatureIN[0] += 320;
				}
			}

			//'screen' is either set to the value of 1 or 2.
			// screen == 1 is the main screen with only the temperatures and lighting condition displayed
			if(screen == 1)
			{
				//If the time has been updated or the screen has been switched, update the string
				if(tick || refreshValues)
				{
					tick = 0;
					//Create the time and date strings
					sprintf(dateString, "%s %02X, %X", months[newTime.month], newTime.dayOfmonth, newTime.year);
					sprintf(timeString, "%02X:%02X:%02X", newTime.hours, newTime.minutes, newTime.seconds);

					//Write "IN:" in the lower part of the screen to indicate to the user which temperature is the
					//inside tempterature
					if(refreshValues == YES)
					{
						ST7735_DrawStringHorizontal(50, 140, "IN:", ST7735_Color565(255, 255, 255), 1);
					}

					//Printing the time
					for(i = 0; i < strlen(timeString); i++)
					{
						ST7735_DrawChar(22+(11*i), 10, timeString[i], timeStringColor[i], 0x0000, 2);
					}

					//Printing the date
					for(i = 0; i < strlen(dateString); i++)
					{
						ST7735_DrawChar(30+(6*i), 30, dateString[i], dateStringColor[i], 0x0000, 1);
					}
				}

				//If the new data value is different than the previous value, or the screen has been changes, update display
				if((temperatureOUT[0] != temperatureOUT[1]) || refreshValues == YES)
				{
					//Re-write the last string in black (the same color as the backgruond) to cover it up so that the
					// new value is not written overtop.
					sprintf(tempString, "%02d.%.1d", temperatureOUT[1]/10, temperatureOUT[1]%10);
					ST7735_DrawStringHorizontal(20, 80, tempString, ST7735_Color565(0, 0, 0), 4);
					ST7735_DrawCharS((20 + strlen(tempString)*4*6), 80, tempCharacter[1], ST7735_Color565(0, 0, 0), ST7735_Color565(0, 0, 0), 1);

					//Write the new string
					sprintf(tempString, "%02d.%.1d", temperatureOUT[0]/10, temperatureOUT[0]%10);
					ST7735_DrawStringHorizontal(20, 80, tempString, ST7735_Color565(255, 0, 0), 4);
					ST7735_DrawCharS((20 + strlen(tempString)*4*6), 80, tempCharacter[0], ST7735_Color565(255, 0, 0), ST7735_Color565(255, 0, 0), 1);
					temperatureOUT[1] = temperatureOUT[0];
					tempCharacter[1] = tempCharacter[0];
				}

				//If the new data value is different than the previous value, or the screen has been changes, update display
				if((temperatureIN[0] != temperatureIN[1]) || refreshValues == YES)
				{
					//Re-write the last string in black (the same color as the backgruond) to cover it up so that the
					// new value is not written overtop.
					sprintf(tempString, "%02d.%.1d", temperatureIN[1]/10, temperatureIN[1]%10);
					ST7735_DrawStringHorizontal(70, 130, tempString, ST7735_Color565(0, 0, 0), 2);
					ST7735_DrawCharS((70 + strlen(tempString)*2*6), 130, tempCharacter, ST7735_Color565(0, 0, 0), ST7735_Color565(0, 0, 0), 1);

					//Write the new string
					sprintf(tempString, "%02d.%.1d", temperatureIN[0]/10, temperatureIN[0]%10);
					ST7735_DrawStringHorizontal(70, 130, tempString, ST7735_Color565(255, 0, 0), 2);
					ST7735_DrawCharS((70 + strlen(tempString)*2*6), 130, tempCharacter, ST7735_Color565(255, 0, 0), ST7735_Color565(255, 0, 0), 1);
					temperatureIN[1] = temperatureIN[0];
					tempCharacter[1] = tempCharacter[0];
				}

				//If the new data value is different than the previous value, or the screen has been changes, update display
				if((lightIndex[0] != lightIndex[1]) || refreshValues == YES)
				{
					//Re-write the last string in black (the same color as the backgruond) to cover it up so that the
					// new value is not written overtop.
					sprintf(tempString, "%s", lightIndexString[1]);
					ST7735_DrawStringVertical(0, 60, tempString, ST7735_Color565(0, 0, 0), 2);

					//Write the new string
					sprintf(tempString, "%s", lightIndexString[0]);
					ST7735_DrawStringVertical(0, 60, tempString, ST7735_Color565(0, 255, 0), 2);
					memcpy(lightIndexString[1], lightIndexString[0], sizeof(lightIndexString[0]));
					lightIndex[1] = lightIndex[0];
				}
				//Reset the refreshValues variable. This variable will be set high when the user swithces screen by turning the knob
				refreshValues = NO;
			}
			//'screen' equalling 2 is the screen that displays all the data to the user
			if(screen == 2)
			{
				//If the time has been updated or the screen has been switched, update the string
				if(time || refreshValues)
				{
					tick = 0;
					//Create the time string that will be written
					sprintf(timeString, "%02X:%02X:%02X", newTime.hours, newTime.minutes, newTime.seconds);

					//Write the new time string
					for(i = 0; i < strlen(timeString); i++)
					{
						ST7735_DrawChar(35+(6*i), 5, timeString[i], ST7735_Color565(0, 0, 0), ST7735_Color565(255, 255, 255), 1);
					}
				}

				//When update the items on the screen that will remain constant when the screen is changed.
				if(refreshValues == YES)
				{
					sprintf(tempString, "Inside");
					ST7735_DrawStringVertical(0, 10, tempString, ST7735_Color565(0, 255, 0), 1);

					sprintf(tempString, "Outside");
					ST7735_DrawStringVertical(120, 90, tempString, ST7735_Color565(0, 255, 0), 1);

					sprintf(tempString, "_______________________");
					ST7735_DrawStringHorizontal(0, 55, tempString, ST7735_Color565(255, 255, 255), 1);
				}

				//If the new data value is different than the previous value, or the screen has been changes, update display
				if((temperatureIN[0] != temperatureIN[1]) || refreshValues == YES)
				{
					//Re-write the last string in black (the same color as the backgruond) to cover it up so that the
					// new value is not written overtop.
					sprintf(tempString, "%02d.%.1d", temperatureIN[1]/10, temperatureIN[1]%10);
					ST7735_DrawStringHorizontal(12, 30, tempString, ST7735_Color565(0, 0, 0), 2);
					ST7735_DrawCharS((12 + strlen(tempString)*2*6), 25, tempCharacter, ST7735_Color565(0, 0, 0), ST7735_Color565(0, 0, 0), 1);

					//Write the new string
					sprintf(tempString, "%02d.%.1d", temperatureIN[0]/10, temperatureIN[0]%10);
					ST7735_DrawStringHorizontal(12, 30, tempString, ST7735_Color565(255, 0, 0), 2);
					ST7735_DrawCharS((12 + strlen(tempString)*2*6), 25, tempCharacter, ST7735_Color565(255, 0, 0), ST7735_Color565(255, 0, 0), 1);
					temperatureIN[1] = temperatureIN[0];
					tempCharacter[1] = tempCharacter[0];
				}

				//If the new data value is different than the previous value, or the screen has been changes, update display
				if((humidityIN[0] != humidityIN[1]) || refreshValues == YES)
				{
					//Re-write the last string in black (the same color as the backgruond) to cover it up so that the
					// new value is not written overtop.
					sprintf(tempString, "%02d.%.1d", humidityIN[1]/10, humidityIN[1]%10);
					ST7735_DrawStringHorizontal(74, 30, tempString, ST7735_Color565(0, 0, 0), 2);
					ST7735_DrawCharS((74 + strlen(tempString)*2*6), 27, '%', ST7735_Color565(0, 0, 0), ST7735_Color565(0, 0, 0), 1);

					//Write the new string
					sprintf(tempString, "%02d.%.1d", humidityIN[0]/10, humidityIN[0]%10);
					ST7735_DrawStringHorizontal(74, 30, tempString, ST7735_Color565(255, 0, 0), 2);
					ST7735_DrawCharS((74 + strlen(tempString)*2*6), 27, '%', ST7735_Color565(255, 0, 0), ST7735_Color565(255, 0, 0), 1);
					humidityIN[1] = humidityIN[0];
				}

				//==========================================================================================================================


				//If the new data value is different than the previous value, or the screen has been changes, update display
				if((temperatureOUT[0] != temperatureOUT[1]) || refreshValues == YES)
				{
					//Re-write the last string in black (the same color as the backgruond) to cover it up so that the
					// new value is not written overtop.
					sprintf(tempString, "%02d.%.1d", temperatureOUT[1]/10, temperatureOUT[1]%10);
					ST7735_DrawStringHorizontal(0, 70, tempString, ST7735_Color565(0, 0, 0), 2);
					ST7735_DrawCharS((0 + strlen(tempString)*2*6), 68, tempCharacter, ST7735_Color565(0, 0, 0), ST7735_Color565(0, 0, 0), 1);

					//Write the new string
					sprintf(tempString, "%02d.%.1d", temperatureOUT[0]/10, temperatureOUT[0]%10);
					ST7735_DrawStringHorizontal(0, 70, tempString, ST7735_Color565(255, 0, 0), 2);
					ST7735_DrawCharS((0 + strlen(tempString)*2*6), 68, tempCharacter, ST7735_Color565(255, 0, 0), ST7735_Color565(255, 0, 0), 1);
					temperatureOUT[1] = temperatureOUT[0];
					tempCharacter[1] = tempCharacter[0];
				}

				//If the new data value is different than the previous value, or the screen has been changes, update display
				if((humidityOUT[0] != humidityOUT[1]) || refreshValues == YES)
				{
					//Re-write the last string in black (the same color as the backgruond) to cover it up so that the
					// new value is not written overtop.
					sprintf(tempString, "%02d.%.1d", humidityOUT[1]/10, humidityOUT[1]%10);
					ST7735_DrawStringHorizontal(0, 90, tempString, ST7735_Color565(0, 0, 0), 2);
					ST7735_DrawCharS((0 + strlen(tempString)*2*6), 87, '%', ST7735_Color565(0, 0, 0), ST7735_Color565(0, 0, 0), 1);

					//Write the new string
					sprintf(tempString, "%02d.%.1d", humidityOUT[0]/10, humidityOUT[0]%10);
					ST7735_DrawStringHorizontal(0, 90, tempString, ST7735_Color565(255, 0, 0), 2);
					ST7735_DrawCharS((0 + strlen(tempString)*2*6), 87, '%', ST7735_Color565(255, 0, 0), ST7735_Color565(255, 0, 0), 1);
					humidityOUT[1] = humidityOUT[0];
				}

				if((lux[0] != lux[1]) || refreshValues == YES)
				{
					//Re-write the last string in black (the same color as the backgruond) to cover it up so that the
					// new value is not written overtop.
					sprintf(tempString, "%d", lux[1]);
					ST7735_DrawStringHorizontal(0, 112, tempString, ST7735_Color565(0, 0, 0), 2);
					ST7735_DrawCharS((0 + strlen(tempString)*2*6), 112, 'L', ST7735_Color565(0, 0, 0), ST7735_Color565(0, 0, 0), 1);

					//Write the new string
					sprintf(tempString, "%d", lux[0]);
					ST7735_DrawStringHorizontal(0, 112, tempString, ST7735_Color565(255, 0, 0), 2);
					ST7735_DrawCharS((0 + strlen(tempString)*2*6), 112, 'L', ST7735_Color565(255, 0, 0), ST7735_Color565(255, 0, 0), 1);
					lux[1] = lux[0];
				}

				//If the new data value is different than the previous value, or the screen has been changes, update display
				if((pressure[0] != pressure[1]) || refreshValues == YES)
				{
					//Re-write the last string in black (the same color as the backgruond) to cover it up so that the
					// new value is not written overtop.
					sprintf(tempString, "%d", pressure[1]);
					ST7735_DrawStringHorizontal(0, 135, tempString, ST7735_Color565(0, 0, 0), 2);
					ST7735_DrawStringHorizontal((0 + strlen(tempString)*2*6), 135, "Pa", ST7735_Color565(0, 0, 0), 1);

					//Write the new string
					sprintf(tempString, "%d", pressure[0]);
					ST7735_DrawStringHorizontal(0, 135, tempString, ST7735_Color565(255, 0, 0), 2);
					ST7735_DrawStringHorizontal((0 + strlen(tempString)*2*6), 135, "Pa", ST7735_Color565(255, 0, 0), 1);
					pressure[1] = pressure[0];
				}

				//If the new data value is different than the previous value, or the screen has been changes, update display
				if((lightIndex[0] != lightIndex[1]) || refreshValues == YES)
				{
					//Re-write the last string in black (the same color as the backgruond) to cover it up so that the
					// new value is not written overtop.
					sprintf(tempString, "%s", lightIndexString[1]);
					ST7735_DrawStringVertical(105, 70, tempString, ST7735_Color565(0, 0, 0), 2);

					//Write the new string
					sprintf(tempString, "%s", lightIndexString[0]);
					ST7735_DrawStringVertical(105, 70, tempString, ST7735_Color565(0, 0, 255), 2);
					memcpy(lightIndexString[1], lightIndexString[0], sizeof(lightIndexString[0]));
					lightIndex[1] = lightIndex[0];
				}

				refreshValues = NO;
			}

			//Check to see in the knob has been changed at all
			encoderValue = EncoderDecipher(&Encoder1, &Encoder2, &PushButton);

			//If encoder has been held, this indicates enting the setting of the RTC time
			if(encoderValue == HOLD)
			{
				Setup = YES;	//Now that is this set high, the process will exit the while loop above

				//Set all varaibles to what is needed for editing the time and date
				memset(dateStringColor, 0xFFFF, sizeof(dateStringColor));
				memset(timeStringColor, 0xFFFF, sizeof(timeStringColor));
				dateStringColor[0] = ST7735_Color565(255, 0, 0);
				dateStringColor[1] = ST7735_Color565(255, 0, 0);
				dateStringColor[2] = ST7735_Color565(255, 0, 0);

				//Getting the current RTC values and put them into variables that will then used to manipulate
				sprintf(temp, "%x, %x, %x, %x, %x, %x", newTime.month, newTime.dayOfmonth, newTime.year, newTime.hours, newTime.minutes, newTime.seconds);
				sscanf(temp, "%d, %d, %d, %d, %d, %d", &date[0], &date[1], &date[2], &time[0], &time[1], &time[2]);

				//Fill the screen in all black
				ST7735_FillScreen(0);
				//Variable controlling the whether editing the time or date
				Top = YES;
			}
			//If the user turns the knob, change the screen variable and set the refreshValues high so that the screen will change for the user
			else if (encoderValue == RIGHT || encoderValue == LEFT)
			{
				if(screen == 1)
				{
					screen = 2;
					ST7735_FillScreen(0);	//Clear screen
					refreshValues = YES;
				}
				else if(screen == 2)
				{
					screen = 1;
					ST7735_FillScreen(0); 	//Clear screen
					refreshValues = YES;
				}
			}
			//If the user just pressed the encoder (not holds it) change the temperature to be displayed in the opposite type
			else if(encoderValue == PRESS)
			{
				if(tempFormat == CEL)
				{
					tempFormat = FAR;
					tempCharacter[0] = 'F';
				}
				else
				{
					tempFormat = CEL;
					tempCharacter[0] = 'C';
				}
			}
		}

		//Keep process inside this loop while the encoder is not being touched
		while(!movement)
		{
			if(encoderRefresh)
			{
				//Getting the movement of the encoder
				movement = EncoderDecipher(Encoder1, Encoder2, PushButton);
				encoderRefresh = 0;
			}
			if(flag)
			{
				flag = 0;
				//Write the date and time strings
				for(i = 0; i < strlen(dateString); i++)
				{
					ST7735_DrawChar((11*i), 10, dateString[i], dateStringColor[i], 0x0000, 2);
				}
				for(i = 0; i < strlen(timeString); i++)
				{
					ST7735_DrawChar(22+(11*i), 40, timeString[i], timeStringColor[i], 0x0000, 2);
				}
			}
		}

		//Is user turned the knob right, increment withever value the user is editing
		if(movement == RIGHT)
		{
			flag = 1;
			if(Top)		// Up
			{
				if(dateStringColor[1] == 31)
				{
					if(++date[0] > 11)
						date[0] = 0;
				}
				else if(dateStringColor[4] == 31)
				{
					if(++date[1] > 31)
						date[1] = 0;
				}
				else
				{
					if(++date[2] > 2050)
						date[2] = 1950;
				}
			}
			else
			{
				if(timeStringColor[1] == 31)
				{
					if(++time[0] > 24)
						time[0] = 0;
				}
				else if(timeStringColor[4] == 31)
				{
					if(++time[1] > 59)
						time[1] = 0;
				}
				else
				{
					if(++time[2] > 59)
						time[2] = 0;
				}
			}
		}

		//Is user turned the knob left, decrement withever value the user is editing
		if(movement == LEFT)
		{
			flag = 1;
			if(Top)		// Up
			{
				if(dateStringColor[1] == 31)
				{
					if(--date[0] < 0)
						date[0] = 11;
				}
				else if(dateStringColor[4] == 31)
				{
					if(--date[1] < 0)
						date[1] = 31;
				}
				else
				{
					if(--date[2] < 1950)
						date[2] = 2050;
				}
			}
			else
			{
				if(timeStringColor[1] == 31)
				{
					if(--time[0] < 0)
						time[0] = 23;
				}
				else if(timeStringColor[4] == 31)
				{
					if(--time[1] < 0)
						time[1] = 59;
				}
				else
				{
					if(--time[2] < 0)
						time[2] = 59;
				}
			}
		}

		//Is user presses the right, swith which what is highlighted, to indicate to the user
		//what is being edited
		if(movement == PRESS)
		{
			flag = 1;

			if(Top)		// XXX XX XXXX
			{
				if(dateStringColor[1] == 31)
				{
					memset(dateStringColor, 0xFFFF, sizeof(dateStringColor));
					dateStringColor[4] = ST7735_Color565(255, 0, 0);
					dateStringColor[5] = ST7735_Color565(255, 0, 0);
				}
				else if(dateStringColor[4] == 31)
				{
					memset(dateStringColor, 0xFFFF, sizeof(dateStringColor));
					dateStringColor[7] = ST7735_Color565(255, 0, 0);
					dateStringColor[8] = ST7735_Color565(255, 0, 0);
					dateStringColor[9] = ST7735_Color565(255, 0, 0);
					dateStringColor[10] = ST7735_Color565(255, 0, 0);
				}
				else if(dateStringColor[8] == 31)
				{
					memset(dateStringColor, 0xFFFF, sizeof(dateStringColor));
					memset(timeStringColor, 0xFFFF, sizeof(timeStringColor));
					timeStringColor[0] = ST7735_Color565(255, 0, 0);
					timeStringColor[1] = ST7735_Color565(255, 0, 0);
					Top = NO;
				}
			}
			else				//XX XX XX
			{
				if(timeStringColor[1] == 31)
				{
					memset(timeStringColor, 0xFFFF, sizeof(timeStringColor));
					timeStringColor[3] = ST7735_Color565(255, 0, 0);
					timeStringColor[4] = ST7735_Color565(255, 0, 0);
				}
				else if(timeStringColor[4] == 31)
				{
					memset(timeStringColor, 0xFFFF, sizeof(timeStringColor));
					timeStringColor[6] = ST7735_Color565(255, 0, 0);
					timeStringColor[7] = ST7735_Color565(255, 0, 0);
				}
				else if(timeStringColor[7] == 31)
				{
					memset(timeStringColor, 0xFFFF, sizeof(timeStringColor));
					dateStringColor[0] = ST7735_Color565(255, 0, 0);
					dateStringColor[1] = ST7735_Color565(255, 0, 0);
					dateStringColor[2] = ST7735_Color565(255, 0, 0);
					Top = YES;
				}
			}
		}
		//Update the new time and date strings
		sprintf(dateString, "%s %02d,%d", months[date[0]], date[1], date[2]);
		sprintf(timeString, "%02d:%02d:%02d", time[0], time[1], time[2]);

		//If used holds the encoder down, the time and date will be written to the RTC and the process will return
		//to the top where the temp, humid... data is diplayed. Editing the time/date is exited.
		if(movement == HOLD)
		{
			if(!Setup)
			{	//Setting new time
				Setup = 1;
				flag = 1;
				if(dateStringColor[0] == 31 || dateStringColor[4] == 31 || dateStringColor[8] == 31 || timeStringColor[0] == 31 || timeStringColor[4] == 31 || timeStringColor[7] == 31)
				{
					memset(timeStringColor, 0xFFFF, sizeof(timeStringColor));
					memset(dateStringColor, 0xFFFF, sizeof(dateStringColor));
				}
				else
				{
					memset(dateStringColor, 0xFFFF, sizeof(dateStringColor));
					memset(timeStringColor, 0xFFFF, sizeof(timeStringColor));
					dateStringColor[0] = ST7735_Color565(255, 0, 0);
					dateStringColor[1] = ST7735_Color565(255, 0, 0);
					dateStringColor[2] = ST7735_Color565(255, 0, 0);
					Top = YES;
				}
			}
			else //Exiting setup
			{
				//Setup new time into system. Exiting setup
				Setup = 0;
				tick = 1;
				memset(dateStringColor, 0xFFFF, sizeof(dateStringColor));
				memset(timeStringColor, 0xFFFF, sizeof(timeStringColor));

				//Set the values (in the correct type) back into the RTC structure so that it can be updated.
				sprintf(temp, "%d, %d, %d, %d, %d, %d", date[0], date[1], date[2], time[0], time[1], time[2]);
				sscanf(temp, "%x, %x, %x, %x, %x, %x", &setTime.month, &setTime.dayOfmonth, &setTime.year, &setTime.hours, &setTime.minutes, &setTime.seconds);

				//Set the RTC with the values the uset chose
				MAP_RTC_C_initCalendar(&setTime, RTC_C_FORMAT_BCD);
				MAP_RTC_C_startClock();

				//Clear screen
				ST7735_FillScreen(0);
			}
		}
		movement = NONE;
	}
}