intergalatico
Well-known member
Hi,
I am trying to drive 4 displays, each two with different libraries:
ILI9341_AS View attachment Adafruit_ILI9341_AS.zip
Digole: http://www.digole.com/images/file/Tech_Data/DigoleSerial.zip
I noticed that the digole's display won't work together with the ILI9341_AS. When I run the code, only the ILI9341 works, the digole don't react. When I erase these lines the digole works but, of course, the ILI9341_AS don't:
Is because they are sharing the SPI library? Or something about bitrate? Please, someone help me!
Thank you!
Here is my code:
I am trying to drive 4 displays, each two with different libraries:
ILI9341_AS View attachment Adafruit_ILI9341_AS.zip
Digole: http://www.digole.com/images/file/Tech_Data/DigoleSerial.zip
I noticed that the digole's display won't work together with the ILI9341_AS. When I run the code, only the ILI9341 works, the digole don't react. When I erase these lines the digole works but, of course, the ILI9341_AS don't:
Code:
tft1.init();
tft2.init();
Is because they are sharing the SPI library? Or something about bitrate? Please, someone help me!
Thank you!
Here is my code:
Code:
#include <SPI.h>
#include <Wire.h>
// These are the connections for the UNO
#define sclk 13 // Don't change
#define mosi 11 // Don't change
#define tft1_cs 3
#define tft1_dc 4
#define tft1_rst 9
#define tft2_cs 5
#define tft2_dc 6
#define tft2_rst 10
#include <Adafruit_GFX_AS.h> // Core graphics library
#include <Adafruit_ILI9341_AS.h> // Hardware-specific library
#define _Digole_Serial_SPI_ //To tell compiler compile the special communication only,
//all available are:_Digole_Serial_UART_, _Digole_Serial_I2C_ and _Digole_Serial_SPI_
#include <DigoleSerial.h>
//--------SPI setup
#if defined(_Digole_Serial_SPI_)
DigoleSerialDisp mydisp1(11,13,20); //SPI:Pin 8: data, 9:clock, 10: SS, you can assign 255 to SS, and hard ground SS pin on module
DigoleSerialDisp mydisp2(11,13,21);
#endif
#define SC_W 176 //screen width in pixels
#define SC_H 220 //screen Hight in pixels
// Color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
Adafruit_ILI9341_AS tft1 = Adafruit_ILI9341_AS(tft1_cs, tft1_dc, tft1_rst); // Invoke custom library
Adafruit_ILI9341_AS tft2 = Adafruit_ILI9341_AS(tft2_cs, tft2_dc, tft2_rst);
void setup(void) {
mydisp1.begin();
mydisp1.clearScreen(); //CLear screen
mydisp1.setBackLight(50);
mydisp2.begin();
mydisp2.clearScreen(); //CLear screen
mydisp2.setBackLight(50);
delay(500);
tft1.init();
tft1.setRotation(2);
tft1.fillScreen(ILI9341_BLACK);
tft2.init();
tft2.setRotation(2);
tft2.fillScreen(ILI9341_BLACK);
delay(1000);
delay(1000);
}
void loop() {
tft1.setCursor(30, 70);
tft1.setRotation(45);
tft1.fillScreen(BLUE);
tft1.setTextColor(WHITE);
tft1.setTextSize(9);
tft1.println("Hallo");
//delay(10);
tft2.setCursor(30, 70);
tft2.setRotation(45);
tft2.fillScreen(GREEN);
tft2.setTextColor(BLUE);
tft2.setTextSize(9);
tft2.println("OI");
mydisp1.clearScreen();
mydisp1.setDrawWindow(0, 0, 176, 220);
mydisp1.setColor(50);
mydisp1.setBgColor();
mydisp1.cleanDrawWindow();
mydisp1.setRotation(45);
mydisp1.setFont(120);
mydisp1.setColor(000000000);
mydisp1.setPrintPos(5,2);
mydisp1.print(" CHORUS");
mydisp2.clearScreen();
mydisp2.setDrawWindow(0, 0, 176, 220);
mydisp2.setColor(255255000);
mydisp2.setBgColor();
mydisp2.cleanDrawWindow();
mydisp2.setRotation(45);
mydisp2.setFont(120);
mydisp2.setColor(000000000);
mydisp2.setPrintPos(5,2);
mydisp2.print("OVERDRIVE");
delay(3000);
tft1.fillRect(20, 30, 300, 200, GREEN);
tft1.setCursor(30, 70);
tft1.println("Hallo");
//delay(10);
tft2.fillRect(20, 30, 300, 200, RED);
tft2.setCursor(30, 70);
tft2.println("OI");
delay(2000);
mydisp1.setRotation(45);
mydisp1.setDrawWindow(15, 15, 190, 150);
mydisp1.setColor(255000000);
mydisp1.setBgColor();
mydisp1.cleanDrawWindow();
mydisp1.setFont(120);
mydisp1.setColor(000000000);
mydisp1.setPrintPos(5,1);
mydisp1.print(" CHORUS ");
mydisp2.setRotation(45);
mydisp2.setDrawWindow(15, 15, 190, 150);
mydisp2.setColor(255000000);
mydisp2.setBgColor();
mydisp2.cleanDrawWindow();
mydisp2.setFont(120);
mydisp2.setColor(000000000);
mydisp2.setPrintPos(2,1);
mydisp2.print(" OVERDRIVE ");
delay(5000);
mydisp1.setColor(000000000);
mydisp1.setBgColor();
mydisp2.setColor(000000000);
mydisp2.setBgColor();
}