Skip to content

Commit

Permalink
Fix Working with LCD(A)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcla committed Apr 26, 2021
1 parent fde2278 commit 6527639
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
17 changes: 17 additions & 0 deletions ILI9486_t3n.cpp
Expand Up @@ -1917,6 +1917,22 @@ void ILI9486_t3n::writeRectNBPP(int16_t x, int16_t y, int16_t w, int16_t h, uin
}

static const uint8_t init_commands[] = {
#ifdef IS_VER_A
2, 0x3A, 0x55, // use 16 bits per pixel color
2, 0x36, 0x48, // MX, BGR == rotation 0
16, 0xE0, 0x0F, 0x1F, 0x1C, 0x0C, 0x0F, 0x08, 0x48, 0x98,
0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00,
// NGAMCTRL(Negative Gamma Control)
16, 0xE1, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75,
0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00,
// Digital Gamma Control 1
16, 0xE2, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75,
0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00,
1, 0x11, // Sleep OUT
0x80, 150, // wait some time
1, 0x29, // Display ON
0 // end marker
#else
2, 0x3A, 0x55, // Interface Pixel Format (16Bit)
3, 0xB1, 0x80, 0x10, // FrameRate Control
2, 0xB4, 0x02, // Display Z Inversion
Expand All @@ -1928,6 +1944,7 @@ static const uint8_t init_commands[] = {
3, 0xB6, 0x00, 0x00, // Display Function Control
2, 0x36, 0x08, // Memory Access Control
0
#endif
};

FLASHMEM void ILI9486_t3n::begin(uint32_t spi_clock, uint32_t spi_clock_read)
Expand Down
10 changes: 9 additions & 1 deletion ILI9486_t3n.h
Expand Up @@ -37,6 +37,9 @@

#include "ILI9486_fonts.h"

// Uncomment to use LCD(A), by default it works with LCD(C)
//#define IS_VER_A

#define ILI9486_TFTWIDTH 320
#define ILI9486_TFTHEIGHT 480

Expand Down Expand Up @@ -173,7 +176,12 @@ typedef struct {
#ifdef __cplusplus
// At all other speeds, _pspi->beginTransaction() will use the fastest available clock

#define ILI9486_SPICLOCK 80e6 //valid speeds are (120mhz, 80mhz, 60mhz, 48, 40, 34.29, 30mhz, 26.67, 24mhz
#ifdef IS_VER_A
#define ILI9486_SPICLOCK 30e6 //valid speeds are (120mhz, 80mhz, 60mhz, 48, 40, 34.29, 30mhz, 26.67, 24mhz
#else
#define ILI9486_SPICLOCK 80e6 //valid speeds are (120mhz, 80mhz, 60mhz, 48, 40, 34.29, 30mhz, 26.67, 24mhz
#endif

#define ILI9486_SPICLOCK_READ 2000000


Expand Down

0 comments on commit 6527639

Please sign in to comment.