Compiling Teesy 3.5 and Adafruit_TFTLCD

Status
Not open for further replies.

jblaze

Well-known member
I recently did an update from Arduino IDE 1.6.5 and Teensyduino 1.25-beta2 to Arduino IDE 1.6.11 and Teensyduino 1.30

Now I get some errors during compiling. Does anyone have got a hint?

Code:
Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/core_pins.h: In function 'void digitalWriteFast(uint8_t, uint8_t)':
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/core_pins.h:1642:24: error: 'portSetRegister' was not declared in this scope
    *portSetRegister(pin) = digitalPinToBitMask(pin);
                        ^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/core_pins.h:1642:51: error: 'digitalPinToBitMask' was not declared in this scope
    *portSetRegister(pin) = digitalPinToBitMask(pin);
                                                   ^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/core_pins.h:1644:26: error: 'portClearRegister' was not declared in this scope
    *portClearRegister(pin) = digitalPinToBitMask(pin);
                          ^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/core_pins.h:1644:53: error: 'digitalPinToBitMask' was not declared in this scope
    *portClearRegister(pin) = digitalPinToBitMask(pin);
                                                     ^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/core_pins.h: In function 'uint8_t digitalReadFast(uint8_t)':
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/core_pins.h:1794:32: error: 'portInputRegister' was not declared in this scope
   return *portInputRegister(pin);
                                ^
/Volumes/Macintosh HD/Users/jb/Documents/Arduino/libraries/TFTLCD-Library-master/Adafruit_TFTLCD.cpp: In constructor 'Adafruit_TFTLCD::Adafruit_TFTLCD(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)':
/Volumes/Macintosh HD/Users/hscheibe/Documents/Arduino/libraries/TFTLCD-Library-master/Adafruit_TFTLCD.cpp:52:55: error: 'digitalPinToPort' was not declared in this scope
    csPort     = portOutputRegister(digitalPinToPort(cs));
                                                       ^
/Volumes/Macintosh HD/Users/hscheibe/Documents/Arduino/libraries/TFTLCD-Library-master/Adafruit_TFTLCD.cpp:52:56: error: 'portOutputRegister' was not declared in this scope
    csPort     = portOutputRegister(digitalPinToPort(cs));
                                                        ^
/Volumes/Macintosh HD/Users/hscheibe/Documents/Arduino/libraries/TFTLCD-Library-master/Adafruit_TFTLCD.cpp:63:38: error: 'digitalPinToBitMask' was not declared in this scope
   csPinSet   = digitalPinToBitMask(cs);
                                      ^
In file included from /Volumes/Macintosh HD/Users/jblaze/Documents/Arduino/libraries/TFTLCD-Library-master/Adafruit_TFTLCD.cpp:19:0:
/Volumes/Macintosh HD/Users/hscheibe/Documents/Arduino/libraries/TFTLCD-Library-master/Adafruit_TFTLCD.cpp: In member function 'void Adafruit_TFTLCD::begin(uint16_t)':
 
Last edited:
This library worked with 1.6.5 with some minor optimization. I added the teensy 3.5 options but only little success.

Does this have something to do with the KINETIK variable? Because there is the definition of the above non-declared values.
 
Might help to either upload a zip file of your version and/or give a location of where to get the version you are using.

The version I see up on github adafruit, does not have any Teensy stuff in it... I tried doing a quick add like:
Update the main .h and .cpp file to change
Code:
  #if defined (__AVR__)
to
Code:
 #if defined (__AVR__) || defined(TEENSYDUINO)
TO where it was defining things like csPort

But then there is the file pin_magic.h, where it has lots of gunk, like:
Code:
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega328__) || defined(__AVR_ATmega8__)

 // Arduino Uno, Duemilanove, etc.

 #ifdef USE_ADAFRUIT_SHIELD_PINOUT
...
 #else // Uno w/Breakout board

  #define write8inline(d) {                          \
    PORTD = (PORTD & B00000011) | ((d) & B11111100); \
    PORTB = (PORTB & B11111100) | ((d) & B00000011); \
    WR_STROBE; }
  #define read8inline(result) {                       \
    RD_ACTIVE;                                        \
    DELAY7;                                           \
    result = (PIND & B11111100) | (PINB & B00000011); \
    RD_IDLE; }
  #define setWriteDirInline() { DDRD |=  B11111100; DDRB |=  B00000011; }
  #define setReadDirInline()  { DDRD &= ~B11111100; DDRB &= ~B00000011; }

 #endif
...

Could probably hack up a version to make it work, but this sounds like hard coded pin number and relying on avr emulation...
 
Last time I've used my ILI9325 display (and Teensy 3.1) with this library, it helped to comment out #include "pins_arduino.h" in Adafruit_TFTLCD.cpp.
 
Kurt, I have uploaded the versions I'm using.

View attachment 8655

View attachment 8656
Thanks,

Did you also have an updated version of pin_magic.h?

As one of the first error messages I see when I use this is:
C:\Users\Kurt\Documents\Arduino\libraries\Adafruit_TFTLCD\pin_magic.h:350:3: error: #error "Board type unsupported / not recognized"

Then I get a lot of undefined methods like write8inline, read8...
 
The hint from HWGuy did it.

I replaced
#include "pins_arduino.h"

with
#if !defined(__MK20DX128__) && !defined(__MK20DX256__) && !defined(__MK64FX512__) && !defined(__MK66FX1M0__)
#include "pins_arduino.h"
#endif

Thank you guys!!!
 
The hint from HWGuy did it.

I replaced
#include "pins_arduino.h"

with
#if !defined(__MK20DX128__) && !defined(__MK20DX256__) && !defined(__MK64FX512__) && !defined(__MK66FX1M0__)
#include "pins_arduino.h"
#endif

Thank you guys!!!
can you share your library pls i want to use a tft with teensy 3.5
 
Status
Not open for further replies.
Back
Top