Customizing pin_magic.h for ATmega1284P using an Elegoo 2.8" TFT ILI9341 LCD

Hey guys, I’m working on customizing the header for the libraries that came with the LCD, from what I’ve surmised, it is simpler to use a contiguous port for the data lines. I’ve connect the LCD lines as follows (LCD_RST is tied to RST)

LCD Control Lines:
PA0      PA1      PA2      PA3
LCD_CS    LCD_CD    LCD_WR    LCD_RD
LCD Data Lines:
PC0       PC1       PC2       PC3      PC4       PC5       PC6       PC7
LCD_D0    LCD_D1    LCD_D2    LCD_D3   LCD_D4    LCD_D5    LCD_D6    LCD_D7

The pin_magic.h file is attached.

I use a simplified, direct version using 0xFF, 0 PORTC, PINC and DDRC.

The MCU is in a breadboard in minimal configuration with an Arduino as ISP and a FTDI breakout for sketch uploading, using the latest version of Mighty Core with Optiboot and the standard pinout with default 5v settings.

Currently I’m getting a white screen and the serial output does not identify the LCD controller in its output, only giving a result of 8080. Any input is appreciated, thanks.

pin_magic.h (18.5 KB)

Got it up and running. I removed the brackets as so and changed the byte format.

 #define setWriteDirInline() DDRC = B11111111
 #define setReadDirInline()  DDRC = B00000000

Double checked my wiring but it was correct. All is well. Stay tuned for further misadventures.