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

Thread: Something different about Teensy SPI?

Threaded View

  1. #1

    Something different about Teensy SPI?

    This simple sketch works on Arduino UNO but not on Teensy 4.0. On the Teensyit tries to display Hello World but it shows up in the wring place with some of the letters corrupted. I suspect the Teensy's 600 Mhz clock vs UNO's 16 Mhz clock has something to do with it. But what can I do to make it work?

    This is the display and it is in SPI mode.

    #include "Adafruit_HX8357.h"
    #include <Adafruit_GFX.h>    // Core graphics library
    #include "TouchScreen.h"
    // These are the four touchscreen analog pins
    #define YP A2  // must be an analog pin, use "An" notation!
    #define XM A3  // must be an analog pin, use "An" notation!
    #define YM 7   // can be a digital pin
    #define XP 8   // can be a digital pin
    TouchScreen tscr = TouchScreen(XP, YP, XM, YM, 500);
    #define MINPRESSURE 300
    #define MAXPRESSURE 1000
    // The display uses hardware SPI, plus #9 & #10
    #define TFT_RST -1  // dont use a reset pin, tie to arduino RST if you like
    #define TFT_DC 9
    #define TFT_CS 10
    // This is calibration data for the raw touch data to the screen coordinates
    #define TS_MINX 110
    #define TS_MINY 80
    #define TS_MAXX 900
    #define TS_MAXY 940
    Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
    // Colors
    #define BACKGROUND 0xB5B6
    #define HIGHLIGHT 0x0500
    #define TEXTCLR 0x0000
    #define BORDER 0x0000
    #define BUTTON 0xAD75
    #define RED 0xA800
    #define GREEN 0x0360
    #define WHITE 0xFFFF
    void setup()
      tft.print("Hello World");
    void loop()
    Last edited by PickyBiker; 08-09-2020 at 06:55 PM.

Posting Permissions

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