Switch from custom Aviate OLED library to public Adafruit library for SH1106

master
Steve Lascos 3 days ago
parent 06c50ba38f
commit e59d1bee42
  1. 16
      examples/Tests/Multiverse_BasicDemo/Multiverse_BasicDemo.ino
  2. 4
      examples/Tests/Multiverse_BasicDemo/PhysicalControls.cpp

@ -12,16 +12,16 @@
* *
* REQUIREMENTS: * REQUIREMENTS:
* This demo for Multiverse uses its OLED display which requires several Arduino * This demo for Multiverse uses its OLED display which requires several Arduino
* libraries be downloaded first. The SH1106 library is modifed to work with Teensy * libraries be downloaded first. These can also be installed from the Arduino Libraries
* and must be downloaded from the AviateAudio github link below. * Manager in the Arduino IDE.
* *
* If you do not wish to use the OLED display, or run into difficulties you can * If you do not wish to use the OLED display, or run into difficulties you can
* comment out the #define USE_OLED line in PhysicalControls.h to avoid the need for * comment out the #define USE_OLED line in PhysicalControls.h to avoid the need for
* the Adafruit/Aviate dependencies. * the Adafruit dependencies.
* *
* Adafruit_BusIO : https://github.com/adafruit/Adafruit_BusIO (tested with v1.17) * Adafruit_BusIO : https://github.com/adafruit/Adafruit_BusIO (tested with v1.17)
* Adafruit_GFX_Library : https://github.com/adafruit/Adafruit-GFX-Library (tested with v1.11.11) * Adafruit_GFX_Library : https://github.com/adafruit/Adafruit-GFX-Library (tested with v1.11.11)
* Adafruit_SH1106 : https://github.com/AviateAudio/Adafruit_SH1106 * Adafruit_SH110X : https://github.com/adafruit/Adafruit_SH110x (tested with 2.1.11)
* *
* *
* USAGE INSTRUCTIONS * USAGE INSTRUCTIONS
@ -42,12 +42,12 @@ using namespace BALibrary;
// OLED display stuff // OLED display stuff
#ifdef USE_OLED #ifdef USE_OLED
#include "Adafruit_SH1106.h" #include "Adafruit_SH110X.h"
#include "Adafruit_GFX.h" #include "Adafruit_GFX.h"
#include "Fonts/FreeSansBold9pt7b.h" #include "Fonts/FreeSansBold9pt7b.h"
constexpr unsigned SCREEN_WIDTH = 128; // OLED display width, in pixels constexpr unsigned SCREEN_WIDTH = 128; // OLED display width, in pixels
constexpr unsigned SCREEN_HEIGHT = 64; // OLED display height, in pixels constexpr unsigned SCREEN_HEIGHT = 64; // OLED display height, in pixels
Adafruit_SH1106 display(37, 35, 10); Adafruit_SH1106G display(SCREEN_WIDTH, SCREEN_HEIGHT, &SPI, 37 /*DC*/, 35 /*RST*/, 10 /*CS*/);
#endif // USE_OLED #endif // USE_OLED
// External SPI RAM // External SPI RAM
@ -108,10 +108,10 @@ void setup() {
#ifdef USE_OLED #ifdef USE_OLED
// Init the display // Init the display
display.begin(SH1106_SWITCHCAPVCC, SH1106_I2C_ADDRESS, true); display.begin(0x3C /* SH1106_I2C_ADDRESS */, true);
display.clearDisplay(); display.clearDisplay();
display.display(); display.display();
display.setTextColor(WHITE); // Draw white text display.setTextColor(SH110X_WHITE); // Draw white text
display.setFont(&FreeSansBold9pt7b); display.setFont(&FreeSansBold9pt7b);
drawBlackaddrAudio(); drawBlackaddrAudio();
display.display(); display.display();

@ -1,5 +1,5 @@
#include <cmath> #include <cmath>
#include "Adafruit_SH1106.h" #include "Adafruit_SH110X.h"
#include "BALibrary.h" #include "BALibrary.h"
#include "DebugPrintf.h" #include "DebugPrintf.h"
#include "PhysicalControls.h" #include "PhysicalControls.h"
@ -8,7 +8,7 @@ using namespace BALibrary;
// Declare the externally shared variables from the main .ino // Declare the externally shared variables from the main .ino
#ifdef USE_OLED #ifdef USE_OLED
extern Adafruit_SH1106 display; extern Adafruit_SH1106G display;
#endif #endif
extern BAAudioControlWM8731master codec; extern BAAudioControlWM8731master codec;
extern AudioMixer4 volumeOut; extern AudioMixer4 volumeOut;

Loading…
Cancel
Save