• This repository has been archived on 26/Sep/2018
  • Stars
    star
    155
  • Rank 240,864 (Top 5 %)
  • Language
    C++
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Adafruit Libraries changed to works in TFT 2.4 shields with the SPFD5408 controller for Arduino Uno and Mega (Discontinued library)

SPFD5408 Library

Author: Joao Lopes
Versions:
	0.9.0 - Beta 1: First public beta - 18/07/15
	0.9.1 - Beta 2: Now works on Mega boards - 19/07/15
	0.9.2 - Beta 3: Now works no Leornardo too - 29/07/15
	*** Discontinued, please see below

This library is the Adafruit TFT Libraries changed to works in TFT 2.4 shields with the SPFD5408 controller. Tested on Arduino Uno, Leonardo and Mega. See it on action in: https://www.youtube.com/watch?v=Q8WvEjXvAws

It is based in the last version of Adafruit, inclusive with buttons features.

The TFT 2.4 is cheap TFT, that generally is from China, without documentation or libraries for it.

When we try to use the TFT 2.4 with SPFD5408 controller in sketches with Adafruit TFT libraries, several things can happen :

- White Screen
- All screen with noise
- Touch not works or is inverted (coordinate Y)
- The colors are inverted
- And other things

After trying for several days trying the solutions I found on the web, and none works 100%. So I decided to do an library specific to this controller.

I changed the Adafruit libraries for TFT: GFX , TFTLCD and TouchScreen. I join all in this one library, the library SPFD5408, to avoid problems with duplicate libraries and enables also have the original library Adafruit ready for use in other projects with another TFT hardware.

ATTENTION: DISCONTINUED

Sorry, this library is discontinued, due now few chinesse TFT is SPFD5402, so few TFT is works with it. I now use the Nextion Display instead this TFT

