This uses the "breakout" pin pattern. It's not an MCUfriend display, but it uses the same pinout.
I need to change the pin assignments inside that library, because none of the existing definitions are what I am using-the issue is that instead of defining the pins as individual pins, they're defined as macros that I am not entirely sure how to interpret. I have an idea of how they work, but not enough to know what to change.
For example, in the "mega w/breakout board" section of pin_magic.h:
#else // Mega w/Breakout board
#define write8inline(d) { PORTA = (d); WR_STROBE; }
#define read8inline(result) { \
RD_ACTIVE; \
DELAY7; \
result = PINA; \
RD_IDLE; }
#define setWriteDirInline() DDRA = 0xff
#define setReadDirInline() DDRA = 0
#endif
// All of the functions are inlined on the Arduino Mega. When using the
// breakout board, the macro versions aren't appreciably larger than the
// function equivalents, and they're super simple and fast. When using
// the shield, the macros become pretty complicated...but this board has
// so much code space, the macros are used anyway. If you need to free
// up program space, some macros can be removed, at a minor cost in speed.
#define write8 write8inline
#define read8 read8inline
#define setWriteDir setWriteDirInline
#define setReadDir setReadDirInline
#define writeRegister8 writeRegister8inline
#define writeRegister16 writeRegister16inline
#define writeRegisterPair writeRegisterPairInline
You can see that it's just using the 8 bits of PORTA such that PA0 = LCD bit 0, PA1 = LCD bit 1, etc. I need to understand how to change that such that:
PC5 = LCD bit 2, PC6 = LCD bit 3, PC7 = bit 4, PG2 = bit 5, PA7= bit 6, PA6 = bit 7
Looking at the other entries, it seems I would do this:
#else // Uno w/Breakout board
#define write8inline(d) { \
PORTC = (PORTC & B00000111) | ((d) & B11111000); \
PORTG = (PORTG & B00100000) | ((d) & B11011111); \
PORTA = (PORTA & B11111100) | ((d) & B00000011); \
WR_STROBE; }
#define read8inline(result) { \
RD_ACTIVE; \
DELAY7; \
result = (PINC & B11111000) |(PING & B11011111) | (PINA & B00000011); \
RD_IDLE; }
#define setWriteDirInline() { DDRC |= B11111000; DDRG |= B11011111; DDRA |= B00000011; }
#define setReadDirInline() { DDRC &= ~B11111100; DDRG &= ~B11011111; DDRA &= ~B00000011; }
#endif
// As part of the inline control, macros reference other macros...if any
// of these are left undefined, an equivalent function version (non-inline)
// is declared later. The Uno has a moderate amount of program space, so
// only write8() is inlined -- that one provides the most performance
// benefit, but unfortunately also generates the most bloat. This is
// why only certain cases are inlined for each board.
But, since I'm not really sure what that does, who knows if that's correct or not. It's also looking at the "Uno" section of the code, because that made more sense to try to edit than the Mega section, because the Uno code is already split across multiple ports.