Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TFT_eSPI
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
TFT_eSPI
Commits
28545357
Commit
28545357
authored
Feb 08, 2018
by
Bodmer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for ESP32 based M5Stack
parent
fe36cbda
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
4 deletions
+133
-4
TFT_Drivers/ILI9341_Init.h
TFT_Drivers/ILI9341_Init.h
+12
-1
TFT_Drivers/ILI9341_Rotation.h
TFT_Drivers/ILI9341_Rotation.h
+33
-1
User_Setup_Select.h
User_Setup_Select.h
+1
-0
User_Setups/Setup12_M5Stack.h
User_Setups/Setup12_M5Stack.h
+85
-0
library.properties
library.properties
+2
-2
No files found.
TFT_Drivers/ILI9341_Init.h
View file @
28545357
...
...
@@ -55,7 +55,11 @@
writedata
(
0x86
);
//--
writecommand
(
ILI9341_MADCTL
);
// Memory Access Control
writedata
(
0x48
);
#ifdef M5STACK
writedata
(
0xA8
);
// Rotation 0 (portrait mode)
#else
writedata
(
0x48
);
// Rotation 0 (portrait mode)
#endif
writecommand
(
ILI9341_PIXFMT
);
writedata
(
0x55
);
...
...
@@ -116,4 +120,11 @@
spi_begin
();
writecommand
(
ILI9341_DISPON
);
//Display on
#ifdef M5STACK
// Turn on the back-light LED
digitalWrite
(
TFT_BL
,
HIGH
);
pinMode
(
TFT_BL
,
OUTPUT
);
#endif
}
\ No newline at end of file
TFT_Drivers/ILI9341_Rotation.h
View file @
28545357
...
...
@@ -6,43 +6,75 @@
writecommand
(
TFT_MADCTL
);
switch
(
rotation
)
{
case
0
:
#ifdef M5STACK
writedata
(
TFT_MAD_MY
|
TFT_MAD_MV
|
TFT_MAD_BGR
);
#else
writedata
(
TFT_MAD_MX
|
TFT_MAD_BGR
);
#endif
_width
=
_width_orig
;
_height
=
_height_orig
;
break
;
case
1
:
#ifdef M5STACK
writedata
(
TFT_MAD_BGR
);
#else
writedata
(
TFT_MAD_MV
|
TFT_MAD_BGR
);
#endif
_width
=
_height_orig
;
_height
=
_width_orig
;
break
;
case
2
:
#ifdef M5STACK
writedata
(
TFT_MAD_MV
|
TFT_MAD_MX
|
TFT_MAD_BGR
);
#else
writedata
(
TFT_MAD_MY
|
TFT_MAD_BGR
);
#endif
_width
=
_width_orig
;
_height
=
_height_orig
;
break
;
case
3
:
#ifdef M5STACK
writedata
(
TFT_MAD_MX
|
TFT_MAD_MY
|
TFT_MAD_BGR
);
#else
writedata
(
TFT_MAD_MX
|
TFT_MAD_MY
|
TFT_MAD_MV
|
TFT_MAD_BGR
);
#endif
_width
=
_height_orig
;
_height
=
_width_orig
;
break
;
// These next rotations are for bott
u
m up BMP drawing
// These next rotations are for bott
o
m up BMP drawing
case
4
:
#ifdef M5STACK
writedata
(
TFT_MAD_MV
|
TFT_MAD_MX
|
TFT_MAD_BGR
);
#else
writedata
(
TFT_MAD_MX
|
TFT_MAD_MY
|
TFT_MAD_BGR
);
#endif
_width
=
_width_orig
;
_height
=
_height_orig
;
break
;
case
5
:
#ifdef M5STACK
writedata
(
TFT_MAD_MV
|
TFT_MAD_BGR
);
#else
writedata
(
TFT_MAD_MV
|
TFT_MAD_MX
|
TFT_MAD_BGR
);
#endif
_width
=
_height_orig
;
_height
=
_width_orig
;
break
;
case
6
:
#ifdef M5STACK
writedata
(
TFT_MAD_MX
|
TFT_MAD_MY
|
TFT_MAD_MV
|
TFT_MAD_BGR
);
#else
writedata
(
TFT_MAD_BGR
);
#endif
_width
=
_width_orig
;
_height
=
_height_orig
;
break
;
case
7
:
#ifdef M5STACK
writedata
(
TFT_MAD_MY
|
TFT_MAD_BGR
);
#else
writedata
(
TFT_MAD_MY
|
TFT_MAD_MV
|
TFT_MAD_BGR
);
#endif
_width
=
_height_orig
;
_height
=
_width_orig
;
break
;
...
...
User_Setup_Select.h
View file @
28545357
...
...
@@ -32,6 +32,7 @@
//#include <User_Setups/Setup9_ST7735_Overlap.h> // Setup file configured for my ST7735
//#include <User_Setups/Setup10_RPi_touch_ILI9486.h> // Setup file configured for my stock RPi TFT with touch
//#include <User_Setups/Setup11_RPi_touch_ILI9486.h> // Setup file configured for my stock RPi TFT with touch
//#include <User_Setups/Setup12_M5Stack.h> // Setup file for the ESP32 based M5Stack
//#include <User_Setups/SetupX_Template.h> // Setup file template for copying/editting
...
...
User_Setups/Setup12_M5Stack.h
0 → 100644
View file @
28545357
// USER DEFINED SETTINGS
//
// The User_Setup header that will be called up is defined in User_Setup_Select.h
//
// Set driver type, fonts to be loaded, pins used and SPI control method etc
//
// If this file is edited correctly then all the library example sketches should
// run without the need to make any more changes for a particular hardware setup!
// ##################################################################################
//
// Section 0. Call up the right driver file and any options for it
//
// ##################################################################################
#define ILI9341_DRIVER
#define M5STACK
// ##################################################################################
//
// Section 1. Define the pins that are used to interface with the display here
//
// ##################################################################################
// M5Stack
#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 14 // Chip select control pin
#define TFT_DC 27 // Data Command control pin
#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
#define TFT_BL 32 // LED back-light
// ##################################################################################
//
// Section 2. Define the way the DC and/or CS lines are driven
//
// ##################################################################################
// Not used
// ##################################################################################
//
// Section 3. Define the fonts that are to be used here
//
// ##################################################################################
// Comment out the #defines below with // to stop that font being loaded
// The ESP8366 had plenty of memory so commenting out fonts is not normally necessary
// If all fonts are loaded the extra FLASH space required is about 17Kbytes...
// To save FLASH space only enable the fonts you need!
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
// ##################################################################################
//
// Section 4. Not used
//
// ##################################################################################
// ##################################################################################
//
// Section 5. Other options
//
// ##################################################################################
// Define the SPI clock frequency
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
// #define SPI_FREQUENCY 1000000
// #define SPI_FREQUENCY 5000000
// #define SPI_FREQUENCY 10000000
// #define SPI_FREQUENCY 20000000
// #define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
#define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
// #define SPI_FREQUENCY 80000000
library.properties
View file @
28545357
4
name
=
TFT_eSPI
version
=
0.18.1
3
name
=
TFT_eSPI
version
=
0.18.1
4
author
=
Bodmer
maintainer
=
Bodmer
sentence
=
A fast TFT library for ESP8266 processors and the Arduino IDE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment