Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 30

Thread: Teensy3 ST7735 Library

  1. #1
    Member
    Join Date
    Dec 2012
    Location
    Adelaide, SA
    Posts
    70

    Teensy3 ST7735 Library

    I believe there are a few people here who are using the Adafruit ST7735 ?

    I've been messing around with one recently, and found it to be pretty dismally slow (on the Teensy3 anyway, I have not tested it with AVR based arduinos).

    Anyway, I have adapted the adafruit library to a Teensy3 native version, with faster SPI and many other optimisations. It is considerably faster, at least from my tests (anywhere from 5x to 40x depending on what you're doing)

    It should be more or less a drop in replacement for the existing one, just set up as follows:

    Code:
    #include <Teensy3_ST7735.h>
    #include <SPI.h>
    
    Teensy3_ST7735 disp(10, 9, 8); // CS, RS, RST
    Note it is hardware SPI only, and both CS and RS must be valid SPI CS pins. RST can be any pin, or hook that pin to RESET and leave it as 0.

    I'd be interested in hearing if this works for anyone else; as there are a large number of slightly different ST7735 1.8" LCDs out there. I haven't yet tested it with a real Adafruit one; I'm waiting for a couple of other things to come back in stock before ordering one to try out.

    Thanks,
    - Peter Loveday
    Last edited by ploveday; 01-22-2013 at 10:02 PM.

  2. #2
    Member
    Join Date
    Dec 2012
    Location
    Adelaide, SA
    Posts
    70
    Here's an updated version.

    * Fixed swapped R/B colour order from Adafruit's version.
    * Now uses 16bit transfers where possible, for a bit more speed.
    * Now re-sets up CTAR and MCR before every function
    * Chip select is now done manually, rather than using hardware chip select. This is unfortunately necessary in order to work with other libraries (specifically SdFat) which goes and sets all the SPI hardware CS default states to low, activating every SPI device on the bus for its own transfers :-/

    So it gains a little speed on 16 bit transfers, and loses a little on the re-setting up of registers and manual chipsel, but is still a bit faster overall than the previous version... and more importantly, works with SdFat as is without requiring fixes to its SPI code.

    Thanks,
    - Peter
    Last edited by ploveday; 02-01-2013 at 10:26 AM.

  3. #3
    Senior Member sumotoy's Avatar
    Join Date
    Nov 2012
    Location
    Venezia, Italia
    Posts
    421
    good work! thanks ploveday, keep going!

  4. #4
    Senior Member
    Join Date
    Jan 2013
    Location
    Brisbane Australia
    Posts
    102
    I am trying the library. It compiles, but I am not sure about the wires
    I am using the adafruit example, graphictest_highspeed

    These are the changes I made to the code
    Code:
    //#include <Adafruit_GFX.h>    // Core graphics library
    //#include <Adafruit_ST7735.h> // Hardware-specific library
    #include <Teensy3_ST7735.h>
    #include <SPI.h>
    
    // Option 1: use any pins but a little slower
    //Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);
    
    // Option 2: must use the hardware SPI pins
    // (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
    // an output. This is much faster - also required if you want
    // to use the microSD card (see the image drawing example)
    //Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
    Teensy3_ST7735 tft(10, 9, 8); // CS, RS, RST
    I took some photos of my setup
    I will try to write down my pins that I am using
    LCD pin 3 -> Teensy3 pin 8
    LCD pin 4 -> Teensy3 pin 9
    LCD pin 5 -> none
    LCD pin 6 -> Teensy3 pin 10

    Just tried all other pins. Adafruit talks about MOSI and SCLK. The Teensy3 pinout diagram has SCK and that is probably SCLK. Not sure where MOSI is
    LCD pin 7 -> Teensy3 pin 13
    LCD pin 8 -> Teensy3 pin 15

    http://www.flickr.com/photos/9238031...in/photostream
    http://www.flickr.com/photos/9238031...in/photostream
    http://www.flickr.com/photos/9238031...in/photostream

  5. #5
    Member
    Join Date
    Dec 2012
    Location
    Adelaide, SA
    Posts
    70
    With that code specifying 10,9,8, you would need to connect the following:

    Teensy3 10 -> LCD TFT_CS
    Teensy3 9 -> LCD O/C
    Teensy3 8 -> LCD RESET
    Teensy3 11 -> LCD MOSI
    Teensy3 13 -> LCD SCK

    Obviously you also need to hook up GND and VCC to the LCD, and presumably VCC to LCD LITE ? Presumably 3.3V for these.

    It looks to me like you have it more or less right, just move the MOSI one from 15 to 11, I think?


    Down the track, to use the SDCard you'll also need to hook up LCD MISO (to Teensy3 12) and CARD_CS to whatever pin SdFat is set up for.

    - Peter

  6. #6
    Senior Member
    Join Date
    Jan 2013
    Location
    Brisbane Australia
    Posts
    102
    I rewired. I used to have my volt and ground connected to the Arduino, but moved to to the Teensy3 just in case. The screen comes on but nothing shows. I added code in the loop() to clear the screen and draw text and print to the serial port to make sure something is happening. I get serial port message, but still nothing on the screen. I am probably missing a pin somewhere

    Can you please post your test code

    This is the start of the setup()
    Code:
    void setup(void) {
      Serial.begin(9600);
      Serial.print("hello!");
    
      // Our supplier changed the 1.8" display slightly after Jan 10, 2012
      // so that the alignment of the TFT had to be shifted by a few pixels
      // this just means the init code is slightly different. Check the
      // color of the tab to see which init code to try. If the display is
      // cut off or has extra 'random' pixels on the top & left, try the
      // other option!
    
      // If your TFT's plastic wrap has a Red Tab, use the following:
      tft.initR(INITR_REDTAB);   // initialize a ST7735R chip, red tab
      // If your TFT's plastic wrap has a Green Tab, use the following:
      //tft.initR(INITR_GREENTAB); // initialize a ST7735R chip, green tab
    
      Serial.println("init");
    
      uint16_t time = millis();
      tft.fillScreen(ST7735_BLACK);
      time = millis() - time;
    http://www.flickr.com/photos/9238031...in/photostream
    http://www.flickr.com/photos/9238031...in/photostream
    http://www.flickr.com/photos/9238031...in/photostream
    http://www.flickr.com/photos/9238031...in/photostream
    http://www.flickr.com/photos/9238031...in/photostream

  7. #7
    Member
    Join Date
    Dec 2012
    Location
    Adelaide, SA
    Posts
    70
    My apologies, there seems to have been a bug that crept into the second rev that only showed if the CS pin was not a hardware SPI CS. Of course the pin I was testing with was...

    Anyway, here's an update, and also I've included working versions of the adafruit library in the same dir, in case it still doesn't work.

    I've also attached the benchmark sketch I was testing with.

    - Peter
    Attached Files Attached Files

  8. #8
    Senior Member
    Join Date
    Jan 2013
    Location
    Brisbane Australia
    Posts
    102
    It works Thank you for that. Now I can move more of my Arduino code over
    http://www.flickr.com/photos/9238031...in/photostream

    As a Java application developer, what you guys do with the hardware makes me feel as if I know nothing of programming

    So which pins would have worked with the previous version? What would you suggest? I can still change pins at this point in time

  9. #9
    Member
    Join Date
    Dec 2012
    Location
    Adelaide, SA
    Posts
    70
    there's really no need to change, it more or less only worked for me by accident, was a silly bug that should be fixed now. Any pin for the cs will be fine.

  10. #10
    Quote Originally Posted by ploveday View Post
    Here's an updated version.

    * Fixed swapped R/B colour order from Adafruit's version.
    Hi Peter,

    Thanks for your port to Teensy3, it was useful for me to try out these modules (and oi! fellow Aussie!).

    Just want to know that in your Teensy3_ST7735.h, the RGB macro has an error.

    #define RGB(r,g,b) ((b&0xf8)<<8|(g&0xfc)<<4|(r&0xf8)>>3)

    I think should be

    #define RGB(r,g,b) ((b&0xf8)<<8|(g&0xfc)<<3|(r&0xf8)>>3)
    [5,6,5]

    The function Color565 in Teensy3_ST7735.cpp has the correct shifts, but still in RGB instead of BGR.

    Click image for larger version. 

Name:	2013 - 1 (1).jpg 
Views:	367 
Size:	30.5 KB 
ID:	438Click image for larger version. 

Name:	2013 - 1 (2).jpg 
Views:	405 
Size:	17.4 KB 
ID:	439

  11. #11
    Senior Member
    Join Date
    Jan 2013
    Location
    Brisbane Australia
    Posts
    102
    I am trying to get the SD card code working, but not having much luck so far. I moved the init code from setup() to loop() and back again. It doesn't make a difference
    This is the serial out from trying to load the image. I am using the Adafruit parrot
    Initializing SD card...OK!

    Loading image 'parrot.bmp'
    File size: 61496
    Image Offset: 54
    Header size: 40
    Bit Depth: 24
    Image size: 128x160
    Loaded in 1350 ms

    Nothing happens on the screen. I then unplug the usb cable and plug it back in and then this is how the screen looks
    http://www.flickr.com/photos/92380311@N04/8874549060/


    I also tried changing the Teensy3_ST7735.h file
    #define RGB(r,g,b) ((b&0xf8)<<8|(g&0xfc)<<4|(r&0xf8)>>3)
    //#define RGB(r,g,b) ((b&0xf8)<<8|(g&0xfc)<<3|(r&0xf8)>>3)[5,6,5]



    My code that draws on the screen works fine. I use the ST7735 files included with the installation, I just rename the directory to Teensy3_ST7735 to make it work. I have to write the code to the Teensy and unplug it and plug it back in to get my display to work again after trying to show the graphic. This is how the display looks when I write to it http://www.flickr.com/photos/92380311@N04/8874549566/

    I am posting the code, probably alot more than what is needed, but just to show what I am doing and what is working for me

    Code that works by drawing to the screen
    Code:
    #include <IRremote.h>
    #include <MemoryFree.h>
    #include <IrCommons.h>
    #include <Enums.h>
    #include <Commons.h>
    #include <RadioBlock.h>
    #include <EEPROM.h>
    #include <IrCommands.h>
    #include <RfCommons.h>
    #include <mac.h>
    
    #include <Weapon.h>
    #include <Adafruit_GFX.h>    // Core graphics library
    #include <Teensy3_ST7735.h>
    #include <SPI.h>
    
    #define NEW_LINE_SIZE 13
    #define COLUMN_SIZE 88
    #define DEBUG
    #define DEBUG_FINE
    
    byte brightness = 0;
    Commons commons;
    Teensy3_ST7735 tft(14, 20, 7);
    RadioBlockSerialInterface radioBlock(5,4,3,2);
    Weapon weapon(radioBlock, commons);
    RfCommons rfCommons(radioBlock);
    IrCommons irCommons;
    int message[20];
    
    void setup(void) {
      Serial.begin(9600);
    
      weapon.init();
      irCommons.init();    
      
      tft.initR(INITR_REDTAB);   // initialize a ST7735R chip, red tab
      tft.fillScreen(ST7735_BLACK);
      tft.setTextWrap(false);
      tft.setRotation(3);
      tft.setTextSize(1);
      
      tft.setCursor(0, 0);
      tft.setTextColor(ST7735_WHITE);  
    
      
      drawHealth();
      drawHeat();
      
      drawHits();
      drawKills();
      
      drawAccuracy();
      drawSpawns();
      
      drawRange();
      drawTeam();
      
      drawBattle();
      drawObject();
      
      drawStatus();
      drawTime();
    }
    
    void loop() {  
      irCommons.listen(weapon);
      rfCommons.listen(weapon);
      
      weapon.doWork();
      
      if (weapon.shooting) {
        message[COMMAND_POSITION] = HIT_TAKEN;
        message[VALUE_POSITION] = weapon.damage;
        message[TEAM_POSITION] = weapon.team;
        message[PLAYERID_POSITION] = 0;
        message[BATTLEGROUP_POSITION] = weapon.battleGroup;
        irCommons.executeCommand(message, 5);  
      }
      
      updateHealth();
      updateHeat();
      updateTeam();
      updateStatus();
      updateTime();
    }  
    
    void drawStatus() {
      tft.setCursor(0, 5 * NEW_LINE_SIZE);
      tft.print("Status");
      tft.print(":");
      tft.println(weapon.getStatusDescription());
    }
    
    byte previousStatus = weapon.status;
    void updateStatus() {
      if (previousStatus != weapon.status) {
        previousStatus = weapon.status;
        tft.fillRect(42, 5 * NEW_LINE_SIZE, 36, 7, ST7735_BLACK);
        //tft.drawRect(42, 5 * NEW_LINE_SIZE, 36, 7, ST7735_WHITE);
        tft.setCursor(42, 5 * NEW_LINE_SIZE);
        tft.print(weapon.getStatusDescription());
      }
    }
    
    void testStatus() {
      weapon.status = PLAYER_ALIVE;
      updateStatus();
    //  delay(500);
    
      weapon.status = PLAYER_DEAD;
      updateStatus();
    //  delay(500);
      
      weapon.status = GAME_OVER;
      updateStatus();
    //  delay(500);
    
      weapon.status = PLAYER_PAUSED;
      updateStatus();
    //  delay(500);
    }
    
    void drawTime() {
      tft.setCursor(COLUMN_SIZE, 5 * NEW_LINE_SIZE);
      tft.print("00:15:00");
    }
    
    byte previousHours = weapon.getHours();
    byte previousMinutes = weapon.getMinutes();
    byte previousSeconds = weapon.getSeconds();
    void updateTime() {
      //hours
      if (previousHours != weapon.getHours()) {
        previousHours = weapon.getHours();
        //tft.fillRect(42, 5 * NEW_LINE_SIZE, 36, 7, ST7735_BLACK);
        //tft.drawRect(COLUMN_SIZE, 5 * NEW_LINE_SIZE, 12, 7, ST7735_WHITE);
        tft.fillRect(COLUMN_SIZE, 5 * NEW_LINE_SIZE, 12, 7, ST7735_BLACK);
        tft.setCursor(COLUMN_SIZE, 5 * NEW_LINE_SIZE);
        byte localHours = weapon.getHours();
        if (localHours < 10) {
          tft.print("0");
        }
        tft.print(localHours);
      }
      
      //minutes
      if (previousMinutes != weapon.getMinutes()) {
        previousMinutes = weapon.getMinutes();
        //tft.drawRect(COLUMN_SIZE + 18, 5 * NEW_LINE_SIZE, 12, 7, ST7735_WHITE);
        tft.fillRect(COLUMN_SIZE + 18, 5 * NEW_LINE_SIZE, 12, 7, ST7735_BLACK);
        tft.setCursor(COLUMN_SIZE + 18, 5 * NEW_LINE_SIZE);
        byte localMinutes = weapon.getMinutes();
        if (localMinutes < 10) {
          tft.print("0");
        }
        tft.print(localMinutes);
      }
      
      
      //seconds
      if (previousSeconds != weapon.getSeconds()) {
        previousSeconds = weapon.getSeconds();
        //tft.drawRect(COLUMN_SIZE + 36, 5 * NEW_LINE_SIZE, 12, 7, ST7735_WHITE);
        tft.fillRect(COLUMN_SIZE + 36, 5 * NEW_LINE_SIZE, 12, 7, ST7735_BLACK);
        tft.setCursor(COLUMN_SIZE + 36, 5 * NEW_LINE_SIZE);
        byte localSeconds = weapon.getSeconds();
        if (localSeconds < 10) {
          tft.print("0");
        }
        tft.print(localSeconds);
      }
      //tft.setCursor(42, 5 * NEW_LINE_SIZE);
      //tft.print(weapon.getStatusDescription());
    }
    
    void testTime() {
      updateTime();
    }
    
    
    void drawBattle() {
      tft.setCursor(0, 4 * NEW_LINE_SIZE);
      tft.print("Battle");
      tft.print(":");
      tft.print(weapon.battleGroup);
    }
    
    byte previousBattleGroup = weapon.battleGroup;
    void updateBattle() {
      if (previousBattleGroup != weapon.battleGroup) {
        previousBattleGroup = weapon.battleGroup;
        tft.fillRect(42, 4 * NEW_LINE_SIZE, 18, 7, ST7735_BLACK);
        //tft.drawRect(42, 4 * NEW_LINE_SIZE, 18, 7, ST7735_WHITE);
        tft.setCursor(42, 4 * NEW_LINE_SIZE);
        tft.print(weapon.battleGroup);
      }
    }
    
    void testBattle() {
      for (int i = 0; i < 256; i++) {
        weapon.battleGroup = i;
        updateBattle();
        delay(10);
      }
    }
    
    void drawObject() {
      tft.setCursor(COLUMN_SIZE, 4 * NEW_LINE_SIZE);
      tft.print("Object");
      tft.print(":");
      tft.print(weapon.getObjectives());
    }
    
    void updateObject() {
      tft.fillRect(COLUMN_SIZE + 42, 4 * NEW_LINE_SIZE, 30, 7, ST7735_BLACK);
      //tft.drawRect(COLUMN_SIZE + 42, 4 * NEW_LINE_SIZE, 30, 7, ST7735_WHITE);
      tft.setCursor(COLUMN_SIZE + 42, 4 * NEW_LINE_SIZE);
      tft.print(weapon.getObjectives());
    }
    
    void testObject() {
      for (int i = 0; i < 65000; i++) {
        weapon.objectives = i;
        updateObject();
        delay(10);
      }
    }
    
    void drawRange() {
      tft.setCursor(0, 3 * NEW_LINE_SIZE);
      tft.print("Range");
      tft.print(":");
      tft.print(weapon.getRange());
    }
    
    void updateRange() {
      tft.fillRect(36, 3 * NEW_LINE_SIZE, 36, 7, ST7735_BLACK);
      //tft.drawRect(36, 3 * NEW_LINE_SIZE, 36, 7, ST7735_WHITE);
      tft.setCursor(36, 3 * NEW_LINE_SIZE);
      tft.print(weapon.getRange());
    }
    
    void testRange() {
      weapon.range = SHORT_RANGE;
      updateRange();
      delay(500);
    
      weapon.range = MEDIUM_RANGE;
      updateRange();
      delay(500);
      
      weapon.range = LONG_RANGE;
      updateRange();
      delay(500);
    }
    
    void drawTeam() {
      tft.setCursor(COLUMN_SIZE, 3 * NEW_LINE_SIZE);
      tft.print("Team");
      tft.print(":");
      tft.println(weapon.getTeamDescription());
    }
    
    byte previousTeam = weapon.team;
    void updateTeam() {
      if (previousTeam != weapon.team) {
        previousTeam = weapon.team;
        tft.fillRect(COLUMN_SIZE + 30, 3 * NEW_LINE_SIZE, 36, 7, ST7735_BLACK);
        //tft.drawRect(COLUMN_SIZE + 30, 3 * NEW_LINE_SIZE, 36, 7, ST7735_WHITE);
        tft.setCursor(COLUMN_SIZE + 30, 3 * NEW_LINE_SIZE);
        tft.print(weapon.getTeamDescription());
      }
    }
    
    void testTeam() {
      weapon.team = TEAM_RED;
      updateTeam();
      delay(500);
    
      weapon.team = TEAM_BLUE;
      updateTeam();
      delay(500);
      
      weapon.team = TEAM_GREEN;
      updateTeam();
      delay(500);
    
      weapon.team = TEAM_PURPLE;
      updateTeam();
      delay(500);
    
      weapon.team = TEAM_ORANGE;
      updateTeam();
      delay(500);
    
      weapon.team = TEAM_YELLOW;
      updateTeam();
      delay(500);
    
      weapon.team = TEAM_FREE_FOR_ALL;
      updateTeam();
      delay(500);
    
      weapon.team = NONE;
      updateTeam();
      delay(500);
    }
    
    void drawAccuracy() {
      tft.setCursor(0, 2 * NEW_LINE_SIZE);
      tft.print("Accuracy");
      tft.print(":");
      tft.print(weapon.getAccuracy());
      tft.print("%");
    }
    
    void updateAccuracy() {
      tft.fillRect(54, 2 * NEW_LINE_SIZE, 17, 7, ST7735_BLACK);
      //tft.drawRect(54, 2 * NEW_LINE_SIZE, 17, 7, ST7735_WHITE);
        
      if (weapon.getAccuracy() < 10) {
        tft.setCursor(66, 2 * NEW_LINE_SIZE);
      } else if (weapon.getAccuracy() < 100) {
        tft.setCursor(60, 2 * NEW_LINE_SIZE);
      } else {
        tft.setCursor(54, 2 * NEW_LINE_SIZE);
      }
      tft.print(weapon.getAccuracy());
    
      
    }
    
    void testAccuracy() {
      for (int i = 0; i < 500; i++) {
        weapon.accuracy = i;
        updateAccuracy();
        delay(10);
      }
    }
    
    void drawSpawns() {
      tft.setCursor(COLUMN_SIZE, 2 * NEW_LINE_SIZE);
      tft.print("Spawns");
      tft.print(":");
      tft.print(weapon.getSpawns());
    }
    
    void updateSpawns() {
      tft.fillRect(COLUMN_SIZE + 42, 2 * NEW_LINE_SIZE, 30, 7, ST7735_BLACK);
      //tft.drawRect(COLUMN_SIZE + 42, 2 * NEW_LINE_SIZE, 30, 7, ST7735_WHITE);
      tft.setCursor(COLUMN_SIZE + 42, 2 * NEW_LINE_SIZE);
      tft.print(weapon.spawns);
    }
    
    void testSpawns() {
      for (int i = 0; i < 500; i++) {
        weapon.spawns = i;
        updateSpawns();
        delay(15);
      }
    }
    
    void drawHits() {
      tft.setCursor(0, 1 * NEW_LINE_SIZE);
      tft.print("Hits");
      tft.print(":");
      tft.print(weapon.getHits());
    }
    
    void updateHits() {
      tft.fillRect(30, 1 * NEW_LINE_SIZE, 30, 7, ST7735_BLACK);
      //tft.drawRect(30, 1 * NEW_LINE_SIZE, 30, 7, ST7735_WHITE);
      tft.setCursor(30, 1 * NEW_LINE_SIZE);
      tft.print(weapon.hits);
    }
    
    void drawKills() {
      tft.setCursor(COLUMN_SIZE, 1 * NEW_LINE_SIZE);
      tft.print("Kills");
      tft.print(":");
      tft.println(weapon.getKills());
    }
    
    void updateKills() {
      tft.fillRect(COLUMN_SIZE + 36, 1 * NEW_LINE_SIZE, 30, 7, ST7735_BLACK);
      //tft.drawRect(COLUMN_SIZE + 36, 1 * NEW_LINE_SIZE, 30, 7, ST7735_WHITE);
      tft.setCursor(COLUMN_SIZE + 36, 1 * NEW_LINE_SIZE);
      tft.print(weapon.getKills());
    }
    
    void testKills() {
      for (int i = 0; i < 500; i++) {
        weapon.kills = i;
        updateKills();
        delay(5);
      }
    }
    
    
    void drawHealth() {
      tft.setCursor(0, 0);
      tft.setTextColor(ST7735_WHITE);
    
      tft.print("HP");
      tft.print(":");
      tft.print(weapon.getHealth());
      tft.print("/");
      tft.print(weapon.getMaxHealth());  
      tft.println("");
    }
    
    byte previousHealth = weapon.health;
    void updateHealth() {
      if (previousHealth != weapon.health){
        previousHealth = weapon.health;
        tft.fillRect(18, 0, 5, 8, ST7735_BLACK);
        if (weapon.health < 10) {
          tft.setCursor(18, 0);
        } else if (weapon.health < 100) {
          tft.setCursor(24, 0);
        } else {
          tft.setCursor(18, 0);
        }
        tft.print(weapon.health);
      }
    }
    
    void updateMaxHealth() {
      tft.fillRect(42, 0, 17, 8, ST7735_BLACK);
      //tft.drawRect(COLUMN_SIZE + 46, 0, 17, 8, ST7735_WHITE);
      tft.setCursor(42, 0);
      tft.print(weapon.maxHealth);
    }
    
    //HEAT
    void drawHeat() {
      tft.setCursor(COLUMN_SIZE, 0);
      tft.print("Heat");
      tft.print(": ");
      tft.print(weapon.getAmmo());
      tft.print("/");
      tft.println(weapon.getMaxAmmo());
    }
    
    byte previousHeat = weapon.ammo;
    void updateHeat() {
      if (previousHeat != weapon.ammo) {
        previousHeat = weapon.ammo;
        if (weapon.ammo < 10) {
          tft.fillRect(COLUMN_SIZE + 30, 0, 12, 8, ST7735_BLACK);
          tft.setCursor(COLUMN_SIZE + 36, 0);
        } else if (weapon.ammo < 100) {
          tft.fillRect(COLUMN_SIZE + 30, 0, 12, 8, ST7735_BLACK);
          tft.setCursor(COLUMN_SIZE + 30, 0);
        } else {
          tft.setCursor(COLUMN_SIZE + 30, 0);
        }
        tft.print(weapon.ammo);  
      }
    }
    
    void testHeat() {
      for (int i = 0; i < 500; i++) {
        weapon.ammo = i;
        updateHeat();
        delay(100);
      }
    }
    
    //MAX HEAT
    void updateMaxHeat() {
      tft.fillRect(COLUMN_SIZE + 54, 0, 17, 8, ST7735_BLACK);
      //tft.drawRect(COLUMN_SIZE + 54, 0, 17, 8, ST7735_WHITE);
      tft.setCursor(COLUMN_SIZE + 54, 0);
      tft.print(weapon.maxAmmo);
    }
    
    void testMaxHeat() {
      for (int i = 0; i < 120; i++) {
        weapon.maxAmmo = i;
        updateMaxHeat();
        delay(100);
      }
    }
    
    
    void updateAssistedKills() {
      tft.fillRect(47, 32, 25, 7, ST7735_BLACK);
      //tft.drawRect(47, 32, 25, 7, ST7735_WHITE);
      tft.setCursor(47, 32);
      tft.print(weapon.assistedKills);
    }
    
    void testHealth() {
      for (int i = 0; i < 101; i++) {
        weapon.health = i;
        updateHealth();
        delay(10);
      }
    }
    
    void testMaxHealth() {
      for (int i = 0; i < 101; i++) {
        weapon.maxHealth = i;
        updateMaxHealth();
        delay(10);
      }
    }
    
    void testHits() {
      for (int i = 0; i < 65000; i++) {
        weapon.hits = i;
        updateHits();
        delay(10);
      }
    }





    Code that doesn't work when trying to load the bmp
    Code:
    /***************************************************
      This is an example sketch for the Adafruit 1.8" SPI display.
      This library works with the Adafruit 1.8" TFT Breakout w/SD card
      ----> http://www.adafruit.com/products/358
      as well as Adafruit raw 1.8" TFT display
      ----> http://www.adafruit.com/products/618
    
      Check out the links above for our tutorials and wiring diagrams
      These displays use SPI to communicate, 4 or 5 pins are required to
      interface (RST is optional)
      Adafruit invests time and resources providing this open source code,
      please support Adafruit and open-source hardware by purchasing
      products from Adafruit!
    
      Written by Limor Fried/Ladyada for Adafruit Industries.
      MIT license, all text above must be included in any redistribution
     ****************************************************/
    
    #include <Teensy3_ST7735.h>
    #include <SPI.h>
    #include <SD.h>
    
    // TFT display and SD card will share the hardware SPI interface.
    // Hardware SPI pins are specific to the Arduino board type and
    // cannot be remapped to alternate pins.  For Arduino Uno,
    // Duemilanove, etc., pin 11 = MOSI, pin 12 = MISO, pin 13 = SCK.
    #define SD_CS    4  // Chip select line for SD card
    #define TFT_CS  10  // Chip select line for TFT display
    #define TFT_DC   9  // Data/command line for TFT
    #define TFT_RST  8  // Reset line for TFT (or connect to +5V)
    
    //Adafruit_ST7735 tft = Adafruit_ST7735(14, 20, 7);
    Teensy3_ST7735 tft(14, 20, 7);
    
    void setup(void) {
      Serial.begin(9600);
    
      // Our supplier changed the 1.8" display slightly after Jan 10, 2012
      // so that the alignment of the TFT had to be shifted by a few pixels
      // this just means the init code is slightly different. Check the
      // color of the tab to see which init code to try. If the display is
      // cut off or has extra 'random' pixels on the top & left, try the
      // other option!
      // If you are seeing red and green color inversion, use Black Tab
    
      // If your TFT's plastic wrap has a Black Tab, use the following:
      tft.initR(INITR_REDTAB);   // initialize a ST7735S chip, black tab
      // If your TFT's plastic wrap has a Red Tab, use the following:
      //tft.initR(INITR_REDTAB);   // initialize a ST7735R chip, red tab
      // If your TFT's plastic wrap has a Green Tab, use the following:
      //tft.initR(INITR_GREENTAB); // initialize a ST7735R chip, green tab
    
    }
    
    void loop() {
      delay(10000);
      Serial.print("Initializing SD card...");
      if (!SD.begin(19)) {
        Serial.println("failed!");
        return;
      }
      Serial.println("OK!");
    
      bmpDraw("parrot.bmp", 0, 0);
    }
    
    // This function opens a Windows Bitmap (BMP) file and
    // displays it at the given coordinates.  It's sped up
    // by reading many pixels worth of data at a time
    // (rather than pixel by pixel).  Increasing the buffer
    // size takes more of the Arduino's precious RAM but
    // makes loading a little faster.  20 pixels seems a
    // good balance.
    
    #define BUFFPIXEL 20
    
    void bmpDraw(char *filename, uint8_t x, uint8_t y) {
    
      File     bmpFile;
      int      bmpWidth, bmpHeight;   // W+H in pixels
      uint8_t  bmpDepth;              // Bit depth (currently must be 24)
      uint32_t bmpImageoffset;        // Start of image data in file
      uint32_t rowSize;               // Not always = bmpWidth; may have padding
      uint8_t  sdbuffer[3*BUFFPIXEL]; // pixel buffer (R+G+B per pixel)
      uint8_t  buffidx = sizeof(sdbuffer); // Current position in sdbuffer
      boolean  goodBmp = false;       // Set to true on valid header parse
      boolean  flip    = true;        // BMP is stored bottom-to-top
      int      w, h, row, col;
      uint8_t  r, g, b;
      uint32_t pos = 0, startTime = millis();
    
      if((x >= tft.width()) || (y >= tft.height())) return;
    
      Serial.println();
      Serial.print("Loading image '");
      Serial.print(filename);
      Serial.println('\'');
    
      // Open requested file on SD card
      if ((bmpFile = SD.open(filename)) == NULL) {
        Serial.print("File not found");
        return;
      }
    
      // Parse BMP header
      if(read16(bmpFile) == 0x4D42) { // BMP signature
        Serial.print("File size: "); Serial.println(read32(bmpFile));
        (void)read32(bmpFile); // Read & ignore creator bytes
        bmpImageoffset = read32(bmpFile); // Start of image data
        Serial.print("Image Offset: "); Serial.println(bmpImageoffset, DEC);
        // Read DIB header
        Serial.print("Header size: "); Serial.println(read32(bmpFile));
        bmpWidth  = read32(bmpFile);
        bmpHeight = read32(bmpFile);
        if(read16(bmpFile) == 1) { // # planes -- must be '1'
          bmpDepth = read16(bmpFile); // bits per pixel
          Serial.print("Bit Depth: "); Serial.println(bmpDepth);
          if((bmpDepth == 24) && (read32(bmpFile) == 0)) { // 0 = uncompressed
    
            goodBmp = true; // Supported BMP format -- proceed!
            Serial.print("Image size: ");
            Serial.print(bmpWidth);
            Serial.print('x');
            Serial.println(bmpHeight);
    
            // BMP rows are padded (if needed) to 4-byte boundary
            rowSize = (bmpWidth * 3 + 3) & ~3;
    
            // If bmpHeight is negative, image is in top-down order.
            // This is not canon but has been observed in the wild.
            if(bmpHeight < 0) {
              bmpHeight = -bmpHeight;
              flip      = false;
            }
    
            // Crop area to be loaded
            w = bmpWidth;
            h = bmpHeight;
            if((x+w-1) >= tft.width())  w = tft.width()  - x;
            if((y+h-1) >= tft.height()) h = tft.height() - y;
    
            // Set TFT address window to clipped image bounds
            tft.setAddrWindow(x, y, x+w-1, y+h-1);
    
            for (row=0; row<h; row++) { // For each scanline...
    
              // Seek to start of scan line.  It might seem labor-
              // intensive to be doing this on every line, but this
              // method covers a lot of gritty details like cropping
              // and scanline padding.  Also, the seek only takes
              // place if the file position actually needs to change
              // (avoids a lot of cluster math in SD library).
              if(flip) // Bitmap is stored bottom-to-top order (normal BMP)
                pos = bmpImageoffset + (bmpHeight - 1 - row) * rowSize;
              else     // Bitmap is stored top-to-bottom
                pos = bmpImageoffset + row * rowSize;
              if(bmpFile.position() != pos) { // Need seek?
                bmpFile.seek(pos);
                buffidx = sizeof(sdbuffer); // Force buffer reload
              }
    
              for (col=0; col<w; col++) { // For each pixel...
                // Time to read more pixel data?
                if (buffidx >= sizeof(sdbuffer)) { // Indeed
                  bmpFile.read(sdbuffer, sizeof(sdbuffer));
                  buffidx = 0; // Set index to beginning
                }
    
                // Convert pixel from BMP to TFT format, push to display
                b = sdbuffer[buffidx++];
                g = sdbuffer[buffidx++];
                r = sdbuffer[buffidx++];
                tft.pushColor(tft.Color565(r,g,b));
              } // end pixel
            } // end scanline
            Serial.print("Loaded in ");
            Serial.print(millis() - startTime);
            Serial.println(" ms");
          } // end goodBmp
        }
      }
    
      bmpFile.close();
      if(!goodBmp) Serial.println("BMP format not recognized.");
    }
    
    // These read 16- and 32-bit types from the SD card file.
    // BMP data is stored little-endian, Arduino is little-endian too.
    // May need to reverse subscript order if porting elsewhere.
    
    uint16_t read16(File f) {
      uint16_t result;
      ((uint8_t *)&result)[0] = f.read(); // LSB
      ((uint8_t *)&result)[1] = f.read(); // MSB
      return result;
    }
    
    uint32_t read32(File f) {
      uint32_t result;
      ((uint8_t *)&result)[0] = f.read(); // LSB
      ((uint8_t *)&result)[1] = f.read();
      ((uint8_t *)&result)[2] = f.read();
      ((uint8_t *)&result)[3] = f.read(); // MSB
      return result;
    }
    Last edited by taskman; 05-29-2013 at 04:15 AM.

  12. #12
    Senior Member
    Join Date
    Jan 2013
    Location
    Brisbane Australia
    Posts
    102
    I did some crazy code to test if the data that comes back from the SD card is actually right

    So I printed out the RGB values and I wrote some code to write the RGB values to the screen to make sure things are supposed to work

    Seems the image is busy forming http://www.flickr.com/photos/92380311@N04/8875762347/, colours are off, but at least not the buggy image as when it is read from the SD card and printed so there is probably something wrong with the example code I am using.

    Does anybody have some code I can use to read an image from the SD card and display it?

  13. #13
    Senior Member
    Join Date
    Jan 2013
    Location
    Brisbane Australia
    Posts
    102
    I upgraded to version 1.0.5 and I am having the following errors
    I created a clean installation
    I guess the constants probably moved to another header file?
    I haven't done much investigation yet, just disabled all my screen code for now

    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::commandList(uint8_t*)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 270:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 270:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 270:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 281:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 281:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 281:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::setAddrWindow(uint8_t, uint8_t, uint8_t, uint8_t)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 426:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::fillScreen(uint16_t)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 433:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 436:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 436:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 436:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735:ushColor(uint16_t)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 447:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 447:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 447:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::_drawPixel(int16_t, int16_t, uint16_t)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 457:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 459:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 459:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 459:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::drawPixel(int16_t, int16_t, uint16_t)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 468:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 470:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 470:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 470:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::drawFastVLine(int16_t, int16_t, int16_t, uint16_t)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 483:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 486:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 486:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 486:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::drawFastHLine(int16_t, int16_t, int16_t, uint16_t)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 500:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 503:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 503:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 503:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::fillRect(int16_t, int16_t, int16_t, int16_t, uint16_t)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 520:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 523:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 523:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 523:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::setRotation(uint8_t)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 550:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 550:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 550:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 584:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 584:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 584:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::invertDisplay(boolean)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 592:2: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 592:2: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 592:2: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::drawChar(int16_t, int16_t, unsigned char, uint16_t, uint16_t, uint8_t)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 604:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 604:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 604:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 605:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 605:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 605:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 608:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 619:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 619:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 619:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 625:4: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 625:4: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 625:4: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 627:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 627:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 627:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 628:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 628:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 628:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: In member function 'void Teensy3_ST7735::drawLine(int16_t, int16_t, int16_t, int16_t, uint16_t)':
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 787:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 789:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 793:3: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 793:3: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 793:3: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 804:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_PCS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CTAS' was not declared in this scope
    C:\Util\arduino-1.0.5\libraries\Teensy3_ST7735\Teensy3_ST7735.cpp: 806:5: error: 'SPI0_PUSHR_CONT' was not declared in this scope

  14. #14
    Junior Member
    Join Date
    Feb 2013
    Posts
    10
    The fix for the SPI0_* issue is to remove the 0 from the function name in Teensy3_ST7735.cpp.

    #define SPIWRITE1(c, cs) \
    do { \
    while ((SPI0_SR & SPI_SR_TXCTR) >= 0x00004000); \
    SPI0_PUSHR = ((c)&0xff) | SPI_PUSHR_PCS((cs)) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT; \
    } while(0)

    #define SPIWRITE2(w, cs) \
    do { \
    while ((SPI0_SR & SPI_SR_TXCTR) >= 0x00004000); \
    SPI0_PUSHR = ((w)&0xffff) | SPI_PUSHR_PCS((cs)) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT; \
    } while(0)
    But now I am getting a vtable error which is similar to this: http://forum.pjrc.com/threads/10-Ada...44-LCD-library

    ST7735\Teensy3_ST7735.cpp.o: In function `Teensy3_ST7735::Teensy3_ST7735(unsigned char, unsigned char, unsigned char)':
    C:\Users\John\Documents\Arduino\libraries\ST7735/Teensy3_ST7735.cpp:54: undefined reference to `vtable for Teensy3_ST7735'
    I still haven't quite wrapped my brain around virtual functions, so the fix doesn't seem obvious.

  15. #15
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    I've been working with this library. Here's some work-in-progress code.

    This version uses the hardware chip selects for both CS and RS, so it might not play well with other SPI libraries. I'm going to work on all the others soon (optimizing them too), so hopefully soon these can work together.

    Adafruit_ST7735_Teensy3_work_in_progress.zip

  16. #16
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    Another update. This version merges Teensy3 nicely with Adafruit's code for other boards. It also restores the bit-bashing mode, but runs extremely fast if the pins are specified as any combination that works with the native signals.

    https://github.com/PaulStoffregen/Adafruit_ST7735

  17. #17
    Here's ST7735 on an raspberry pi:

    http://youtu.be/elHCGuDMlkg?t=1m32s

    As you can see, the ST7735 is capable of some good frame rates. If using a teensy 3.1, and creating a 40KB frame buffer, any chance we could do a DMA SPI transfer to dump the 40KB frame for some incredible frame rates?

  18. #18
    Senior Member sumotoy's Avatar
    Join Date
    Nov 2012
    Location
    Venezia, Italia
    Posts
    421
    I'm little confused about this library, actually the official Adafruit one claims to be Teensy 3/3.1 compatible and the Paul's version looks much different inside. I'm not sure wich one I should be use, actually I'm working with Paul one, wich one I should use?
    I've also noticed that I cannot get any image from SD, doesn't give any error but screen remain black, I play just twice with sd cards so I'm not an expert, just opened the sketch and runned (before I copy in the sd card the file parrot.bmp).

  19. #19
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    Quote Originally Posted by sumotoy View Post
    I'm little confused about this library, actually the official Adafruit one claims to be Teensy 3/3.1 compatible and the Paul's version looks much different inside. I'm not sure wich one I should be use, actually I'm working with Paul one, wich one I should use?
    Both are compatible.

    My copy has extra optimizations, so it runs a lot faster if you use the right 5 pins.

    I've also noticed that I cannot get any image from SD, doesn't give any error but screen remain black, I play just twice with sd cards so I'm not an expert, just opened the sketch and runned (before I copy in the sd card the file parrot.bmp).
    I believe Adafruit's code only parses a particular BMP format which isn't the default most people use. I recall seeing info in their tutorial about how to convert to the required special format.

  20. #20
    Senior Member sumotoy's Avatar
    Join Date
    Nov 2012
    Location
    Venezia, Italia
    Posts
    421
    Thanks Paul, I'm actually use your connected in SPI, is this the faster mode? If I remember well I've read somewhere they use bmp little endian encoded, I will try later.

  21. #21
    Senior Member xxxajk's Avatar
    Join Date
    Nov 2013
    Location
    Buffalo, NY USA
    Posts
    527
    If you are sending large blobs of data, you might want to try https://github.com/xxxajk/spi4teensy3 which is designed to send out large payloads very quickly. Let me know if it helps, or not.

  22. #22
    Senior Member sumotoy's Avatar
    Join Date
    Nov 2012
    Location
    Venezia, Italia
    Posts
    421
    Mmmm, I've try 6 different SD cards with the parrot.bmp file proposed by adafruit that should be ok but I just got from garbage to blank screens. Tried also sdfat to check the sd connection and it's consistent with SD library and SDFat one, I just noticed some screen flickering with SD and SDfat tests probably caused because the tft it's not initialized, well, adding tft initialization on file benchSD.ino and bench.ino cause SD stop working. I will do some further experiments with the Adafruit ST7735 to see if there's some changes...
    Thanks for proposal xxxajk but I'm trying to get library working first, then probably will like to be a nice weekend project doing some experiments!
    Apart SD, display works really fast.

  23. #23
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,171
    Oh, are you using the SD library, or SdFat library? SdFat might not be compatible.

  24. #24
    Senior Member sumotoy's Avatar
    Join Date
    Nov 2012
    Location
    Venezia, Italia
    Posts
    421
    sd one. Just tryied now the adafruit ST7735 library, same file spitftbitmap.ino. This time I got only white or black screens! It's funny that sketch inform me though serial that parrot.bmp it's correctly loaded.
    Looks like that SD library doesn't break the normal functionalities of the tft library, I merged inside a tft sketch the cardInfo.ino sketch from sd library and tft worked correctly the sd retuned this by serial:

    Wiring is correct and a card is present.

    Card type: SD1

    Volume type is FAT16

    Volume size (bytes): 2044854272
    Volume size (Kbytes): 1996928
    Volume size (Mbytes): 1950

    Files found on the card (name, date and size in bytes):
    PARROT.BMP 2014-03-04 01:36:48 61496

    Interesting... search continue.
    parrot.bmp
    Last edited by sumotoy; 03-04-2014 at 02:19 AM.

  25. #25
    Senior Member sumotoy's Avatar
    Join Date
    Nov 2012
    Location
    Venezia, Italia
    Posts
    421
    Got some results, Using an SDHC 4giga card (fat32) at 48Mhz with Teensy3.0 and Adafruit TFT library I finally visualized parrot. Using same exact configuration with Paul library result in a Black screen.
    Looks like the SD cards quality have an important role with SD library but with Paul library there's something breaks just the correct file retrieve or maybe SPI it's too fast for SD card.
    This remind me how much I hate SD stuff! I wonder if a fast SPI eeprom can be a better replacement!

Posting Permissions

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