// fill a rectangle void lcd_fillRect( unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int color ) { unsigned char hi, lo; // rudimentary clipping (drawChar w/big text requires this) if((x >= _width) || (y >= _height)) return; if((x + w - 1) >= _width) w = _width - x; if((y + h - 1) >= _height) h = _height - y; lcd_setAddrWindow(x, y, x+w-1, y+h-1); hi = color >> 8, lo = color; LCD_PORT |= LCD_RS_BIT; LCD_PORT &= ~LCD_CSN_BIT; for(y=h; y>0; y--) { for(x=w; x>0; x--) { lcd_spiwrite_byte(hi); lcd_spiwrite_byte(lo); } } LCD_PORT |= LCD_CSN_BIT; }
void display_requestBlank() { doBlank = true; } void display_update(s_monitorData* monitorData) { if(doBlank) { display_setMode(DISPLAY_MODE_BLANK); lcd_setAddrWindow(0, 0, LCD_WIDTH - 1, LCD_HEIGHT - 1); doBlank = false; } // Only redraw if something changed static byte lastHistory = 255; if(!forceRedraw && lastHistory == monitorData->netHistoryIdx) return; lastHistory = monitorData->netHistoryIdx; forceRedraw = false; #if CFG_FPS millis_t frameStart = millis(); #endif if(displayFunc != NULL) displayFunc(monitorData); #if CFG_FPS millis_t frameTime = millis() - frameStart;
void lcd_drawPixel( unsigned int x, unsigned int y, unsigned int color) { if ((x >= _width) || (y >= _height)) return; lcd_setAddrWindow(x,y,x+1,y+1); LCD_PORT |= LCD_RS_BIT; LCD_PORT &= ~LCD_CSN_BIT; lcd_spiwrite_byte(color >> 8); lcd_spiwrite_byte(color); LCD_PORT |= LCD_CSN_BIT; }