void display_button(int button) { xSemaphoreTake(lcdLock, portMAX_DELAY); GLCD_setTextColor(Black); GLCD_drawRect(buttons[button].upper, buttons[button].right, buttons[button].lower-buttons[button].upper, buttons[button].left-buttons[button].right); GLCD_displayChar(buttons[button].upper + 10, buttons[button].right + 20, *(buttons[button].text)); xSemaphoreGive(lcdLock); }
/** * Display one character, in pos y, x * with color according to textCol (= text color) * with size of y = line number * with size of x = number of characters from left border * (max 20 characters on one line) * * y = 0 -> first line, y = 2 -> second line.... * * in this case input x=0 means the left border * A small distance to the right will be added to x */ static void screenDisplayChar(int y, int x, unsigned short textCol, char c) { unsigned char cOut; cOut = c; xSemaphoreTake(lcdLock, portMAX_DELAY); GLCD_setTextColor(textCol); GLCD_displayChar(y * 24, 304 - 16 * x, cOut); xSemaphoreGive(lcdLock); }
/******************************************************************************* * Disply string on given line * * Parameter: s*: pointer to string * * ln: line number * * Return: * *******************************************************************************/ void GLCD_displayStringLn(unsigned int ln, unsigned char *s) { unsigned int i = 0; unsigned int refcolumn = (WIDTH/*-1*/)-16; while ((*s != 0) & (i < 20)) /* write the string character by character on lCD */ { GLCD_displayChar(ln, refcolumn, *s); /* Display one character on LCD */ refcolumn -= 16; /* Decrement the column position by 16 */ s++; /* Point on the next character */ i++; /* Increment the character counter */ } }
/** * help routine to display a grid on the screen * * type = 0 if characters * type = 1 if numbers * capsIn = 0 when characters and lower case characters shall be used * capsIn = 1 when characters and capital charaters shall be used * */ static void screenDisplayGrid(int type, int capsIn) { //uint16_t x0 = 150; //uint8_t y0 = 28; //make longer lines when characters uint16_t lengthH = (type) ? 210 : 290; uint16_t lengthV = (type) ? 170 : 138; //lower case characters are 32 above capital characters int caps = (capsIn) ? 0 : 32; int yD, yC, yE; int xD, xC, xE; int i; xSemaphoreTake(lcdLock, portMAX_DELAY); if(type == 0) { //display characters //first two lines with characters for (i = 0; i < 19; i++) GLCD_displayChar(38 + 50 * (i/10), 302 - 30 * (i % 10), 65 + i + caps); //third line with characters for (i = 0; i < 7; i++) GLCD_displayChar(138, 302 - 30 * (i % 10), 84 + i + caps); //decide where to draw Delete, Cancel and Enter yD = yC = yE = 182; xD = 302; xC = 182; xE = 80; } else { //display numbers GLCD_displayChar(38, 278,'7'); GLCD_displayChar(38, 208,'8'); GLCD_displayChar(38, 138,'9'); GLCD_displayChar(88, 278,'4'); GLCD_displayChar(88, 208,'5'); GLCD_displayChar(88, 138,'6'); GLCD_displayChar(138, 278,'1'); GLCD_displayChar(138, 208,'2'); GLCD_displayChar(138, 138,'3'); GLCD_displayChar(188, 208,'0'); //decide where to draw Delete, Cancel and Enter yD = 38; yC = 88; yE = 138; xD = xC = xE = 74; } //draw Delete, starting in position yD, xD GLCD_displayChar(yD, xD, 'D'); GLCD_displayChar(yD, xD - 14,'e'); GLCD_displayChar(yD, xD - 28,'l'); GLCD_displayChar(yD, xD - 42,'e'); GLCD_displayChar(yD, xD - 56,'t'); GLCD_displayChar(yD, xD - 70,'e'); //draw Cancel, starting in position yC, xC GLCD_displayChar(yC, xC, 'C'); GLCD_displayChar(yC, xC - 14,'a'); GLCD_displayChar(yC, xC - 28,'n'); GLCD_displayChar(yC, xC - 42,'c'); GLCD_displayChar(yC, xC - 56,'e'); GLCD_displayChar(yC, xC - 70,'l'); //draw Enter, starting in posinio yE, xE GLCD_displayChar(yE, xE, 'E'); GLCD_displayChar(yE, xE - 14,'n'); GLCD_displayChar(yE, xE - 28,'t'); GLCD_displayChar(yE, xE - 42,'e'); GLCD_displayChar(yE, xE - 56,'r'); //draw help lines GLCD_drawLine(68, 315 - lengthH, lengthH, Horizontal); GLCD_drawLine(118, 315 - lengthH, lengthH, Horizontal); GLCD_drawLine(168, 315 - lengthH, lengthH, Horizontal); if (type == 0) { //add text: Caps GLCD_displayChar(138, 80, 'S'); GLCD_displayChar(138, 66, 'p'); GLCD_displayChar(138, 52, 'a'); GLCD_displayChar(138, 38, 'c'); GLCD_displayChar(138, 24, 'e'); // add an filled arrow, down if caps now, up if lower case now GLCD_displayChar( 88, 24, 133 + 2 * capsIn); //draw verical lines for displayed characters for (i = 0; i < 9; i++) GLCD_drawLine(30, 295 - i * 30, lengthV - (i / 7) * 50, Vertical); //special lines around Delete, Cancel and Enter GLCD_drawLine(170, 315 - lengthH, lengthH, Horizontal); GLCD_drawLine(210, 315 - lengthH, lengthH, Horizontal); GLCD_drawLine(212, 315 - lengthH, lengthH, Horizontal); for (i = 0; i < 2; i++) { GLCD_drawLine(171, 108 + i * 108, 38, Vertical); GLCD_drawLine(171, 110 + i * 108, 38, Vertical); } } else { //draw vertical lines for displayed numbers GLCD_drawLine(30, 245, lengthV, Vertical); GLCD_drawLine(30, 175, lengthV, Vertical); //special lines around Delete, Cancel and Enter GLCD_drawLine(26, 0, 94, Horizontal); GLCD_drawLine(28, 0, 92, Horizontal); GLCD_drawLine(68, 0, 92, Horizontal); GLCD_drawLine(70, 0, 92, Horizontal); GLCD_drawLine(118, 0, 92, Horizontal); GLCD_drawLine(120, 0, 92, Horizontal); GLCD_drawLine(168, 0, 92, Horizontal); GLCD_drawLine(170, 0, 94, Horizontal); GLCD_drawLine(28, 92, 142, Vertical); GLCD_drawLine(26, 94, 144, Vertical); } xSemaphoreGive(lcdLock); }