ZTiK.nl
Well-known member
Hello again everybody,
I have been trying to connect my Teensy 3.0 with a 2.8" TFT touchscreen from Adafruit.
The easiest to work out was how to connect the backlight, power and ground (using a separate 3.3v supply).
After that I have been able to connect the touch-sensitive part of the screen as well, and it reads x+, x-, Y+ and y- fairly well using Touch-Screen-Library (I still have to some more calibration though).
I have been running into problems when I wanted to actually display something on the screen using TFT LCD library (and the GFX library)...
I have made a modification to the original library, so that Teensy 3 will be identified as an Arduino Uno.
I chose this id because in a post by Mr. Stoffregen I read:
'Teensy 3.0 has some AVR emulation code for PORTB, PORTD and PORTC to map bit operations to direct manipulation of the Freescale port registers. The register to pin mapping attempts to emulate Arduino Uno.'
So I changed line 50 in \libraries\TFTLCD\pin_magic.h from:
to:
Unfortunately (for me) this is not a full fix, I am still getting errors but now of a different kind.
The following is just a small portion of it, there is about 150 lines of the same errorcode.
Now this is where I am in waaaay over my head, and I'm afraid that I don't know how to fix this.
I know a bit about coding/programming, but this goes a few levels deeper than what I am used to.
For what it's worth, I am not expecting anybody to jump in and do everything for me, but I am looking for any pointers/advice on how to tackle this problem.
Also, has anybody actually tried to connect these before on a T3?
Additional information:
when I first started with this screen a few days ago, I opened a topic about this issue at Adafruit forum:
http://forums.adafruit.com/viewtopic.php?f=47&t=36173&p=178816#p178816
The connections for the touchscreen to the teensy I followed from pin_magic.h but I doubt wrong wiring will solve a coding problem:
I have been trying to connect my Teensy 3.0 with a 2.8" TFT touchscreen from Adafruit.
The easiest to work out was how to connect the backlight, power and ground (using a separate 3.3v supply).
After that I have been able to connect the touch-sensitive part of the screen as well, and it reads x+, x-, Y+ and y- fairly well using Touch-Screen-Library (I still have to some more calibration though).
I have been running into problems when I wanted to actually display something on the screen using TFT LCD library (and the GFX library)...
Code:
Board type unsupported / not recognized
I have made a modification to the original library, so that Teensy 3 will be identified as an Arduino Uno.
I chose this id because in a post by Mr. Stoffregen I read:
'Teensy 3.0 has some AVR emulation code for PORTB, PORTD and PORTC to map bit operations to direct manipulation of the Freescale port registers. The register to pin mapping attempts to emulate Arduino Uno.'
So I changed line 50 in \libraries\TFTLCD\pin_magic.h from:
Code:
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega328__) || defined(__AVR_ATmega8__)
Code:
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega328__) || defined(__AVR_ATmega8__) || defined(__MK20DX128__)
Unfortunately (for me) this is not a full fix, I am still getting errors but now of a different kind.
The following is just a small portion of it, there is about 150 lines of the same errorcode.
Code:
D:\arduino-1.0.3-beta\libraries\TFTLCD\Adafruit_TFTLCD.cpp: In member function 'void Adafruit_TFTLCD::reset()':
D:\arduino-1.0.3-beta\libraries\TFTLCD\Adafruit_TFTLCD.cpp:321:3: error: no match for 'operator&' in 'PORTD & 3'
D:\arduino-1.0.3-beta\libraries\TFTLCD\Adafruit_TFTLCD.cpp:321:3: error: no match for 'operator&' in 'PORTB & 252'
D:\arduino-1.0.3-beta\libraries\TFTLCD\Adafruit_TFTLCD.cpp: In member function 'void Adafruit_TFTLCD::flood(uint16_t, uint32_t)':
D:\arduino-1.0.3-beta\libraries\TFTLCD\Adafruit_TFTLCD.cpp:418:25: error: no match for 'operator&' in 'PORTD & 3'
D:\arduino-1.0.3-beta\libraries\TFTLCD\Adafruit_TFTLCD.cpp:418:25: error: no match for 'operator&' in 'PORTB & 252'
Now this is where I am in waaaay over my head, and I'm afraid that I don't know how to fix this.
I know a bit about coding/programming, but this goes a few levels deeper than what I am used to.
For what it's worth, I am not expecting anybody to jump in and do everything for me, but I am looking for any pointers/advice on how to tackle this problem.
Also, has anybody actually tried to connect these before on a T3?
Additional information:
when I first started with this screen a few days ago, I opened a topic about this issue at Adafruit forum:
http://forums.adafruit.com/viewtopic.php?f=47&t=36173&p=178816#p178816
The connections for the touchscreen to the teensy I followed from pin_magic.h but I doubt wrong wiring will solve a coding problem:
Code:
// LCD Data Bit : 7 6 5 4 3 2 1 0
// Uno dig. pin : 7 6 5 4 3 2 9 8
Code:
RD- -> Analog5
WR- -> Analog6
CD -> Analog7
CS -> Analog8
RST -> Analog9
Y- -> Digital14 (which doubles as Analog0)
X- -> Analog1
X+ -> Digital17 (which doubles as Analog3)
Y+ -> Analog2