// After sending a bitmap to both displays,
// one display can be filled with a color,
// but the other can not.
// It is regardless of the order, if the
// the second display is filled with a color first,
// then the first display does not work.
//
// Do two display use too much SRAM memory ?
// Or is it a bug in the library ?
//
// It happens with the hardware and the software SPI bus.
//
// When the bitmap is send twice to the first display,
// then it is no problem.
// When the bitmap is send twice to the second display,
// then the bug occurs.
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include "bitmaps.h"
#define TFT1_CS 10
#define TFT1_DC 9
#define TFT1_RST 8
#define TFT2_CS 6
#define TFT2_DC 13
#define TFT2_RST 5
// Hardware SPI bus
Adafruit_ILI9341 tft1 = Adafruit_ILI9341(TFT1_CS, TFT1_DC, TFT1_RST);
Adafruit_ILI9341 tft2 = Adafruit_ILI9341(TFT2_CS, TFT2_DC, TFT2_RST);
// Software SPI bus
// Adafruit_ILI9341 tft1 = Adafruit_ILI9341(TFT1_CS, TFT1_DC, MOSI, SCK, TFT1_RST, MISO);
// Adafruit_ILI9341 tft2 = Adafruit_ILI9341(TFT2_CS, TFT2_DC, MOSI, SCK, TFT2_RST, MISO);
void setup()
{
Serial.begin(115200);
Serial.println("Hello");
Serial.println("begin both");
tft1.begin();
tft2.begin();
tft1.setRotation(0);
tft2.setRotation(0);
Serial.println("colors both");
tft1.fillScreen(ILI9341_GREEN);
delay(500);
tft1.fillScreen(ILI9341_RED);
delay(500);
tft1.fillScreen(ILI9341_BLUE);
delay(500);
tft2.fillScreen(ILI9341_GREEN);
delay(500);
tft2.fillScreen(ILI9341_RED);
delay(500);
tft2.fillScreen(ILI9341_BLUE);
delay(500);
// Remove the bitmap and the colors will
// be written.
// Use the bitmap, and the second tft display
// does not get a color.
Serial.println("bitmap both");
tft1.drawBitmap(70, 120, LAMBDA, 100, 100, ILI9341_ORANGE);
tft2.drawBitmap(70, 120, LAMBDA, 100, 100, ILI9341_ORANGE);
delay(1000);
Serial.println("color tft1");
tft1.fillScreen(ILI9341_PURPLE);
delay(500);
Serial.println("color tft2");
tft2.fillScreen(ILI9341_PURPLE);
delay(500);
Serial.println("color tft1");
tft1.fillScreen(ILI9341_CYAN);
delay(500);
Serial.println("color tft2");
tft2.fillScreen(ILI9341_CYAN);
delay(500);
Serial.println("End of setup()");
}
void loop()
{
delay(10);
}