bonjour,
je rencontre un soucis avec la bibliothèque tinyfat,
j'ai un code retour 0x11 soit ERROR_ANOTHER_FILE_OPEN lorsque je tente de lire un fichier
voici mon code :
class derivant de UTFT avec ajout de la methode drawTransBitmap venant de UTFT_tinyFAT
RUTFT::RUTFT(byte model, int RS, int WR,int CS, int RST, int SER):UTFT(model,RS,WR,CS,RST,SER){
}
word RUTFT::drawTransBitmap(int x, int y, int sx, int sy, char* fileName, word transColor){
int res;
int cx, cy, cp;
word temp, result;
byte r,g,b;
tinyFAT file = tinyFAT();
Serial.print("openFile :");Serial.println(fileName);
res=file.openFile(fileName, FILEMODE_BINARY);
if (res==NO_ERROR)
{
cbi(this->P_CS, this->B_CS);
cx=0;
cy=0;
result=512;
if (this->orient==PORTRAIT)
{
this->setXY(x, y, x+sx-1, y+sy-1);
}
while (result==512)
{
result=file.readBinary();
switch(result)
{
case ERROR_WRONG_FILEMODE:
return ERROR_WRONG_FILEMODE;
break;
case ERROR_NO_FILE_OPEN:
return ERROR_NO_FILE_OPEN;
break;
default:
if (this->orient==PORTRAIT)
{
for (int i=0; i<result; i+=2)
this->LCD_Write_DATA(file.buffer[i],file.buffer[i+1]);
}
else
{
cp=0;
while (cp<result)
{
if (((result-cp)/2)<(sx-cx))
{
this->setXY(x+cx, y+cy, x+cx+((result-cp)/2)-1, y+cy);
for (int i=(result-cp)-2; i>=0; i-=2)
this->LCD_Write_DATA(file.buffer[cp+i],file.buffer[cp+i+1]);
cx+=((result-cp)/2);
cp=result;
}
else
{
this->setXY(x+cx, y+cy, x+sx-1, y+cy);
for (int i=sx-cx-1; i>=0; i--)
this->LCD_Write_DATA(file.buffer[cp+(i*2)],file.buffer[cp+(i*2)+1]);
cp+=(sx-cx)*2;
cx=0;
cy++;
}
}
}
break;
}
}
file.closeFile();
this->setXY(0,0,this->getDisplayXSize()-1,this->getDisplayYSize()-1);
sbi(this->P_CS, this->B_CS);
return 0;
}
else
{
Serial.print("Error openFile :");Serial.println(fileName);
return res;
}
}
Si j'utilise UTFT_tinyFat je ne rencontre pas ce soucis
Merci