I've purchased a 3.5" TFT 320x480 + Touchscreen Breakout Board w/MicroSD Socket - HXD8357D
PRODUCT ID: 2050 and I'm trying to compile the graphicstest example in Adafruit_HX8357\examples\graphicstest.
for a Teensy3.1.
I'm using arduino 1.6.5 and Teensyduino 1.24
There seems to be no definition of "RwReg" in the include file Adafruit_HX8357.h, as shown by the error message shown below--
In file included from HX8357graphicstest.ino:19:0:
C:\Users\David\Documents\Arduino\libraries\Adafruit_HX8357/Adafruit_HX8357.h:167:14: error: 'RwReg' does not name a type
volatile RwReg *mosiport, *clkport, *dcport, *rsport, *csport;
Where is RwReg supposed to be defined, and what type should it be?
The graphicstest program begins with
#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_HX8357.h"
Thank you...
Adafruit_HX8357 library compile error (Teensy3.1)
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- poynting
- Posts: 5
- Joined: Sun Aug 16, 2015 2:38 am
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit_HX8357 library compile error (Teensy3.1)
That library needs to be modified to work with Teensy. I just uploaded a new version to github. Grab a copy of that and let me know if it works for you.
https://github.com/adafruit/Adafruit_HX8357_Library
https://github.com/adafruit/Adafruit_HX8357_Library
- poynting
- Posts: 5
- Joined: Sun Aug 16, 2015 2:38 am
Re: Adafruit_HX8357 library compile error (Teensy3.1)
Thank you. The example compiles and runs--as long as I choose software SPI.
If I try hardware SPI, the call to tft.begin(HX8357D) does not return.
I tried adding a member function to HX8357 class that called SPI.setMOSI(11),
SPI.setMISO(12), and SPI.setSCK(13), to set those pin numbers, and calling that before any
other calls into the HX8357 class, but that made no difference. Is there a better way?
Previously I successfully used hardware SPI with the ILI9341 class and example program
with an Adafruit 2.8" touch LCD.
I'm hoping I can get hardware mode to work with this LCD.
If I try hardware SPI, the call to tft.begin(HX8357D) does not return.
I tried adding a member function to HX8357 class that called SPI.setMOSI(11),
SPI.setMISO(12), and SPI.setSCK(13), to set those pin numbers, and calling that before any
other calls into the HX8357 class, but that made no difference. Is there a better way?
Previously I successfully used hardware SPI with the ILI9341 class and example program
with an Adafruit 2.8" touch LCD.
I'm hoping I can get hardware mode to work with this LCD.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit_HX8357 library compile error (Teensy3.1)
I don't know why hardware SPI wouldn't work. I'll have to see if I can replicate the problem.
- poynting
- Posts: 5
- Joined: Sun Aug 16, 2015 2:38 am
Re: Adafruit_HX8357 library compile error (Teensy3.1)
Here's an additional puzzle. Using Arduino 1.0.6, I used the library TouchScreen along with the ILI9341 (all running on Teensy3.1) to build a touch-screen GUI. When I try to use TouchScreen in Arduino 1.6.5 (Teensyduino 1.24), I get compiler errors--
In file included from C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/wiring.h:33:0,
from C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/wiring_private.h:7,
from C:\arduino-1.6.5\Arduino\hardware\teensy\avr\libraries\TouchScreen\TouchScreen.cpp:7:
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h: In function 'void digitalWriteFast(uint8_t, uint8_t)':
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:887:24: error: 'portSetRegister' was not declared in this scope
*portSetRegister(pin) = digitalPinToBitMask(pin);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:887:51: error: 'digitalPinToBitMask' was not declared in this scope
*portSetRegister(pin) = digitalPinToBitMask(pin);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:889:26: error: 'portClearRegister' was not declared in this scope
*portClearRegister(pin) = digitalPinToBitMask(pin);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:889:53: error: 'digitalPinToBitMask' was not declared in this scope
*portClearRegister(pin) = digitalPinToBitMask(pin);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h: In function 'uint8_t digitalReadFast(uint8_t)':
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:976:32: error: 'portInputRegister' was not declared in this scope
return *portInputRegister(pin);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\libraries\TouchScreen\TouchScreen.cpp: In member function 'TSPoint TouchScreen::getPoint()':
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\libraries\TouchScreen\TouchScreen.cpp:57:41: error: 'digitalPinToPort' was not declared in this scope
uint8_t xp_port = digitalPinToPort(_xp);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\libraries\TouchScreen\TouchScreen.cpp:62:43: error: 'digitalPinToBitMask' was not declared in this scope
uint8_t xp_pin = digitalPinToBitMask(_xp);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\libraries\TouchScreen\TouchScreen.cpp:73:30: error: 'portOutputRegister' was not declared in this scope
*portOutputRegister(yp_port) &= ~yp_pin;
^
Error compiling.
Maybe you can help me fix this, too!
Thank you, again,
Dave
In file included from C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/wiring.h:33:0,
from C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/wiring_private.h:7,
from C:\arduino-1.6.5\Arduino\hardware\teensy\avr\libraries\TouchScreen\TouchScreen.cpp:7:
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h: In function 'void digitalWriteFast(uint8_t, uint8_t)':
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:887:24: error: 'portSetRegister' was not declared in this scope
*portSetRegister(pin) = digitalPinToBitMask(pin);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:887:51: error: 'digitalPinToBitMask' was not declared in this scope
*portSetRegister(pin) = digitalPinToBitMask(pin);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:889:26: error: 'portClearRegister' was not declared in this scope
*portClearRegister(pin) = digitalPinToBitMask(pin);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:889:53: error: 'digitalPinToBitMask' was not declared in this scope
*portClearRegister(pin) = digitalPinToBitMask(pin);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h: In function 'uint8_t digitalReadFast(uint8_t)':
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:976:32: error: 'portInputRegister' was not declared in this scope
return *portInputRegister(pin);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\libraries\TouchScreen\TouchScreen.cpp: In member function 'TSPoint TouchScreen::getPoint()':
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\libraries\TouchScreen\TouchScreen.cpp:57:41: error: 'digitalPinToPort' was not declared in this scope
uint8_t xp_port = digitalPinToPort(_xp);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\libraries\TouchScreen\TouchScreen.cpp:62:43: error: 'digitalPinToBitMask' was not declared in this scope
uint8_t xp_pin = digitalPinToBitMask(_xp);
^
C:\arduino-1.6.5\Arduino\hardware\teensy\avr\libraries\TouchScreen\TouchScreen.cpp:73:30: error: 'portOutputRegister' was not declared in this scope
*portOutputRegister(yp_port) &= ~yp_pin;
^
Error compiling.
Maybe you can help me fix this, too!
Thank you, again,
Dave
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit_HX8357 library compile error (Teensy3.1)
That library also needs to be ported to the Teensy. Once upon a time, I had hacked up a port for the Arduino Due. It needs to be re-done, but meanwhile, see if the attached version works for you.
- Attachments
-
- TouchScreen_Due.zip
- (8.5 KiB) Downloaded 71 times
- tinman123
- Posts: 6
- Joined: Mon Jan 13, 2014 9:12 am
Re: Adafruit_HX8357 library compile error (Teensy3.1)
Hi Rick,
I was wondering if there has been any update on a teensy touchscreen library?
I have bought 25 of the 3.5 TFT screens (id:2050) and Teensy's 3.2 to suit off adafruit for a project.
With the teensy the speed on the screen is quite quick in spi mode.
But I need to get the touch working otherwise I'll need to change TFT screens.
If there is a Port available it would be much appreciated.
Cheers
Rodney
I was wondering if there has been any update on a teensy touchscreen library?
I have bought 25 of the 3.5 TFT screens (id:2050) and Teensy's 3.2 to suit off adafruit for a project.
With the teensy the speed on the screen is quite quick in spi mode.
But I need to get the touch working otherwise I'll need to change TFT screens.
If there is a Port available it would be much appreciated.
Cheers
Rodney
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit_HX8357 library compile error (Teensy3.1)
The Due port should work. Give it a try. I updated the examples to run properly:
- tinman123
- Posts: 6
- Joined: Mon Jan 13, 2014 9:12 am
Re: Adafruit_HX8357 library compile error (Teensy3.1)
Hi Rick,
Thanks for the library. I did try it.
I'm using Arduino 1.6.6 and the teensyduino 1.26.
I am getting this error message still.
Ideas?
Thanks for the library. I did try it.
I'm using Arduino 1.6.6 and the teensyduino 1.26.
I am getting this error message still.
Ideas?
In file included from C:\Arduino\arduino-1.6.6\hardware\teensy\avr\cores\teensy3/wiring.h:33:0,
from C:\Arduino\arduino-1.6.6\hardware\teensy\avr\cores\teensy3/wiring_private.h:7,
from C:\Arduino\arduino-1.6.6\libraries\TouchScreen_Due\TouchScreen_Due.cpp:7:
C:\Arduino\arduino-1.6.6\hardware\teensy\avr\cores\teensy3/core_pins.h: In function 'void digitalWriteFast(uint8_t, uint8_t)':
C:\Arduino\arduino-1.6.6\hardware\teensy\avr\cores\teensy3/core_pins.h:1328:24: error: 'portSetRegister' was not declared in this scope
*portSetRegister(pin) = digitalPinToBitMask(pin);
^
C:\Arduino\arduino-1.6.6\hardware\teensy\avr\cores\teensy3/core_pins.h:1328:51: error: 'digitalPinToBitMask' was not declared in this scope
*portSetRegister(pin) = digitalPinToBitMask(pin);
^
C:\Arduino\arduino-1.6.6\hardware\teensy\avr\cores\teensy3/core_pins.h:1330:26: error: 'portClearRegister' was not declared in this scope
*portClearRegister(pin) = digitalPinToBitMask(pin);
^
C:\Arduino\arduino-1.6.6\hardware\teensy\avr\cores\teensy3/core_pins.h:1330:53: error: 'digitalPinToBitMask' was not declared in this scope
*portClearRegister(pin) = digitalPinToBitMask(pin);
^
C:\Arduino\arduino-1.6.6\hardware\teensy\avr\cores\teensy3/core_pins.h: In function 'uint8_t digitalReadFast(uint8_t)':
C:\Arduino\arduino-1.6.6\hardware\teensy\avr\cores\teensy3/core_pins.h:1432:32: error: 'portInputRegister' was not declared in this scope
return *portInputRegister(pin);
^
exit status 1
Error compiling.
- tinman123
- Posts: 6
- Joined: Mon Jan 13, 2014 9:12 am
Re: Adafruit_HX8357 library compile error (Teensy3.1)
I got it working finally.
I hope this will help somebody. Here is what I used.
I have and adafruit 320 x 480 3.5 inch tft product code 2050 with the HX8357D chip.
With a Teensy 3.2 in SPI mode.
I have Arduino 1.6.6, teensyduino 1.26.
I used the standard adafruit touch library https://github.com/adafruit/Touch-Screen-Library
But added HWGUYS code from here https://forum.pjrc.com/threads/28755-Ne ... #post82671
The code I used is the teensy's breakouttouchpaint but for the ILI9341 tft.
The ILI9341 library works on the HX8357D but the HX8357 library does not.
I hope this saves somebody a weeks worth of searching.
Rod
I hope this will help somebody. Here is what I used.
I have and adafruit 320 x 480 3.5 inch tft product code 2050 with the HX8357D chip.
With a Teensy 3.2 in SPI mode.
I have Arduino 1.6.6, teensyduino 1.26.
I used the standard adafruit touch library https://github.com/adafruit/Touch-Screen-Library
But added HWGUYS code from here https://forum.pjrc.com/threads/28755-Ne ... #post82671
The code I used is the teensy's breakouttouchpaint but for the ILI9341 tft.
The ILI9341 library works on the HX8357D but the HX8357 library does not.
I hope this saves somebody a weeks worth of searching.
Rod
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit_HX8357 library compile error (Teensy3.1)
I put a question in to Paul at PJRC. It's a strange error. I don't understand why it's happening.
-
- Posts: 1
- Joined: Mon Sep 02, 2013 3:39 pm
Re: Adafruit_HX8357 library compile error (Teensy3.1)
BTW, the reason that hardware SPI mode doesn't work is a bug in writecommand and writedata. You need to not write to *clkport in hardware mode. Processors don't like having their address 0 written to :) See bug report and fix at github.
- adafruit2
- Posts: 22148
- Joined: Fri Mar 11, 2005 7:36 pm
Please be positive and constructive with your questions and comments.