/* * Authors (alphabetical order) * - Andre Bernet * - Andreas Weitl * - Bertrand Songis * - Bryan J. Rentoul (Gruvin) * - Cameron Weeks * - Erez Raviv * - Gabriel Birkus * - Jean-Pierre Parisy * - Karl Szmutny * - Michael Blandford * - Michal Hlavinka * - Pat Mackenzie * - Philip Moss * - Rob Thomson * - Romolo Manfredini * - Thomas Husterer * * opentx is based on code named * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, * er9x by Erez Raviv: http://code.google.com/p/er9x/, * and the original (and ongoing) project by * Thomas Husterer, th9x: http://code.google.com/p/th9x/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include "opentx.h" void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att) { // ASSERT_IN_DISPLAY(p); if ((p) >= DISPLAY_END) { return; } if (att&FILL_WHITE) { // TODO I could remove this, it's used for the top bar if (*p & 0x0F) mask &= 0xF0; if (*p & 0xF0) mask &= 0x0F; } if (att & FORCE) { *p |= mask; } else if (att & ERASE) { *p &= ~mask; } else { *p ^= mask; } } #define PIXEL_GREY_MASK(y, att) (((y) & 1) ? (0xF0 - (COLOUR_MASK(att) >> 12)) : (0x0F - (COLOUR_MASK(att) >> 16))) void lcd_plot(coord_t x, coord_t y, LcdFlags att) { if (x<0 || x>=LCD_W || y<0 || y>=LCD_H) return; uint8_t *p = &displayBuf[ y / 2 * LCD_W + x ]; uint8_t mask = PIXEL_GREY_MASK(y, att); if (p= LCD_H) return; if (x+w > LCD_W) { if (x >= LCD_W ) return; w = LCD_W - x; } uint8_t *p = &displayBuf[ y / 2 * LCD_W + x ]; uint8_t mask = PIXEL_GREY_MASK(y, att); while (w--) { if (pat&1) { lcd_mask(p, mask, att); pat = (pat >> 1) | 0x80; } else { pat = pat >> 1; } p++; } } void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att) { if (x >= LCD_W) return; if (y >= LCD_H) return; if (h<0) { y+=h; h=-h; } if (y<0) { h+=y; y=0; if (h<=0) return; } if (y+h > LCD_H) { h = LCD_H - y; } if (pat==DOTTED && !(y%2)) { pat = ~pat; } while (h--) { if (pat & 1) { lcd_plot(x, y, att); pat = (pat >> 1) | 0x80; } else { pat = pat >> 1; } y++; } } void lcd_invert_line(int8_t line) { uint8_t *p = &displayBuf[line * 4 * LCD_W]; for (coord_t x=0; x w) { width = w; } if (x+width > LCD_W) { if (x >= LCD_W ) return; width = LCD_W-x; } uint8_t rows = (*q++ + 1) / 2; for (uint8_t row=0; row= DISPLAY_END) return; uint8_t b = *q++; if (y & 1) { *p = (*p & 0x0f) + ((b & 0x0f) << 4); *(p+LCD_W) = (*(p+LCD_W) & 0xf0) + ((b & 0xf0) >> 4); } else { *p = b; } p++; } } } #endif