From e09942e6bbd4fad4fc19ee9caa32bbaeea56ecfe Mon Sep 17 00:00:00 2001 From: prenticedavid Date: Sat, 16 Apr 2016 20:23:36 +0100 Subject: [PATCH] add mega1280 --- MCUFRIEND_kbv.cpp | 4 +++- TFT_HX8357GLUE.h | 4 ++-- mcufriend_shield.h | 5 +++-- mcufriend_special.h | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/MCUFRIEND_kbv.cpp b/MCUFRIEND_kbv.cpp index 62a3aae..dab39d0 100644 --- a/MCUFRIEND_kbv.cpp +++ b/MCUFRIEND_kbv.cpp @@ -32,7 +32,7 @@ #define INVERT_RGB (1<<11) #define REV_SCREEN (1<<12) -#if (defined(__AVR_ATmega2560__) || defined(__SAM3X8E__))\ +#if (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) || defined(__SAM3X8E__))\ && (defined(USE_MEGA_16BIT_SHIELD) || defined(USE_DUE_16BIT_SHIELD)) #define USING_16BIT_BUS 1 #else @@ -1103,6 +1103,7 @@ void MCUFRIEND_kbv::begin(uint16_t ID) case 0x4747: //HX8347-D _lcd_capable = REV_SCREEN | MIPI_DCS_REV1 | MV_AXIS | INVERT_SS; goto common_8347DGI; + case 0x7575: //HX8347-G case 0x9595: //HX8347-I _lcd_capable = REV_SCREEN | MIPI_DCS_REV1 | MV_AXIS; common_8347DGI: @@ -1587,6 +1588,7 @@ void MCUFRIEND_kbv::begin(uint16_t ID) 0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02, //Power Control A [39 2C 00 34 02] 0xF7, 1, 0x20, //Pump Ratio [10] 0xEA, 2, 0x00, 0x00, //Driver Timing B [66 00] + 0xB0, 1, 0x00, //RGB Signal [00] 0xB1, 2, 0x00, 0x1B, //Frame Control [00 1B] // 0xB6, 2, 0x0A, 0xA2, 0x27, //Display Function [0A 82 27 XX] .kbv SS=1 0xB4, 1, 0x00, //Inversion Control [02] .kbv NLA=1, NLB=1, NLC=1 diff --git a/TFT_HX8357GLUE.h b/TFT_HX8357GLUE.h index b1ce865..c2f9562 100644 --- a/TFT_HX8357GLUE.h +++ b/TFT_HX8357GLUE.h @@ -9,7 +9,7 @@ #define HX8357_YELLOW 0xFFE0 #define HX8357_WHITE 0xFFFF -#include // Core graphics library +//#include // Core graphics library #include // Hardware-specific library #include @@ -63,7 +63,7 @@ class TFT_HX8357GLUE : public MCUFRIEND_kbv MCUFRIEND_kbv::reset(); _ID = MCUFRIEND_kbv::readID(); if (_ID == 0x00D3 || _ID == 0xD3D3) - _ID = 0x9481; + _ID = 0x9486; MCUFRIEND_kbv::begin(_ID); MCUFRIEND_kbv::setRotation(1); _first = true; diff --git a/mcufriend_shield.h b/mcufriend_shield.h index 3ddcb25..d664ff1 100644 --- a/mcufriend_shield.h +++ b/mcufriend_shield.h @@ -35,7 +35,7 @@ #define PIN_HIGH(p, b) (p) |= (1<<(b)) #define PIN_OUTPUT(p, b) *(&p-1) |= (1<<(b)) -#elif defined(__AVR_ATmega2560__) //regular UNO shield on MEGA2560 +#elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) //regular UNO shield on MEGA2560 #define RD_PORT PORTF #define RD_PIN 0 #define WR_PORT PORTF @@ -171,7 +171,8 @@ PMC->PMC_PCER0 = (1 << ID_PIOB)|(1 << ID_PIOC);\ PIOB->PIO_ODR = BMASK; PIOC->PIO_ODR = CMASK;\ } -#define write8(x) { write_8(x); WR_ACTIVE; WR_STROBE; WR_IDLE; } +#define write8(x) { write_8(x); WR_ACTIVE; WR_STROBE; } +//#define write8(x) { write_8(x); WR_ACTIVE; WR_STROBE; WR_IDLE; } #define write16(x) { uint8_t h = (x)>>8, l = x; write8(h); write8(l); } #define READ_8(dst) { RD_STROBE; RD_ACTIVE; dst = read_8(); RD_IDLE; RD_IDLE; } #define READ_16(dst) { uint8_t hi; READ_8(hi); READ_8(dst); dst |= (hi << 8); } diff --git a/mcufriend_special.h b/mcufriend_special.h index 57d095a..3319c87 100644 --- a/mcufriend_special.h +++ b/mcufriend_special.h @@ -4,11 +4,11 @@ //#define USE_SSD1289_SHIELD_MEGA //#define USE_SSD1289_SHIELD_DUE //#define USE_MEGA_8BIT_PROTOSHIELD -//#define USE_MEGA_16BIT_SHIELD //RD on PL6 (D43) +#define USE_MEGA_16BIT_SHIELD //RD on PL6 (D43) //#define USE_BLD_BST_MEGA32U4 //#define USE_BLD_BST_MEGA2560 //#define USE_DUE_8BIT_PROTOSHIELD -#define USE_DUE_16BIT_SHIELD //RD on PA15 (D24) +//#define USE_DUE_16BIT_SHIELD //RD on PA15 (D24) #if 0 #elif defined(__AVR_ATmega328P__) && defined(USE_SSD1289_SHIELD_UNO) //on UNO