david_prentice:
I generally call your display a Blue 2.8" Mcufriend ShieldLife would be easier (for me) if you test the shield with MCUFRIEND_kbv
Add this block to mcufriend_shield.h
Then the library should accept your "MEGACORE" as a standard target.
#elif defined(__AVR_ATmega2561__) || defined(__AVR_ATmega1281__) //regular UNO shield on MEGACORE 2561
#define RD_PORT PORTG
#define RD_PIN 1
#define WR_PORT PORTC
#define WR_PIN 0
#define CD_PORT PORTC
#define CD_PIN 1
#define CS_PORT PORTC
#define CS_PIN 2
#define RESET_PORT PORTC
#define RESET_PIN 3
#define AMASK 0xF0
#define CMASK 0xE0
#define GMASK 0x04
#define write_8(x) { PORTA &= ~AMASK; PORTC &= ~CMASK; PORTG &= ~GMASK;
PORTA |= (((x) & (1<<0)) << 5);
PORTA |= (((x) & (1<<1)) << 3);
PORTC |= (((x) & (7<<2)) << 3);
PORTG |= (((x) & (1<<5)) >> 3);
PORTA |= (((x) & (1<<6)) << 1);
PORTA |= (((x) & (1<<7)) >> 1);
}
#define read_8() ( ((PINA & (1<<5)) >> 5)
| ((PINA & (1<<4)) >> 3)
| ((PINC & (7<<5)) >> 3)
| ((PING & (1<<2)) << 3)
| ((PINA & (1<<7)) >> 1)
| ((PINA & (1<<6)) << 1)
)
#define setWriteDir() { DDRA |= AMASK; DDRC |= CMASK; DDRG |= GMASK; }
#define setReadDir() { DDRA &= ~AMASK; DDRC &= ~CMASK; DDRG &= ~GMASK; }
#define write8(x) { write_8(x); WR_STROBE; }
#define write16(x) { uint8_t h = (x)>>8, l = x; write8(h); write8(l); }
#define READ_8(dst) { RD_STROBE; dst = read_8(); RD_IDLE; }
#define READ_16(dst) { uint8_t hi; READ_8(hi); READ_8(dst); dst |= (hi << 8); }
#define PIN_LOW(p, b) (p) &= ~(1<<(b))
#define PIN_HIGH(p, b) (p) |= (1<<(b))
#define PIN_OUTPUT(p, b) *(&p-1) |= (1<<(b))
I will do a version for your pin_macros.h when you have tested it. As you can see. It is very fiddly when you have to shift random bits around. It is easier for you to test it than me. David.
david ,,,i'm use my own schematic for mega128 i'm use portA for 8bit data and portB for another,i'm use HX8357 with uno & adafruit TFTLCD all working well....but with my mega128 i'm realy confuse where must be change,,,,i need referency thanks a lot....