Adafruit ST7789 on Teensy LC SD2Card error with platformio

Status
Not open for further replies.

davorin

New member
Good afternoon

Lately I came across the great Teensy boards and they are great to work with VSCode and platformio

For a new project (SMT oven) I chose the Teensy LC board as it features two SPI ports...hooked up a MX31855 thermo coupler ADC on SPI0 which works just fine...
For displaying the temperature curve and user menu I have a Adafruit 2.0" TFT display with 240x320 resolution, and they suggest to use the Adafruit ST7789/GFX library...

When I add the libraries and include headers I get during compile with platformio:

Code:
Compiling .pio/build/teensylc/FrameworkArduino/HardwareSerial1.cpp.o
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp:30:17: error: 'RwReg' does not name a type
 static volatile RwReg *mosiport, *clkport, *misoport;
                 ^
Compiling .pio/build/teensylc/FrameworkArduino/HardwareSerial2.cpp.o
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp: In function 'void spiSend(uint8_t)':
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp:60:10: error: 'clkport' was not declared in this scope
         *clkport &= ~clkpinmask;
          ^
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp:62:12: error: 'mosiport' was not declared in this scope
           *mosiport |= mosipinmask;
            ^
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp:64:12: error: 'mosiport' was not declared in this scope
           *mosiport &= ~mosipinmask;
            ^
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp:69:8: error: 'clkport' was not declared in this scope
       *clkport &= ~clkpinmask;
        ^
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp: In function 'uint8_t spiRec()':
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp:88:6: error: 'mosiport' was not declared in this scope
     *mosiport |= mosipinmask;
      ^
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp:91:8: error: 'clkport' was not declared in this scope
       *clkport |=  clkpinmask;
        ^
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp:95:13: error: 'misoport' was not declared in this scope
       if ((*misoport) & misopinmask)  data |= 1;
             ^
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp: In member function 'uint8_t Sd2Card::init(uint8_t, uint8_t, int8_t, int8_t, int8_t)':
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp:302:5: error: 'clkport' was not declared in this scope
     clkport     = portOutputRegister(digitalPinToPort(clockPin_));
     ^
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp:304:5: error: 'mosiport' was not declared in this scope
     mosiport    = portOutputRegister(digitalPinToPort(mosiPin_));
     ^
/home/klingler/.platformio/lib/SD_ID161/utility/Sd2Card.cpp:306:5: error: 'misoport' was not declared in this scope
     misoport    = portInputRegister(digitalPinToPort(misoPin_));


Code looks like:

Code:
#include <Arduino.h>
#include <MAX31855.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#include <SPI.h>

int32_t rawData = 0;
MAX31855 myMAX31855(10); //chip select pin, for ESP8266 change to D4 (fails to BOOT/FLASH if pin LOW)

#define TFT_CS  6
#define TFT_DC  7
#define TFT_RST 8

Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);

void setup()
{
  tft.init(240, 320);
  Serial.begin(115200);

  /* start MAX31855 */
  myMAX31855.begin();

  while (myMAX31855.getChipID() != MAX31855_ID)
  {
    Serial.println(F("MAX6675 error")); //(F()) saves string to flash & keeps dynamic memory free
    delay(5000);
  }
  Serial.println(F("MAX6675 OK"));
}

void loop()
{
  while (myMAX31855.detectThermocouple() != MAX31855_THERMOCOUPLE_OK)
  {
    switch (myMAX31855.detectThermocouple())
    {
      case MAX31855_THERMOCOUPLE_SHORT_TO_VCC:
        Serial.println(F("Thermocouple short to VCC"));
        break;

      case MAX31855_THERMOCOUPLE_SHORT_TO_GND:
        Serial.println(F("Thermocouple short to GND"));
        break;

      case MAX31855_THERMOCOUPLE_NOT_CONNECTED:
        Serial.println(F("Thermocouple not connected"));
        break;

      case MAX31855_THERMOCOUPLE_UNKNOWN:
        Serial.println(F("Thermocouple unknown error, check spi cable"));
        break;
    }
    delay(5000);
  }

  rawData = myMAX31855.readRawData();
  Serial.println(myMAX31855.getTemperature(rawData));
  delay(1000);
}

and platform.ini:

Code:
[env:teensylc]
platform = teensy
board = teensylc
framework = arduino
lib_deps = 
	SPI
	Adafruit ST7735 and ST7789 Library
	Adafruit GFX Library


The ST7789 library is though listed as being compatible for the Teensy platform..but maybe not for all boards?


thanks for any pointers....even if I have to dump this display and go for another one (o;
 
Status
Not open for further replies.
Back
Top