/** * @brief Displays a rectangle. * @param Xpos: specifies the X position. * @param Ypos: specifies the Y position. * @param Height: display rectangle height. * @param Width: display rectangle width. * @retval None */ void GLCD_drawRect(uint8_t Xpos, uint16_t Ypos, uint8_t Height, uint16_t Width) { GLCD_drawLine(Xpos, Ypos, Width, Horizontal); GLCD_drawLine((Xpos + Height), Ypos, Width, Horizontal); GLCD_drawLine(Xpos, Ypos, Height, Vertical); GLCD_drawLine(Xpos, Ypos + Width, Height + 1, Vertical); }
/** * 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); }
/** * @brief Displays a filled rectangle. * @param Xpos: specifies the X position. * @param Ypos: specifies the Y position. * @param Height: display rectangle height. * @param Width: display rectangle width. * @retval None */ void GLCD_fillRect(uint8_t Xpos, uint16_t Ypos, uint8_t Height, uint16_t Width) { u16 i; for (i = 0; i <= Height; ++i) GLCD_drawLine(Xpos + i, Ypos, Width + 1, Horizontal); }