For the most part SPI should be SPI... That is normally if you try to compile something with SPI library, it will hopefully get the right version...
Again does the version of software up on the google drive work for you, to actually get something to work on that display on a Teensy?
If so you the can start to try to optimize it (or rewrite..).
But again not sure how specific this code is to your display?
But if you look at the code, like how it fills a rectangle you will see code like:
Code:
void LCDWIKI_SPI::Fill_Rect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
{
int16_t end;
if (w < 0)
{
w = -w;
x -= w;
} //+ve w
end = x + w;
if (x < 0)
{
x = 0;
}
if (end > Get_Width())
{
end = Get_Width();
}
w = end - x;
if (h < 0)
{
h = -h;
y -= h;
} //+ve h
end = y + h;
if (y < 0)
{
y = 0;
}
if (end > Get_Height())
{
end = Get_Height();
}
h = end - y;
[COLOR="#FF0000"] Set_Addr_Window(x, y, x + w - 1, y + h - 1);
CS_ACTIVE;[/COLOR]
if(lcd_driver == ID_932X)
{
writeCmd8(ILI932X_START_OSC);
}
[COLOR="#FF0000"]writeCmd8(CC); [/COLOR]
if (h > w)
{
end = h;
h = w;
w = end;
}
while (h-- > 0)
{
end = w;
do
{
[COLOR="#FF0000"]writeData16(color);[/COLOR]
} while (--end != 0);
}
if(lcd_driver == ID_932X)
{
Set_Addr_Window(0, 0, width - 1, height - 1);
}
else if(lcd_driver == ID_7575)
{
Set_LR();
}
[COLOR="#FF0000"] CS_IDLE;[/COLOR]
}
I set some interesting things in RED in the above listing. You then need to look at each of these functions.... like Set_Addr_Window, which for 1283, does things lik:
Code:
else if(lcd_driver == ID_1283A)
{
int16_t t1,t2;
switch(rotation)
{
case 0:
case 2:
t1=x1;
t2=x2;
x1=y1+2;
x2=y2+2;
y1=t1+2;
y2=t2+2;
break;
case 1:
case 3:
y1=y1+2;
y2=y2+2;
break;
}
writeCmd8(XC);
writeData8(x2);
writeData8(x1);
writeCmd8(YC);
writeData8(y2);
writeData8(y1);
writeCmd8(0x21);
writeData8(x1);
writeData8(y1);
writeCmd8(CC);
}
You see that it does a lot of writeCmd8 and writeData8... Which you can start to translate into the functions like in the ili9341_t3 library.
The above might look something like:
Code:
writecommand_cont(XC);
writedata8_cont(x2);
writedata8_cont(x1);
writecommand_cont(YC);
writedata8_cont(y2);
writedata8_cont(y1);
writecommand_cont(0x21);
writedata8_cont(x1);
writedata8_cont(y1);
writecommand_cont(CC);
You would again need to make sure DC and CS pins are on Hardware CS pins... Or you could do like ILI9341_t3n, where I made it that only the DC pin needed to be on hardware CS pin, you got a slight boast in speed from the CS pin, but mainly with DC...
You would need to make similar changes to the fillRect function, where you would change to writecommand_cont and the write of colors, you might use the writedata16_cont for all of the words, or better you figure out how many of these words to write (w*h) and write that count -1 with the writedata16_cont and the last one with writedata16_last.
...
Then depending on how you handle CS pin, you might use or not use functions like cs_active...