Using UNO Rev3 and opensmart tft 2.8" tuchscreen. I know shields are designed to be plugged into the header with the defaults pinout, but I want to drive a rgb led with the left over pins that the shield does not use. To change the state need PWM pins and there are only 2 (DIO03 and DIO05) that the shield is not using. Figured I could edit mcufriend_special.h to turn off DIO06 and turn on DIO12. No plans to use the SD card. I did but only get white screen.
Does the mask defines below need to be modified?
#elif defined(__AVR_ATmega328P__) && defined(USE_OPENSMART_SHIELD_PINOUT_UNO)
/*
PORTB 0b PORTD 0b
XTAL1 - PB7 - 0 D07 - PD7 - 1
XTAL2 - PB6 - 0 D06 - PD6 - 1 move to D12 - PB4
D13 - PB5 - 1 D05 - PD5 - 0
D12 - PB4 - 0 D04 - PD4 - 1
D11 - PB3 - 1 D03 - PD3 - 0
D10 - PB2 - 1 D02 - PD2 - 0
D09 - PB1 - 1 D01 - PD1 - 0
D08 - PB0 - 1 D00 - PD0 - 0
//change TFT D6 from D06 to D12 to free up PWM for rgb LED
XTAL1 - PB7 - 0 D07 - PD7 - 1
XTAL2 - PB6 - 0 D06 - PD6 - 0 move to D12 - PB4
D13 - PB5 - 1 D05 - PD5 - 0
D12 - PB4 - 1 D04 - PD4 - 1
D11 - PB3 - 1 D03 - PD3 - 0
D10 - PB2 - 1 D02 - PD2 - 0
D09 - PB1 - 1 D01 - PD1 - 0
D08 - PB0 - 1 D00 - PD0 - 0
#define BMASK 0x2F // B00111111
#define DMASK 0xD0 // B10010000
*/
#define RD_PORT PORTC
#define RD_PIN 0
#define WR_PORT PORTC
#define WR_PIN 1
#define CD_PORT PORTC
#define CD_PIN 2
#define CS_PORT PORTC
#define CS_PIN 3
#define RESET_PORT PORTC
#define RESET_PIN 1 // n/a. so mimic WR_PIN
//#define BMASK B00101111 //PORTB - 0b00101111 = 0x2F
//#define DMASK B11010000 //PORTD - 0b11010000 = 0xD0
#define BMASK B00111111 //0x3F
#define DMASK B10010000 //0x90
#define write_8(x) { \
PORTD = (PORTD & ~DMASK) | ((x) & DMASK); \
PORTB = (PORTB & ~BMASK) | ((x) & BMASK);} // STROBEs are defined later
#define read_8() ((PIND & DMASK) | (PINB & BMASK))
#define setWriteDir() { DDRD |= DMASK; DDRB |= BMASK; }
#define setReadDir() { DDRD &= ~DMASK; DDRB &= ~BMASK; }
#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))