Example #1
0
/**
 *	Display a menu and select menu item number
 * 	With 3 menu items
 *
 *	text1 - text on line 1 (max 18 characters)
 *	text2 - text on line 2 (max 18 characters)
 *	text3 - text on line 3 (max 18 characters)
 *
 *	returns selected menue alternative, 1, 2 or 3
 */
int screenMenu3(unsigned char text1[], unsigned char text2[], unsigned char text3[]) {
	int dataX;
	int dataY;
	int i = 0;

	screenClear ();

	//write text
	screenOutputText(2, 1, Blue, text1);
	screenOutputText(4, 1, Blue, text2);
	screenOutputText(6, 1, Blue, text3);

	//draw rectangles
	xSemaphoreTake(lcdLock, portMAX_DELAY);	
	GLCD_setTextColor(Blue);
	GLCD_drawRect(Line2 - 12, 5, 48, 310);
	GLCD_drawRect(Line4 - 12, 5, 48, 310);
	GLCD_drawRect(Line6 - 12, 5, 48, 310);
	
  	xSemaphoreGive(lcdLock);

	//wait for user to select alternative
	while(i == 0) {
		//select alternative
		screenTouched(&dataX, &dataY);
		//find out which alternative selected
		if (dataY > Line2 - 12 && dataY < Line4 - 12) i = 1;
		if (dataY > Line4 - 12 && dataY < Line6 - 12) i = 2;
		if (dataY > Line6 - 12 && dataY < Line8 - 12) i = 3;
	}

	xSemaphoreTake(lcdLock, portMAX_DELAY);	
	GLCD_setTextColor(Green);
	GLCD_setBackColor (Green);
	if ( i == 1) {
		GLCD_fillRect(Line2 - 12, 5, 48, 310);
  		xSemaphoreGive(lcdLock);
		screenOutputText(2, 1, Blue, text1);
	} else if (i == 2) {
		GLCD_fillRect(Line4 - 12, 5, 48, 310);
	  	xSemaphoreGive(lcdLock);
		screenOutputText(4, 1, Blue, text2);
	} else {
		GLCD_fillRect(Line6 - 12, 5, 48, 310);
	  	xSemaphoreGive(lcdLock);
		screenOutputText(6, 1, Blue, text2);
	}

	xSemaphoreTake(lcdLock, portMAX_DELAY);
	GLCD_setBackColor (White);
  	xSemaphoreGive(lcdLock);

	vTaskDelay(900 / portTICK_RATE_MS);


	return i;
}
void init_display (void) 
{
  /* LCD Module init */

  GLCD_init();

  GLCD_clear(Navy);
  GLCD_setBackColor(Navy);
  GLCD_setTextColor(White);
    
  GLCD_displayStringLn(Line0, "       VBEB Co.,Ltd");
  GLCD_displayStringLn(Line3, "Libarary Management");
	GLCD_displayStringLn(Line4, "      Center");
	GLCD_displayStringLn(Line6, "    Version 1.0");

  GLCD_bitmap (5, 10, 95, 35, VBEBLogo); 

//  upd_display ();

}