Adafruit_HX8357 library compile error (Teensy3.1)

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
poynting
 
Posts: 5
Joined: Sun Aug 16, 2015 2:38 am

Adafruit_HX8357 library compile error (Teensy3.1)

Post by poynting »

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...

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by adafruit_support_rick »

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

User avatar
poynting
 
Posts: 5
Joined: Sun Aug 16, 2015 2:38 am

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by poynting »

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.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by adafruit_support_rick »

I don't know why hardware SPI wouldn't work. I'll have to see if I can replicate the problem.

User avatar
poynting
 
Posts: 5
Joined: Sun Aug 16, 2015 2:38 am

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by poynting »

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

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by adafruit_support_rick »

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

User avatar
tinman123
 
Posts: 6
Joined: Mon Jan 13, 2014 9:12 am

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by tinman123 »

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

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by adafruit_support_rick »

The Due port should work. Give it a try. I updated the examples to run properly:
TouchScreen_Due.zip
(8.25 KiB) Downloaded 55 times

User avatar
tinman123
 
Posts: 6
Joined: Mon Jan 13, 2014 9:12 am

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by tinman123 »

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?
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.

User avatar
tinman123
 
Posts: 6
Joined: Mon Jan 13, 2014 9:12 am

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by tinman123 »

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

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by adafruit_support_rick »

I put a question in to Paul at PJRC. It's a strange error. I don't understand why it's happening.

robertbaruch
 
Posts: 1
Joined: Mon Sep 02, 2013 3:39 pm

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by robertbaruch »

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.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Adafruit_HX8357 library compile error (Teensy3.1)

Post by adafruit2 »

fixed

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”