Choix de la librairie pour TFT SeedStudio 2.8" Touch

Bonjour à tous,

Totalement Newbie sur Arduino, je suis un peu perdu dans le choix des librairies, Pourquoi?

Et bien j'ai commencé un sketch "Menu" tout bête pour prendre la main sur mon TFT.

Je trace des traits, déplace un rectangle selon le choix du menu par le tactile et affiche un intitulé.

#include <stdint.h>
#include <SeeedTouchScreen.h>
#include <TFTv2.h>
#include <SPI.h>

#define GRAY1		0x8410  
#define GRAY2		0x4208

//Tableaux
int YRecMenu[]={01,61,121,181};
unsigned int colors[] = {RED, GREEN, BLUE, YELLOW, BLACK};
char* MENU[]={"MENU 1: ACCUEIL","MENU 2: CONSOLE","MENU 3: LOCALISATION","MENU 4:PARAMETRES"};

//Variables
byte LimitMenu=40;
byte IndexBefMenu=0;
byte IndexTch=0;
int color = GREEN;  //Paint brush color

TouchScreen ts = TouchScreen(XP, YP, XM, YM); //init TouchScreen port pins


void setup()
{
    TFT_BL_ON;                                  // turn on the background light
    Tft.TFTinit();                              //init TFT library
    Serial.begin(115200);
    
    //Orientation du TFT
    Tft.setDisplayDirect(DOWN2UP);           //where XXXXXX is LEFT2RIGHT, RIGHT2LEFT, DOWN2UP, or UP2DOWN, in your code 

    // Rectangle de selection Menu
    Tft.fillRectangle(YRecMenu[0],39,59,5,RED);      
    
    //Dessiner le menu                                        
    Tft.drawHorizontalLine(0,LimitMenu,239,GRAY2);    
    Tft.drawVerticalLine(120,0,LimitMenu,GRAY2); 
    Tft.drawVerticalLine(180,0,LimitMenu,GRAY2); 
      
    //Tft.drawString("Hello",50,100,1,GRAY1);      
                                                        
}

void loop()
{
 
     // a point object holds x y and z coordinates.
    Point p = ts.getPoint();

    //map the ADC value read to into pixel co-ordinates

    p.x = map(p.x, TS_MINX, TS_MAXX, 0, 240);
    p.y = map(p.y, TS_MINY, TS_MAXY, 0, 320);
    
        if (p.z > __PRESURE) {
        // Detect  paint brush color change
        if(p.y < LimitMenu)
        {
           IndexTch = p.x/60;
           if ( IndexTch!= IndexBefMenu){
             color = colors[IndexTch];
            // Rectangle de selection Menu
            Tft.fillRectangle(YRecMenu[IndexTch],39,59,5,color);       
            // Effacer le precedent Rectangle de selection Menu
            Tft.fillRectangle(YRecMenu[IndexBefMenu],39,59,5,BLACK);        
            // Afficher le libellé du menu
            Tft.fillRectangle(1,318,15,270,color); 
            Tft.drawString(MENU[IndexTch],5,314,1,GRAY1); 
           IndexBefMenu=IndexTch;
         }
        }
        else
        {
            
        }
    }
}

Comme vous avez pu le voir, j'ai cherché à faire une rotation de l'écran pour l'avoir en paysage

    Tft.setDisplayDirect(DOWN2UP);           //where XXXXXX is LEFT2RIGHT, RIGHT2LEFT, DOWN2UP, or UP2DOWN, in your code

Et c'est la que le bas blesse, l'écran passe bien en paysage, mais pas le point '0:0' qui reste en haut à droite (TFT en paysage)

J'ai donc cherché une autre solution, et j'ai trouvé rotate(x)

dans la librairie Adafruit-GFX-Library-master, mais ça ne fonctionne pas, et une pelle d'erreurs sont générées à la compilation, malgré l'appel

#include <Adafruit_GFX.h>.

Comme dit plus haut, j'ai recu mon premier Arduino hier, et je découvre, si quelqu'un pouvait m'en dire comment faire le choix parmi la forêt des librairies existantes pour le même shield! Quels seraient les points d'attention?

Merci à tous

Si tu nous donnais un aperçu des erreurs lors de l'utilisation de Adafruit_GFX ce serait plus facile de t'aider.
Déjà,

  • lors de l'installation il faut retirer -master du nom de répertoire quand tu installes la librairie
  • la librairie GFX est une librairie de haut niveau qui s'appuie sur une couche bas niveau spécifique à un type d'afficheur. Donc il faut regarder sur le github d'Adafruit si tu trouves la librairie bas niveau compatible de ton afficheur

Merci fdufnews pour ces précisions,

En fait, je pense ne pas maitriser ceci:

#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0

#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin


Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

Dans la doc constructeur du TFT, il est dit:

Chip Select, Data/Command, and Backlight pins: 
Arduino D4  to TF_CS: 

Used for SD card chip select (CS) SPI pin. 
This pin will indicate the shield that the Arduino wants to send and receive data to and from the micro SD card.
 Arduino D5  to TFT_CS: 

Used for touch screen chip select (CS) SPI pin. 
This pin will indicate the shield that the Arduino wants to send and receive data to and from the display/screen.
 Arduino D6  to TFT_D/C: 

Used for TFT Data/Command control pin. 
The value of this pin (HIGH, or LOW) will tell the shield if the Arduino wants to send data or commands.
 Arduino D7  to BACKLIGHT: 

Used for touch screen backlight on/off control. 


SPI Interface / Data Communication Pins: 
Arduino D10  is SPI (CS) chip select pin: 

This pin is not used by the TFT shield. 
Arduino D11  is SPI (MOSI) data pin: 

Used as data pin for SD card and screen. This pin is used by the Arduino to send data to the SD card or screen.
 Arduino D12  is SPI (MISO) pin: 

Used as data pin for SD card and screen. This is the pin that the Arduino uses to receive data from the SD card or screen.
 Arduino D13  is SPI (SCK) pin: 

Used as serial clock pin for SD card and screen. This pin is used to clock data in and out of the Arduino.

Je n'ai pas de déclaration à faire pour les digitales?