Finally got it working with this configuration:
LCD --> Teensy 3.2
vcc --> vin
gnd --> gnd
cs --> 10
reset -- > 7
a0 (dc) --> 8
sda (mosi) --> 11
sck --> 13
led --> 100R --> vin
RFID-RC522 --> Teensy 3.2
vcc --> 3.3v
gnd --> gnd
reset --> 9
miso --> 12
mosi --> 11
sck --> 13
nss (cs) --> 20
Also had to remove the ST7735 lib from the teensy install and use this one instead:
https://github.com/adafruit/Adafruit-ST7735-Library
Final code:
Code:
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#include <MFRC522.h>
#define sclk 13 // SCLK can also use pin 14
#define mosi 11 // MOSI can also use pin 7
#define cs 10 // CS & DC can use pins 2, 6, 9, 10, 15, 20, 21, 22, 23
#define dc 8 // but certain pairs must NOT be used: 2+10, 6+9, 20+23, 21+22
#define rst 7 // RST can use any pin
#define sdcs 4 // CS for SD card, can use any pin
#define RST_PIN 9 //
#define SS_PIN 20 //
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
void setup(void)
{
pinMode(sdcs, INPUT_PULLUP); // don't touch the SD card
pinMode(SS_PIN, OUTPUT);
pinMode(cs, OUTPUT);
Serial.begin(115200);
while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
Serial.println("init lcd");
tft.initR(INITR_BLACKTAB);
tft.fillScreen(ST7735_BLACK);
testdrawtext("I think therefore I am", ST7735_WHITE);
//SPI.begin();
mfrc522.PCD_Init(); // Init MFRC522
mfrc522.PCD_DumpVersionToSerial(); // Show details of PCD - MFRC522 Card Reader details
drawSpeechBubbleWithText("Helloo!");
}
void drawSpeechBubbleWithText(const char *text)
{
tft.fillScreen(ST7735_BLUE);
tft.fillRoundRect(10, 10, 100, 30, 5, ST7735_WHITE);
tft.setCursor(20, 20);
tft.setTextColor(ST7735_BLACK);
tft.setTextWrap(true);
tft.print(text);
}
void loop()
{
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
// Dump debug info about the card; PICC_HaltA() is automatically called
mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}
void testdrawtext(const char *text, uint16_t color) {
tft.setCursor(0, 0);
tft.setTextColor(color);
tft.setTextWrap(true);
tft.print(text);
}
Life is now a wonderful thing again. All is flowers and double rainbows