So you can see black pixels along the top of the view. That's kind of weird.
Today I've been tweaking the fill routine for speed and accuracy.
I've got:
void fillRectangle(uint16_t colr, int xStart, int yStart, int width, int height) {
uint8_t dh, dl;
uint16_t pixels;
pixels = width * height;
dh = colr >> 8; dl = colr & 0xff;
wr_reg(ILI9325_DRCODE, 0);
wr_reg(ILI9325_VADDRST, xStart);
wr_reg(ILI9325_VADDREN, xStart + width - 1);
wr_reg(ILI9325_HGADDR, yStart);
wr_reg(ILI9325_VGADDR, xStart);
spiSetIndex(ILI9325_GRAM);
SPI_CSON();
SPI_DATA = ILI9325_START_SETREG;
do {
SPI_TXWAIT(); SPI_DATA = dh; SPI_DATA;
SPI_TXWAIT(); SPI_DATA = dl; SPI_DATA;
} while (--pixels);
SPI_CSOFF();
spiSetIndex(0);
}
This draws a solid rectangle (as the name suggests), but it seems to not finish the transaction correctly. I'm not writing a black pixel -- yet one ends up on the next row below the rectangle (or, if it fills the screen, at the top, because wrapping).
If I make _pixel_ one less, it doesn't draw the last (intentionally colored) pixel, and the last (intended) pixel is sometimes black.
That very last call, to spiSetIndex, seems to be the easiest way to fix it. A setReg or wr_reg operation doesn't seem to do it. (I didn't try a lone start byte, maybe that will work too.)
Aaaaalso, you can kinda guess what my API is doing here. The function names are kind of a mess, but the register macros at least are pretty coherent and self-explanatory.
Tim