Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Compiling Teesy 3.5 and Adafruit_TFTLCD

  1. #1

    Compiling Teesy 3.5 and Adafruit_TFTLCD

    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 by jblaze; 10-27-2016 at 02:38 PM.

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,984
    I assume you are using the Adafruit library probably from: https://github.com/adafruit/TFTLCD-Library

    If so, my quick look up there looks like this library may need a little work to use on Teensy.

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

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,984
    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...

  5. #5
    Kurt, I have uploaded the versions I'm using.

    Adafruit_TFTLCD.cpp

    Adafruit_TFTLCD.h

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Posts
    275
    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.

  7. #7
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,984
    Quote Originally Posted by jblaze View Post
    Kurt, I have uploaded the versions I'm using.

    Adafruit_TFTLCD.cpp

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

  8. #8
    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!!!

  9. #9
    Quote Originally Posted by jblaze View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •