Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/Example-01_Hello/Example-01_Hello.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Transparent OLED https://www.sparkfun.com/products/15173
"Narrow" OLED https://www.sparkfun.com/products/24606
Qwiic OLED 1.3in https://www.sparkfun.com/products/23453
Qwiic OLED 1.5in https://www.sparkfun.com/products/29530
Written by Kirk Benell @ SparkFun Electronics, March 2022
Expand All @@ -30,7 +31,7 @@ QwiicMicroOLED myOLED;
//QwiicTransparentOLED myOLED;
//QwiicNarrowOLED myOLED;
//Qwiic1in3OLED myOLED;

//Qwiic1in5OLED myOLED;

void setup()
{
Expand Down
2 changes: 2 additions & 0 deletions examples/Example-02_Shapes/Example-02_Shapes.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Transparent OLED https://www.sparkfun.com/products/15173
"Narrow" OLED https://www.sparkfun.com/products/24606
Qwiic OLED 1.3in https://www.sparkfun.com/products/23453
Qwiic OLED 1.5in https://www.sparkfun.com/products/29530
Written by Kirk Benell @ SparkFun Electronics, March 2022
Expand All @@ -35,6 +36,7 @@ QwiicMicroOLED myOLED;
//QwiicTransparentOLED myOLED;
//QwiicNarrowOLED myOLED;
//Qwiic1in3OLED myOLED;
//Qwiic1in5OLED myOLED;

// Global variables - used to stash our screen size

Expand Down
2 changes: 2 additions & 0 deletions examples/Example-03_Bitmap/Example-03_Bitmap.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Transparent OLED https://www.sparkfun.com/products/15173
"Narrow" OLED https://www.sparkfun.com/products/24606
Qwiic OLED 1.3in https://www.sparkfun.com/products/23453
Qwiic OLED 1.5in https://www.sparkfun.com/products/29530
Written by Kirk Benell @ SparkFun Electronics, March 2022
Expand All @@ -35,6 +36,7 @@ QwiicMicroOLED myOLED;
//QwiicTransparentOLED myOLED;
//QwiicNarrowOLED myOLED;
//Qwiic1in3OLED myOLED;
//Qwiic1in5OLED myOLED;

// Let's draw a truck - use our built in bitmap
#include "res/qw_bmp_truck.h"
Expand Down
2 changes: 2 additions & 0 deletions examples/Example-04_Text/Example-04_Text.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Transparent OLED https://www.sparkfun.com/products/15173
"Narrow" OLED https://www.sparkfun.com/products/24606
Qwiic OLED 1.3in https://www.sparkfun.com/products/23453
Qwiic OLED 1.5in https://www.sparkfun.com/products/29530
Written by Kirk Benell @ SparkFun Electronics, March 2022
Expand All @@ -35,6 +36,7 @@ QwiicMicroOLED myOLED;
//QwiicTransparentOLED myOLED;
//QwiicNarrowOLED myOLED;
//Qwiic1in3OLED myOLED;
//Qwiic1in5OLED myOLED;

// Fonts
#include <res/qw_fnt_5x7.h>
Expand Down
19 changes: 13 additions & 6 deletions examples/Example-05_ScrollFlip/Example-05_ScrollFlip.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Transparent OLED https://www.sparkfun.com/products/15173
"Narrow" OLED https://www.sparkfun.com/products/24606
Qwiic OLED 1.3in https://www.sparkfun.com/products/23453
Qwiic OLED 1.5in https://www.sparkfun.com/products/29530
Written by Kirk Benell @ SparkFun Electronics, March 2022
Expand All @@ -37,32 +38,38 @@ QwiicMicroOLED myOLED;
//QwiicTransparentOLED myOLED;
//QwiicNarrowOLED myOLED;
//Qwiic1in3OLED myOLED;
//Qwiic1in5OLED myOLED;

// Get the end page based on the type of myOLED. If it is 1.5" OLED with 128 rows (15 pages),
// the end page is 15 otherwise we'll pass 7 (for displays with only 64 rows)
int endPage = 7;
// int endPage = 15; // Only use for 1.5" OLED

int yoffset;

// Our testing functions
void scrollRight(void)
{
myOLED.scrollStop();
myOLED.scrollRight(0, 7, SCROLL_INTERVAL_2_FRAMES);
myOLED.scrollRight(0, endPage, SCROLL_INTERVAL_2_FRAMES);
}

void scrollRightVertical(void)
{
myOLED.scrollStop();
myOLED.scrollVertRight(0, 7, SCROLL_INTERVAL_3_FRAMES);
myOLED.scrollVertRight(0, endPage, SCROLL_INTERVAL_3_FRAMES);
}

void scrollLeft(void)
{
myOLED.scrollStop();
myOLED.scrollLeft(0, 7, SCROLL_INTERVAL_4_FRAMES);
myOLED.scrollLeft(0, endPage, SCROLL_INTERVAL_4_FRAMES);
}

void scrollLeftVertical(void)
{
myOLED.scrollStop();
myOLED.scrollVertLeft(0, 7, SCROLL_INTERVAL_5_FRAMES);
myOLED.scrollVertLeft(0, endPage, SCROLL_INTERVAL_5_FRAMES);
}

void scrollStop(void)
Expand Down Expand Up @@ -107,9 +114,9 @@ typedef struct _testRoutines

static const testRoutine testFunctions[] = {
{scrollRight, "Right>"},
{scrollRightVertical, "^Right-Up>"},
{scrollRightVertical, "^Vertical-Mode1>"}, // Right-Up for most displays, Up for 1.5" display
{scrollLeft, "<Left"},
{scrollLeftVertical, "<Left-Up^"},
{scrollLeftVertical, "<Vertical-Mode2^"}, // Left-Up for most displays, Down for 1.5" display
{scrollStop, "<STOP>"},
{flipHorizontal, "-Flip-Horz-"},
{flipVertical, "|Flip-Vert|"},
Expand Down
2 changes: 2 additions & 0 deletions examples/Example-06_Clock/Example-06_Clock.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Transparent OLED https://www.sparkfun.com/products/15173
"Narrow" OLED https://www.sparkfun.com/products/24606
Qwiic OLED 1.3in https://www.sparkfun.com/products/23453
Qwiic OLED 1.5in https://www.sparkfun.com/products/29530
Written by
Jim Lindblom @ SparkFun Electronics
Expand All @@ -37,6 +38,7 @@ QwiicMicroOLED myOLED;
//QwiicTransparentOLED myOLED;
//QwiicNarrowOLED myOLED;
//Qwiic1in3OLED myOLED;
//Qwiic1in5OLED myOLED;

// Use these variables to set the initial time
int hours = 11;
Expand Down
2 changes: 2 additions & 0 deletions examples/Example-07_Cube/Example-07_Cube.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Transparent OLED https://www.sparkfun.com/products/15173
"Narrow" OLED https://www.sparkfun.com/products/24606
Qwiic OLED 1.3in https://www.sparkfun.com/products/23453
Qwiic OLED 1.5in https://www.sparkfun.com/products/29530
Written by
Jim Lindblom @ SparkFun Electronics
Expand All @@ -36,6 +37,7 @@ QwiicMicroOLED myOLED;
//QwiicTransparentOLED myOLED;
//QwiicNarrowOLED myOLED;
//Qwiic1in3OLED myOLED;
//Qwiic1in5OLED myOLED;

int width;
int height;
Expand Down
2 changes: 2 additions & 0 deletions examples/Example-08_Multi/Example-08_Multi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Transparent OLED https://www.sparkfun.com/products/15173
"Narrow" OLED https://www.sparkfun.com/products/24606
Qwiic OLED 1.3in https://www.sparkfun.com/products/23453
Qwiic OLED 1.5in https://www.sparkfun.com/products/29530
Updated from example writtin by Paul Clark @ SparkFun Electronics
Original Creation Date: December 11th, 2020
Expand All @@ -36,6 +37,7 @@ QwiicMicroOLED myOLED;
//QwiicTransparentOLED myOLED;
//QwiicNarrowOLED myOLED;
//Qwiic1in3OLED myOLED;
//Qwiic1in5OLED myOLED;

int width;
int height;
Expand Down
26 changes: 16 additions & 10 deletions src/SparkFun_Qwiic_OLED.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
// for the Qwiic OLED driver.

// include the underlying SDK implementation headers for the OLED devices
#include "qwiic_oled_1in5.h"
#include "qwiic_oled_1in3.h"
#include "qwiic_oled_custom.h"
#include "qwiic_oledmicro.h"
Expand Down Expand Up @@ -83,11 +84,11 @@ typedef QwBitmap QwiicBitmap;

// Define the template and fill in the interface methods in-line.

template <typename SSD1306DeviceType> class QwiicOLEDBaseClass : public Print // NOTE: implementing Arduino Print
template <typename DeviceType> class QwiicOLEDBaseClass : public Print // NOTE: implementing Arduino Print
{
protected:
// our device driver
SSD1306DeviceType m_device;
DeviceType m_device;

private:
QwI2C m_i2cBus; // our i2c object
Expand Down Expand Up @@ -275,8 +276,8 @@ template <typename SSD1306DeviceType> class QwiicOLEDBaseClass : public Print //
//
// Parameter Description
// --------- -----------------------------
// start The start page address of the scroll - valid values are 0 thru 7
// stop The stop/end page address of the scroll - valid values are 0 thru 7
// start The start page address of the scroll - valid values are 0 thru 15 (only 0 thru 7 valid for most small displays w/ SSD1306)
// stop The stop/end page address of the scroll - valid values are 0 thru 15 (only 0 thru 7 valid for most small displays w/ SSD1306)
// interval The time interval between scroll step - values listed below
//
// Defined values for the interval parameter:
Expand Down Expand Up @@ -307,8 +308,8 @@ template <typename SSD1306DeviceType> class QwiicOLEDBaseClass : public Print //
//
// Parameter Description
// --------- -----------------------------
// start The start page address of the scroll - valid values are 0 thru 7
// stop The stop/end page address of the scroll - valid values are 0 thru 7
// start The start page address of the scroll - valid values are 0 thru 15 (only 0 thru 7 valid for most small displays w/ SSD1306)
// stop The stop/end page address of the scroll - valid values are 0 thru 15 (only 0 thru 7 valid for most small displays w/ SSD1306)
// interval The time interval between scroll step - values listed in scrollRight()

void scrollVertRight(uint8_t start, uint8_t stop, uint8_t interval)
Expand All @@ -326,8 +327,8 @@ template <typename SSD1306DeviceType> class QwiicOLEDBaseClass : public Print //
//
// Parameter Description
// --------- -----------------------------
// start The start page address of the scroll - valid values are 0 thru 7
// stop The stop/end page address of the scroll - valid values are 0 thru 7
// start The start page address of the scroll - valid values are 0 thru 15 (only 0 thru 7 valid for most small displays w/ SSD1306)
// stop The stop/end page address of the scroll - valid values are 0 thru 15 (only 0 thru 7 valid for most small displays w/ SSD1306)
// interval The time interval between scroll step - values listed in scrollRight()

void scrollLeft(uint8_t start, uint8_t stop, uint8_t interval)
Expand All @@ -345,8 +346,8 @@ template <typename SSD1306DeviceType> class QwiicOLEDBaseClass : public Print //
//
// Parameter Description
// --------- -----------------------------
// start The start page address of the scroll - valid values are 0 thru 7
// stop The stop/end page address of the scroll - valid values are 0 thru 7
// start The start page address of the scroll - valid values are 0 thru 15 (only 0 thru 7 valid for most small displays w/ SSD1306)
// stop The stop/end page address of the scroll - valid values are 0 thru 15 (only 0 thru 7 valid for most small displays w/ SSD1306)
// interval The time interval between scroll step - values listed in scrollRight()

void scrollVertLeft(uint8_t start, uint8_t stop, uint8_t interval)
Expand Down Expand Up @@ -845,6 +846,11 @@ class Qwiic1in3OLED : public QwiicOLEDBaseClass<QwOLED1in3>
// nothing here - see above
};

class Qwiic1in5OLED : public QwiicOLEDBaseClass<QwOLED1in5>
{
// nothing here - see above
};

class QwiicCustomOLED : public QwiicOLEDBaseClass<QwOLEDCustom>
{
public:
Expand Down
Loading