void BitLedState::InverseDot(uint8_t& digitState) { if(digitState & 0b00000001) SetDot(0, digitState); else SetDot(1, digitState); }
void DrawRoundRect(unsigned char x, unsigned char y, unsigned char width, unsigned char height, unsigned char radius, unsigned char color) { int tSwitch, x1 = 0, y1 = radius; tSwitch = 3 - 2 * radius; while (x1 <= y1) { SetDot(x+radius - x1, y+radius - y1, color); SetDot(x+radius - y1, y+radius - x1, color); SetDot(x+width-radius + x1, y+radius - y1, color); SetDot(x+width-radius + y1, y+radius - x1, color); SetDot(x+width-radius + x1, y+height-radius + y1, color); SetDot(x+width-radius + y1, y+height-radius + x1, color); SetDot(x+radius - x1, y+height-radius + y1, color); SetDot(x+radius - y1, y+height-radius + x1, color); if (tSwitch < 0) { tSwitch += (4 * x1 + 6); } else { tSwitch += (4 * (x1 - y1) + 10); y1--; } x1++; } DrawHoriLine(x+radius, y, width-(2*radius), color); // top DrawHoriLine(x+radius, y+height, width-(2*radius), color); // bottom DrawVertLine(x, y+radius, height-(2*radius), color); // left DrawVertLine(x+width, y+radius, height-(2*radius), color); // right }
void main(void) { unsigned char x; unsigned char y; char t; int time; TRISD = 0; PORTD = 0; TRISB = 0x00; TRISA = 0xFF; PORTB = 0; T0CON = 0x88; GLCDinit(); clearGLCD(0,7,0,127); ADCON1 = 0x0D; ADCON0 = 0x05; ADCON2 = 0x11; y = 20; t = 0; while(1) { ADCON0bits.GO = 1; while (ADCON0bits.GO) { } x = ADRESH; x = x/8 + 24; SetDot(x, y); y++; if (y == 100) { y = 20; clearGLCD(0,7,0,127); } } }
void Display::SetDisplay(const Buffer &buffer) { for (uint8_t x = 0; x < 30; ++x) for (uint8_t y = 0; y < 8; ++y) { bool oldSet = frontBuffer.columns[x] & (1UL << y); bool newSet = buffer.columns[x] & (1UL << y); if (oldSet != newSet) { SetDot(x, y, newSet); frontBuffer.SetDot(x, y, newSet); } } }