コード例 #1
0
ファイル: screen.c プロジェクト: tcp/Embedded
/**
 * Display one line of text plus a grid with numbers
 * from 0 to 9. Asking for example to "Enter Code
 *
 * textCol - text color, see file GLCD.h (not all colors work)
 * text - a number of characters forming a text string
 * numberOfDigits - maximum number of digits in response
 *
 * returns entered number, which can be 0
 */
int screenQueryNumber(unsigned short textCol, unsigned char text[], int numberOfDigits) {
	int dataX;
	int dataY;
	int digit = 0;
	char cDigit;
	int pos = 0;
	int totalInput = 0;

	screenClear ();

 	xSemaphoreTake(lcdLock, portMAX_DELAY);
	//clear display
	GLCD_clear(White);
	//set color
	GLCD_setTextColor(textCol);
	//write text on bottom line
  	GLCD_displayStringLn(Line9, text);
	xSemaphoreGive(lcdLock);

	//show grid with numbers
	screenDisplayGrid(1, 0);

	//loop over touched numbers
	while (pos < numberOfDigits && digit < 201) {
		//find out where screen touched
		screenTouched(&dataX, &dataY);

		//find out the meaning of where screen touched
		digit = screenGridTouchedDigit(dataX, dataY);
		if(digit >= 0 && digit <= 9) {
			//regular input of digit
			pos++;
			cDigit = digit + 48;
			totalInput = totalInput*10 + digit;
			screenDisplayChar(0, pos, textCol, cDigit);
		} else if (digit == 200 && pos > 0 ) {
			//delete previous character
			cDigit = ' ';
			totalInput = totalInput/10;		
			screenDisplayChar(0, pos, textCol, cDigit);
			pos--;
		}
	}
	if(digit == 201) {
		//cancel pressed
		totalInput = 0;
	}

	return totalInput;
}
コード例 #2
0
ファイル: Exp17_1.c プロジェクト: neoelec/ok128c_2
int main(void)
{
    uint8_t i;

    MCU_initialize();                           // initialize MCU and kit
    Delay_ms(50);                               // wait for system stabilization
    LCD_initialize();                           // initialize text LCD module
    Beep();

    GLCD_clear();                               // initialize GLCD screen
    cursor_flag = 0;                            // cursor off

    LCD_string(0x80, "Graphic LCD Test");       // display title on text LCD
    LCD_string(0xC0, " ASCII(English) ");

    while (1) {
        GLCD_string(0, 0, "  OK-128 Kit  V3.0  ");  // display screen 1
        GLCD_string(1, 0, "     2006/05/01     ");
        GLCD_string(2, 0, "                    ");
        GLCD_string(3, 0, "     Designed by    ");
        GLCD_string(4, 0, "   Duck-Yong Yoon.  ");
        GLCD_string(5, 0, "                    ");
        GLCD_string(6, 0, "      Made by       ");
        GLCD_string(7, 0, " Ohm Publishing Co. ");
        Delay_ms(5000);

        GLCD_string(0, 0, "     Hyundai LCD    ");  // display screen 2
        GLCD_string(1, 0, "    HG12605NY-LY    ");
        GLCD_string(2, 0, "                    ");
        GLCD_string(3, 0, "    Yellow/Green    ");
        GLCD_string(4, 0, " LED Backlight Type ");
        GLCD_string(5, 0, "                    ");
        GLCD_string(6, 0, "128 x 64 Graphic LCD");
        GLCD_string(7, 0, " 6x8 Box, 5x7 ASCII ");
        Delay_ms(5000);

        GLCD_string(0, 0, "====================");  // display screen 3
        GLCD_string(1, 0, "  ASCII Characters  ");
        GLCD_string(2, 0, "====================");
        GLCD_string(7, 0, "                    ");

        GLCD_xy(3, 0);
        for (i = 0x20; i < 0x7F; i++)           // from 0x20 to 0x7E
            GLCD_character(i);
        Delay_ms(5000);
    }

    return 0;
}
コード例 #3
0
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 ();

}
コード例 #4
0
ファイル: screen.c プロジェクト: tcp/Embedded
/**
 * Clear diplay - make white
 */
void screenClear () {

  xSemaphoreTake(lcdLock, portMAX_DELAY);
  GLCD_clear(White);
  xSemaphoreGive(lcdLock);
}
コード例 #5
0
ファイル: Exp17_2.c プロジェクト: neoelec/ok128c_2
int main(void)
{
    uint8_t i, j, count;
    uint16_t seed, random;

    MCU_initialize();                           // initialize MCU and kit
    Delay_ms(50);                               // wait for system stabilization
    LCD_initialize();                           // initialize text LCD module
    Beep();

    GLCD_clear();                               // initialize GLCD screen
    cursor_flag = 0;                            // cursor off

    LCD_string(0x80, "Graphic LCD Test");       // display title on text LCD
    LCD_string(0xC0, " Visiting Count ");

    for (i = 0; i <= 7; i++)                    // clear visit room
        for (j = 0; j <= 19; j++)
            table[i][j] = 0;
    visit_flag = 0;
    x = 4;                                      // starting position
    y = 10;

    seed = ((uint16_t) RTC_SECOND) << 8;        // make seed of random number
    seed += (uint16_t) RTC_SECOND;
    seed *= (uint16_t) RTC_SECOND;
    seed -= (uint16_t) RTC_MINUTE;
    seed += (uint16_t) RTC_HOUR;
    srand(seed);                                // initialize random number

    while (visit_flag == 0) {
        random = rand();                        // get random number

        if (random <= 0x1FFF) {                 // 0x0000 - 0x1FFF
            if (y != 19) {
                y++;
                table[x][y] += 1;
            }
        } else if (random <= 0x3FFF) {          // 0x2000 - 0x3FFF
            if (y != 0) {
                y--;
                table[x][y] += 1;
            }
        } else if (random <= 0x5FFF) {          // 0x4000 - 0x5FFF
            if (x != 7) {
                x++;
                table[x][y] += 1;
            }
        } else {                                // 0x6000 - 0x7FFF
            if (x != 0) {
                x--;
                table[x][y] += 1;
            }
        }

        for (i = 0; i <= 7; i++)                // display visiting count
            for (j = 0; j <= 19; j++) {
                count = table[i][j];
                if (count >= 62)
                    count = '*';
                else if (count >= 36)
                    count = count - 36 + 'a';
                else if (count >= 10)
                    count = count - 10 + 'A';
                else
                    count = count + '0';
                GLCD_xy(i, j);
                GLCD_character(count);
            }
        Delay_ms(100);

        visit_flag = 1;                         // check end
        for (i = 0; i <= 7; i++)
            for (j = 0; j <= 19; j++)
                if (table[i][j] == 0)
                    visit_flag = 0;
    }

    Beep();                                     // complete sound
    while (1) ;

    return 0;
}