I have a color LCD breakout board from Adafruit and I am trying to get it working on a Teensy2++. It works fine on a Mega and I moved the 8 data pins to the interior pins on the Teensy2++ which should keep the port the same. It has power but nothing is appearing on the screen. I put the control lines that were on A0-A3 on the Mega onto the Teensy2++'s A0-A3 lines.
I started looking at how the driver code accesses the control lines. An example:
void TFTLCD::writeData(uint16_t data) {
volatile uint8_t *wrportreg = portOutputRegister(wrport);
*portOutputRegister(csport) &= ~cspin;
//digitalWrite(_cs, LOW);
*portOutputRegister(cdport) |= cdpin;
//digitalWrite(_cd, HIGH);
*portOutputRegister(rdport) |= rdpin;
//digitalWrite(_rd, HIGH);
*wrportreg |= wrpin;
//digitalWrite(_wr, HIGH);
setWriteDir();
write8(data >> 8);
*wrportreg &= ~wrpin;
//digitalWrite(_wr, LOW);
*wrportreg |= wrpin;
//digitalWrite(_wr, HIGH);
write8(data);
*wrportreg &= ~wrpin;
//digitalWrite(_wr, LOW);
*wrportreg |= wrpin;
//digitalWrite(_wr, HIGH);
*portOutputRegister(csport) |= cspin;
//digitalWrite(_cs, HIGH);
}
The commented out code is a good way to figure out what the code means but I don't think I have seen portOutputRegister() before and haven't been able to find it when I poke around in various source files. I'm using Xcode 3.2.6 as my editor for the driver file so I get a nice popup list of defined symbols (maybe not as nice as if they were alphabetized).
So 2 questions: where is portOutputRegister defined and more importantly is there a better technique for finding a symbol that is defined in some included file rather than just opening and examining each included file? Seems like this general problem must have been solved with some neat tool that I don't know about. Maybe a 3rd question: what should I have read or googled to get the answer to the 2nd question?