/** * @brief Draws a pixel on the display. * * @param[in] x X location of the pixel * @param[in] y Y location of the pixel * @param[in] color The color of the pixel * * @notapi */ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) { #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP if (x < GDISP.clipx0 || y < GDISP.clipy0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return; #endif lld_lcdSetCursor(x, y); lld_lcdWriteReg(0x0022, color); }
static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) { switch(GDISP.Orientation) { case GDISP_ROTATE_0: lld_lcdWriteReg(0x0050, x); lld_lcdWriteReg(0x0051, x + cx - 1); lld_lcdWriteReg(0x0052, y); lld_lcdWriteReg(0x0053, y + cy - 1); break; case GDISP_ROTATE_90: lld_lcdWriteReg(0x0050, y); lld_lcdWriteReg(0x0051, y + cy - 1); lld_lcdWriteReg(0x0052, x); lld_lcdWriteReg(0x0053, x + cx - 1); break; case GDISP_ROTATE_180: lld_lcdWriteReg(0x0050, x); lld_lcdWriteReg(0x0051, x + cx - 1); lld_lcdWriteReg(0x0052, y); lld_lcdWriteReg(0x0053, y + cy - 1); break; case GDISP_ROTATE_270: lld_lcdWriteReg(0x0050, y); lld_lcdWriteReg(0x0051, y + cy - 1); lld_lcdWriteReg(0x0052, x); lld_lcdWriteReg(0x0053, x + cx - 1); break; } lld_lcdSetCursor(x, y); }
/** * @brief Clear the display. * @note Optional - The high level driver can emulate using software. * * @param[in] color The color of the pixel * * @notapi */ void GDISP_LLD(clear)(color_t color) { unsigned i; lld_lcdSetCursor(0, 0); lld_lcdWriteStreamStart(); for(i = 0; i < SCREEN_WIDTH * SCREEN_HEIGHT; i++) lld_lcdWriteData(color); lld_lcdWriteStreamStop(); }
void gdisp_lld_clear(color_t color) { unsigned i; lld_lcdSetCursor(0, 0); lld_lcdWriteStreamStart(); for(i = 0; i < GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT; i++) lld_lcdWriteData(color); lld_lcdWriteStreamStop(); }
static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) { lld_lcdSetCursor(x, y); /* Reg 0x44 - Horizontal RAM address position * Upper Byte - HEA * Lower Byte - HSA * 0 <= HSA <= HEA <= 0xEF * Reg 0x45,0x46 - Vertical RAM address position * Lower 9 bits gives 0-511 range in each value * 0 <= Reg(0x45) <= Reg(0x46) <= 0x13F */ switch(GDISP.Orientation) { case portrait: lld_lcdWriteReg(0x44, (((x+cx-1) << 8) & 0xFF00 ) | (x & 0x00FF)); lld_lcdWriteReg(0x45, y & 0x01FF); lld_lcdWriteReg(0x46, (y+cy-1) & 0x01FF); break; case landscape: lld_lcdWriteReg(0x44, (((y+cy-1) << 8) & 0xFF00) | (y & 0x00FF)); lld_lcdWriteReg(0x45, x & 0x01FF); lld_lcdWriteReg(0x46, (x+cx-1) & 0x01FF); break; case portraitInv: lld_lcdWriteReg(0x44, (((SCREEN_WIDTH-x-1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (x+cx)) & 0x00FF)); lld_lcdWriteReg(0x45, (SCREEN_HEIGHT-(y+cy)) & 0x01FF); lld_lcdWriteReg(0x46, (SCREEN_HEIGHT-y-1) & 0x01FF); break; case landscapeInv: lld_lcdWriteReg(0x44, (((SCREEN_WIDTH - y - 1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (y+cy)) & 0x00FF)); lld_lcdWriteReg(0x45, (SCREEN_HEIGHT - (x+cx)) & 0x01FF); lld_lcdWriteReg(0x46, (SCREEN_HEIGHT - x - 1) & 0x01FF); break; } lld_lcdSetCursor(x, y); }
/** * @brief Get the color of a particular pixel. * @note Optional. * @note If x,y is off the screen, the result is undefined. * * @param[in] x, y The start of the text * * @notapi */ color_t GDISP_LLD(getpixelcolor)(coord_t x, coord_t y) { color_t color; #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP if (x < 0 || x >= GDISP.Width || y < 0 || y >= GDISP.Height) return 0; #endif lld_lcdSetCursor(x, y); lld_lcdWriteStreamStart(); color = lld_lcdReadData(); color = lld_lcdReadData(); lld_lcdWriteStreamStop(); return color; }
/** * @brief Get the color of a particular pixel. * @note Optional. * @note If x,y is off the screen, the result is undefined. * * @param[in] x, y The start of the text * * @notapi */ color_t GDISP_LLD(getpixelcolor)(coord_t x, coord_t y) { /* This routine is marked "DO NOT USE" in the original * GLCD driver. We just keep our GDISP_HARDWARE_READPIXEL * turned off for now. */ color_t color; #if GDISP_NEED_VALIDATION if (x >= GDISP.Width || y >= GDISP.Height) return 0; #endif lld_lcdSetCursor(x, y); lld_lcdWriteStreamStart(); color = lld_lcdReadData(); color = lld_lcdReadData(); lld_lcdWriteStreamStop(); return color; }