Tip: I am now using Nextion display (https://nextion.itead.cc/), with many advantages like: 4 wires only for connection with the microcontroller, graphic editor on PC, etc.

DISCLAIMER:

This Library is NOT provided by AdaFruit and they have not endorsed it. This library is just a lot of modifications in the Adafruit Library, to works in TFT with SPFD5408 controller (cheap shields)

ATTENTION:

Due to variations in Chinese shields with some controller, there is no guarantee that will work for everyone.

I test with success in my www.mcufriend.com TFTs, plugged in Uno, Leonardo and Mega Arduino boards.

THIS LIBRARY IS ONLY FOR SPFD5408 controller.

If the white screen persists, can indicate than your TFT is not SPFD5408. Please access this site, to help you identify the controller and library for this TFT:

http://misc.ws/2015/01/24/lcd-touch-screen-information/

INSTALATION:

To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder to SPFD5408.

Place the SPFD5408 library folder your /libraries/ folder. You may need to create the libraries subfolder if its your first library.

Or more simple, you access the Arduinos’s IDE menu : sketch/add library

Restart the IDE

If you download any code that uses Adafruit Libraries, please verify it:

β€”- Pinout XM XP, must be:

#define YP A1  // must be an analog pin, use "An" notation!
#define XM A2  // must be an analog pin, use "An" notation!
#define YM 7   // can be a digital pin
#define XP 6   // can be a digital pin

(please verify it, if only a blank screen or noise is showed or touch doesnt works)

β€”- readID: comment the original blok:

//  uint16_t identifier = tft.readID();
//
//  if(identifier == 0x9325) {
//    Serial.println(F("Found ILI9325 LCD driver"));
//  } else if(identifier == 0x9328) {
//    Serial.println(F("Found ILI9328 LCD driver"));
//  } else if(identifier == 0x7575) {
//    Serial.println(F("Found HX8347G LCD driver"));
//  } else if(identifier == 0x9341) {
//    Serial.println(F("Found ILI9341 LCD driver"));
//  } else if(identifier == 0x8357) {
//    Serial.println(F("Found HX8357D LCD driver"));
//  } else {
//    Serial.print(F("Unknown LCD driver chip: "));
//    Serial.println(identifier, HEX);
//    Serial.println(F("If using the Adafruit 2.8\" TFT Arduino shield, the line:"));
//    Serial.println(F("  #define USE_ADAFRUIT_SHIELD_PINOUT"));
//    Serial.println(F("should appear in the library header (Adafruit_TFT.h)."));
//    Serial.println(F("If using the breakout board, it should NOT be #defined!"));
//    Serial.println(F("Also if using the breakout, double-check that all wiring"));
//    Serial.println(F("matches the tutorial."));
//    return;
//  }
//
//  tft.begin(identifier);

β€”- tft.begin: insert after block commented

tft.begin(0x9341); // SDFP5408

<<<<<<< HEAD β€”- Calibrate before run

β€”- tft.rotation: Need for Mega (else screen is showed mirrored)

tft.setRotation(0); // Need for the Mega, please changed for your choice of rotation initial

β€”- Calibrate before run

origin/master

Exists one sketch written for my, to help in calibration of touch
See it in examples folder
Run it and change this parameters:

#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940

(please verify it if the point of touch is not accurate)

β€”β€”β€”β€”β€”β€”β€”β€”

All changes in Adafruit code is marked with:

// ### SPFD5408 change -- Begin

(change)

// ### SPFD5408 change -- End

This is useful if You see the points that be workeds for any touble

β€”β€”β€”β€”β€”β€”

Examples:

adafruit_originals

	From Adafruit Libraries β€” Not works with the SPFD5408


spfd5408_calibrate

	Help the calibration of touch (resistive)

spfd5408_tftpaint

	example of Adafruit changed to work with the SPFD5408

spfd5408_graphictest

	example of Adafruit changed to work with the SPFD5408

spfd5408_rotationtest

	example of Adafruit changed to work with the SPFD5408

Acknowledgements:

- First to Adafruit for excellent library
- To Andrologiciels blog (https://andrologiciels.wordpress.com/arduino/lcd/tft-display/)
	As the first library could to show the graphics (before only blank or noise screen)
	and be the basis for any adjustments that I made in this library
- To Berni_ (https://forum.arduino.cc/index.php?topic=223769.15)
	By the logic of TFT calibration for be the basis for my program

More Repositories

1

RemoteDebug

Library for Arduino to debug projects over WiFi, with web app or telnet, with print commands like Serial Monitor
C++
615
star
2

SerialDebug

Improved serial debug and simple software debugger to Arduino. With debug levels, see/change global variables, call functions, watches, and more.
C++
244
star
3

Esp-Mobile-Apps-Esp32

Esp-Idf-Mobile-Apps is a set of examples apps to start making Esp32 BLE devices connected to mobile applications (Android and iOS)
C++
73
star
4

Esp-Mobile-Apps-iOS

Esp-Mobile-Apps is a set of examples apps to start making Esp32 BLE devices connected to mobile applications (Android and iOS)
Swift
46
star
5

Esp-Mobile-Apps-Android

Esp-Mobile-Apps is a set of examples apps to start making Esp32 BLE devices connected to mobile applications (Android and iOS)
Kotlin
42
star
6

ESP32MotorControl

Motor control using ESP32 MCPWM
C++
40
star
7

RemoteDebugApp

Local copy of RemoteDebugApp to use if internet is offline
CSS
27
star
8

RemoteDebugger

RemoteDebug library addon: An Simple Software Debugger, based on SerialDebug
C++
22
star
9

SerialDebugConverter

Converter for SerialDebug. Convert standard Serial.prints to SerialDebug library
Java
13
star
10

ESPlorer_v1

Advanced Robot with camera and web control, for 4WD, 2WD or Tank
JavaScript
13
star
11

ESP8266-Arduino-PWM-SDK-Sample

Sample to avoid PWM flickerings using the PWM of SDK improved
C
11
star
12

RemoteDebugConverter

Converter for RemoteDebug. Convert standard Serial.prints to RemoteDebug library
Java
10
star
13

Esp-Idf-Improved-Logging

Improved logging to esp-idf projects
C
7
star
14

Esp-Idf-Monitor-Simple-Profiler

Give a simple profiler to esp-idf serial monitor
Python
3
star
15

ArduinoUtil

Utilitary library for Arduino and ESP8266 (NodeMCU)
C++
3
star
16

RemoteDebuggerConverter

An converter to add debugger codes (RemoteDebugger) to a Arduino projects that uses RemoteDebug library
Java
2
star