Hi all,
i've been trying to get hardware SPI to work for my SSD1306 (Adafruit Monochrome 1.3" 128x64 OLED graphic display - STEMMA QT / Qwiic) display on a Teensy 3.2 but with no luck. I've been trawling the posts on this forum and looking for alternative pinouts for the 3.2 but with no luck so far. It doesn't help that pins can have different names. Here is the latest code i used.
At the moment i'm just trying to get the hardware SPI working so i can cut down on the time it takes to update a screen. Currently it's 35,000 microseconds (uS) for each update, want to cut that down as much as possible while keeping everything working fine.
I have issues with the screen giving odd looking results sometimes as i have a clock running (using elapsedMillis) which updates the screen on each step (currently 4 times a second) but when i try updating the screen based on external input as well (buttons, encoders), the two updates interfere with each other even though they are both updated in the same function. No matter how i deal with this issue, i still want hardware SPI working with the screen to see the differences, and i have spare pins available to do it.
Any advice on the correct pinout or problems i have with my code would be appreciated.
Cheers
NM
i've been trying to get hardware SPI to work for my SSD1306 (Adafruit Monochrome 1.3" 128x64 OLED graphic display - STEMMA QT / Qwiic) display on a Teensy 3.2 but with no luck. I've been trawling the posts on this forum and looking for alternative pinouts for the 3.2 but with no luck so far. It doesn't help that pins can have different names. Here is the latest code i used.
Code:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <elapsedMillis.h>
#include <EEPROM.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Comment out above, uncomment this block to use hardware SPI
#define OLED_DC 9
#define OLED_CS 10
#define OLED_RESET 14
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &SPI, OLED_DC, OLED_RESET, OLED_CS);
void setup() {
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
// the code then goes on to use the display the same as when i was using it with I2C
}
At the moment i'm just trying to get the hardware SPI working so i can cut down on the time it takes to update a screen. Currently it's 35,000 microseconds (uS) for each update, want to cut that down as much as possible while keeping everything working fine.
I have issues with the screen giving odd looking results sometimes as i have a clock running (using elapsedMillis) which updates the screen on each step (currently 4 times a second) but when i try updating the screen based on external input as well (buttons, encoders), the two updates interfere with each other even though they are both updated in the same function. No matter how i deal with this issue, i still want hardware SPI working with the screen to see the differences, and i have spare pins available to do it.
Any advice on the correct pinout or problems i have with my code would be appreciated.
Cheers
NM