Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

optimized drawvline - hopefully good to go now :/

  • Loading branch information...
commit 3ff8c0d33b0626d003e295fdad44be2dcb83fbce 1 parent 9e38dce
@ladyada ladyada authored
Showing with 12 additions and 12 deletions.
  1. +12 −12 Adafruit_GP9002.cpp
View
24 Adafruit_GP9002.cpp
@@ -85,36 +85,36 @@ void Adafruit_GP9002::drawFastVLine(uint16_t x, uint16_t orig_y, uint16_t h, uin
while (h) {
if ((h >= 8) && ((orig_y) % 8 == 0))
break;
- Serial.print("("); Serial.print(x, DEC); Serial.print(", "); Serial.print(orig_y); Serial.println(")");
drawPixel(x, orig_y, color);
orig_y++;
h--;
}
if (h >= 8) {
- while (h >= 8) {
// calculate addr
uint16_t addr = 0;
addr = x*8;
- uint16_t y = orig_y;
+ uint16_t y = orig_y+h-8;
y = 63 - y;
addr += y/8;
Serial.println(addr, HEX);
- command(GP9002_ADDRHELD);
+ command(GP9002_ADDRINCR);
command(GP9002_ADDRL);
dataWrite(addr & 0xFF);
command(GP9002_ADDRH);
dataWrite(addr >> 8);
command(GP9002_DATAWRITE);
- // draw 8 pixels at once!
- if (color)
- dataWrite(0xFF);
- else
- dataWrite(0x00);
- h -= 8;
- orig_y += 8;
- }
+
+ while (h >= 8) {
+ // draw 8 pixels at once!
+ if (color)
+ dataWrite(0xFF);
+ else
+ dataWrite(0x00);
+ h -= 8;
+ orig_y += 8;
+ }
}
while (h+1) {
drawPixel(x, orig_y-1, color);
Please sign in to comment.
Something went wrong with that request. Please try again.