Example #1
0
static int run_abc_embox(void) {
	display_clear_screen();
	display_e(2, 3);
	display_m(22, 3);
	display_b(42, 3);
	display_o(60, 3);
	display_x(80, 3);
	usleep(250);
	/*jamp*/
	display_clean_sp(2, 3);
	display_e(2, 2);
	usleep(250);
	display_clean_sp(2, 2);
	display_e(2, 3);
	usleep(250);

	display_clean_sp(22, 3);
	display_m(22, 2);
	usleep(250);
	display_clean_sp(22, 2);
	display_m(22, 3);
	usleep(250);

	display_clean_sp(42, 3);
	display_b(42, 2);
	usleep(250);
	display_clean_sp(42, 2);
	display_b(42, 3);
	usleep(250);

	display_clean_sp(60, 3);
	display_o(60, 2);
	usleep(250);
	display_clean_sp(60, 2);
	display_o(60, 3);
	usleep(250);

	display_clean_sp(80, 3);
	display_x(80, 2);
	usleep(250);
	display_clean_sp(80, 2);
	display_x(80, 3);

	return 0;
}
//***********************************
//***********************************
//********** MAIN FUNCTION **********
//***********************************
//***********************************
int main (void)
{
	BYTE display_html_file_name[12];
	DWORD file_size;

	//**********************
	//**********************
	//***** INITIALISE *****
	//**********************
	//**********************
	initialise();





	//*********************
	//*********************
	//***** MAIN LOOP *****
	//*********************
	//*********************
	while(1)						//(Do forever)
	{
		//----- RESET THE WATCHDOG TIMEOUT TIMER -----
		ClearWDT();


		switches_1_new = 0;
		if (do_10ms_functions)
		{
			do_10ms_functions = 0;
		
			//----- READ SWITCHES -----
			read_switches();

		}


		//------------------------------------
		//----- CHECK FOR SWITCH PRESSES -----
		//------------------------------------
		if (SWITCH_UP_NEW_PRESS)
		{
			//----- UP PRESSED -----
			
			//Load the index.htm file
			if (display_html_setup_read_file(index_htm, 0, &file_size))			//Find HTML file ready to display it
				display_html_file(file_size);
		}
		else if (SWITCH_DOWN_NEW_PRESS)
		{
			//----- DOWN PRESSED -----
			
			//Load text1.htm using name as a variable to demonstrate finding file by name at run time
			display_html_file_name[0] = 'T';
			display_html_file_name[1] = 'E';
			display_html_file_name[2] = 'X';
			display_html_file_name[3] = 'T';
			display_html_file_name[4] = '1';
			display_html_file_name[5] = '.';
			display_html_file_name[6] = 'H';
			display_html_file_name[7] = 'T';
			display_html_file_name[8] = 'M';
			display_html_file_name[9] = 0x00;
			
			if (display_html_setup_read_file(0, display_html_file_name, &file_size))
			{
				display_html_file(file_size);
			}

		}
		else if (SWITCH_LEFT_NEW_PRESS)
		{
			//----- LEFT PRESSED -----
			
			//Load dynamic text demo HTML file - the text is added by the html_get_dynamic_text_character function below
			if (display_html_setup_read_file(dyntext_htm, 0, &file_size))
				display_html_file(file_size);
		}
		else if (SWITCH_RIGHT_NEW_PRESS)
		{
			//----- RIGHT PRESSED -----
			
			//Load text2.htm
			if (display_html_setup_read_file(text2_htm, 0, &file_size))
				display_html_file(file_size);
		}
		else if (SWITCH_FIRE_NEW_PRESS)
		{
			//----- FIRE PRESSED -----


			//Generate content using code instead of HTML
			display_clear_screen(DISPLAY_COLOUR_WHITE);
			
			display_bitmap(indeximg_bmp, 0, 0, 0x00ffffff);		//p_bitmap, x_coord, y_coord, transparency_colour(0xffffffff to not use)
		
		

			display_foreground_colour = DISPLAY_COLOUR_RED;
			display_background_colour = DISPLAY_COLOUR_TURQUOISE;
			display_const_string (disp_font_5w_7h, DISPLAY_TEXT_ALIGN_LEFT,				//Font, Options
									2, 2,												//Hoz padding, vertical padding
									20, 50,												//X start coord, Y start coord
									0, 0,												//X end coord, Y end coord (0 if area containment not required)
									string1);											//Text
	
	
			display_const_string(disp_font_5w_11h, DISPLAY_TEXT_ALIGN_LEFT,				//Font, Options
									2, 2,												//Hoz padding, vertical padding
									20, 70,												//X start coord, Y start coord
									0, 0,												//X end coord, Y end coord (0 if area containment not required)
									string1);											//Text


			display_foreground_colour = DISPLAY_COLOUR_VIOLET;
			display_background_colour = DISPLAY_COLOUR_YELLOW;
			display_const_string(disp_font_22h, DISPLAY_TEXT_ALIGN_CENTRE,				//Font, Options
									2, 2,												//Hoz padding, vertical padding
									20, 105,											//X start coord, Y start coord
									200, 160,											//X end coord, Y end coord (0 if area containment not required)
									string1);											//Text



			display_foreground_colour = DISPLAY_COLOUR_BLACK;
			display_background_colour = DISPLAY_COLOUR_NULL;							//(DISPLAY_COLOUR_NULL == no background colour / leave existing colour)
	
			display_const_string(disp_font_15h, DISPLAY_TEXT_ALIGN_LEFT,				//Font, Options
									2, 2,												//Hoz padding, vertical padding
									176, 134,											//X start coord, Y start coord
									0, 0,												//X end coord, Y end coord (0 if area containment not required)
									string1);											//Text


			display_foreground_colour = DISPLAY_COLOUR_WHITE;
			display_background_colour = DISPLAY_COLOUR_BLUE;
			display_const_string(disp_font_42h, DISPLAY_TEXT_ALIGN_CENTRE,				//Font, Options
									2, 2,												//Hoz padding, vertical padding
									0, 170,												//X start coord, Y start coord
									319, 0,												//X end coord, Y end coord (0 if area containment not required)
									string1);											//Text
									

		}

		
	}
}