Skip to content

Commit edca24b

Browse files
authored
Merge pull request #11 from sparkfun/Add_Qwiic_OLED_1in3
Add Qwiic OLED 1.3" (Qwiic1in3OLED)
2 parents cfa0bb4 + 1b79646 commit edca24b

File tree

17 files changed

+127
-9
lines changed

17 files changed

+127
-9
lines changed

docs/software.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ The user selects from one of the following classes:
2828
| `QwiicMicroOLED` | [SparkFun Qwiic Micro OLED ]( https://www.sparkfun.com/products/14532)|
2929
| `QwiicNarrowOLED` | [SparkFun Qwiic OLED Display (128x32) ]( https://www.sparkfun.com/products/17153)|
3030
| `QwiicTransparentOLED` | [SparkFun Transparent Graphical OLED]( https://www.sparkfun.com/products/15173)|
31+
| `Qwiic1in3OLED` | [SparkFun Qwiic OLED 1.3" Display (128x32) ]( https://www.sparkfun.com/products/23453)|
3132

3233
For this example, the Qwiic Micro OLED is used.
3334
```C++

examples/Example-01_Hello/Example-01_Hello.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
2121
*/
2222

23-
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_Graphic_OLED
23+
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_OLED
2424

2525
// The Library supports three different types of SparkFun boards. The demo uses the following
2626
// defines to determine which device is being used. Uncomment the device being used for this demo.
2727

2828
QwiicMicroOLED myOLED;
2929
// QwiicTransparentOLED myOLED;
3030
// QwiicNarrowOLED myOLED;
31+
// Qwiic1in3OLED myOLED;
3132

3233

3334
void setup()

examples/Example-02_Shapes/Example-02_Shapes.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@
2525
SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
2626
*/
2727

28-
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_Graphic_OLED
28+
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_OLED
2929

3030
// The Library supports three different types of SparkFun boards. The demo uses the following
3131
// defines to determine which device is being used. Uncomment the device being used for this demo.
3232

3333
QwiicMicroOLED myOLED;
3434
// QwiicTransparentOLED myOLED;
3535
// QwiicNarrowOLED myOLED;
36+
// Qwiic1in3OLED myOLED;
3637

3738
// Global variables - used to stash our screen size
3839

examples/Example-03_Bitmap/Example-03_Bitmap.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@
2525
SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
2626
*/
2727

28-
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_Graphic_OLED
28+
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_OLED
2929

3030
// The Library supports three different types of SparkFun boards. The demo uses the following
3131
// defines to determine which device is being used. Uncomment the device being used for this demo.
3232

3333
QwiicMicroOLED myOLED;
3434
// QwiicTransparentOLED myOLED;
3535
// QwiicNarrowOLED myOLED;
36+
// Qwiic1in3OLED myOLED;
3637

3738
// Let's draw a truck - use our built in bitmap
3839
#include "res/qw_bmp_truck.h"

examples/Example-04_Text/Example-04_Text.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@
2525
SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
2626
*/
2727

28-
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_Graphic_OLED
28+
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_OLED
2929

3030
// The Library supports three different types of SparkFun boards. The demo uses the following
3131
// defines to determine which device is being used. Uncomment the device being used for this demo.
3232

3333
QwiicMicroOLED myOLED;
3434
// QwiicTransparentOLED myOLED;
3535
// QwiicNarrowOLED myOLED;
36+
// Qwiic1in3OLED myOLED;
3637

3738
// Fonts
3839
#include <res/qw_fnt_5x7.h>

examples/Example-05_ScrollFlip/Example-05_ScrollFlip.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
2828
*/
2929

30-
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_Graphic_OLED
30+
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_OLED
3131

3232
// The Library supports three different types of SparkFun boards. The demo uses the following
3333
// defines to determine which device is being used. Uncomment the device being used for this demo.
3434

3535
QwiicMicroOLED myOLED;
3636
// QwiicTransparentOLED myOLED;
3737
// QwiicNarrowOLED myOLED;
38+
// Qwiic1in3OLED myOLED;
3839

3940
int yoffset;
4041

examples/Example-06_Clock/Example-06_Clock.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
2828
*/
2929

30-
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_Graphic_OLED
30+
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_OLED
3131

3232
// The Library supports three different types of SparkFun boards. The demo uses the following
3333
// defines to determine which device is being used. Uncomment the device being used for this demo.
3434

3535
QwiicMicroOLED myOLED;
3636
// QwiicTransparentOLED myOLED;
3737
// QwiicNarrowOLED myOLED;
38+
// Qwiic1in3OLED myOLED;
3839

3940
// Use these variables to set the initial time
4041
int hours = 11;

examples/Example-07_Cube/Example-07_Cube.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626
2727
SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
2828
*/
29-
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_Graphic_OLED
29+
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_OLED
3030

3131
// The Library supports three different types of SparkFun boards. The demo uses the following
3232
// defines to determine which device is being used. Uncomment the device being used for this demo.
3333

3434
QwiicMicroOLED myOLED;
3535
// QwiicTransparentOLED myOLED;
3636
// QwiicNarrowOLED myOLED;
37+
// Qwiic1in3OLED myOLED;
3738

3839
int width;
3940
int height;

examples/Example-08_Multi/Example-08_Multi.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626
SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
2727
*/
2828

29-
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_Graphic_OLED
29+
#include <SparkFun_Qwiic_OLED.h> //http://librarymanager/All#SparkFun_Qwiic_OLED
3030

3131
// The Library supports three different types of SparkFun boards. The demo uses the following
3232
// defines to determine which device is being used. Uncomment the device being used for this demo.
3333

3434
QwiicMicroOLED myOLED;
3535
// QwiicTransparentOLED myOLED;
3636
// QwiicNarrowOLED myOLED;
37+
// Qwiic1in3OLED myOLED;
3738

3839
int width;
3940
int height;

examples/docs/ex_01_hello.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ The user selects from one of the following classes:
2626
| `QwiicMicroOLED` | [SparkFun Qwiic Micro OLED ]( https://www.sparkfun.com/products/14532)|
2727
| `QwiicNarrowOLED` | [SparkFun Qwiic OLED Display (128x32) ]( https://www.sparkfun.com/products/17153)|
2828
| `QwiicTransparentOLED` | [SparkFun Transparent Graphical OLED]( https://www.sparkfun.com/products/15173)|
29+
| `Qwiic1in3OLED` | [SparkFun Qwiic OLED 1.3" Display (128x32) ]( https://www.sparkfun.com/products/23453)|
2930

3031
The Example code supports all of the SparkFun Qwiic OLED boards. To select the board being used, uncomment the `#define` for the demo board.
3132

examples/docs/ex_02_lines.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The user selects from one of the following classes:
2525
| `QwiicMicroOLED` | [SparkFun Qwiic Micro OLED ]( https://www.sparkfun.com/products/14532)|
2626
| `QwiicNarrowOLED` | [SparkFun Qwiic OLED Display (128x32) ]( https://www.sparkfun.com/products/17153)|
2727
| `QwiicTransparentOLED` | [SparkFun Transparent Graphical OLED]( https://www.sparkfun.com/products/15173)|
28+
| `Qwiic1in3OLED` | [SparkFun Qwiic OLED 1.3" Display (128x32) ]( https://www.sparkfun.com/products/23453)|
2829

2930
The Example code supports all of the SparkFun Qwiic OLED boards. To select the board being used, uncomment the `#define` for the demo board.
3031

examples/docs/ex_03_bitmaps.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The user selects from one of the following classes:
2525
| `QwiicMicroOLED` | [SparkFun Qwiic Micro OLED ]( https://www.sparkfun.com/products/14532)|
2626
| `QwiicNarrowOLED` | [SparkFun Qwiic OLED Display (128x32) ]( https://www.sparkfun.com/products/17153)|
2727
| `QwiicTransparentOLED` | [SparkFun Transparent Graphical OLED]( https://www.sparkfun.com/products/15173)|
28+
| `Qwiic1in3OLED` | [SparkFun Qwiic OLED 1.3" Display (128x32) ]( https://www.sparkfun.com/products/23453)|
2829

2930
The Example code supports all of the SparkFun Qwiic OLED boards. To select the board being used, uncomment the `#define` for the demo board.
3031

examples/docs/ex_04_text.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The user selects from one of the following classes:
2525
| `QwiicMicroOLED` | [SparkFun Qwiic Micro OLED ]( https://www.sparkfun.com/products/14532)|
2626
| `QwiicNarrowOLED` | [SparkFun Qwiic OLED Display (128x32) ]( https://www.sparkfun.com/products/17153)|
2727
| `QwiicTransparentOLED` | [SparkFun Transparent Graphical OLED]( https://www.sparkfun.com/products/15173)|
28+
| `Qwiic1in3OLED` | [SparkFun Qwiic OLED 1.3" Display (128x32) ]( https://www.sparkfun.com/products/23453)|
2829

2930
The Example code supports all of the SparkFun Qwiic OLED boards. To select the board being used, uncomment the `#define` for the demo board.
3031

keywords.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
QwiicTransparentOLED KEYWORD1
1010
QwiicNarrowOLED KEYWORD1
1111
QwiicMicroOLED KEYWORD1
12+
Qwiic1in3OLED KEYWORD1
1213
QwiicFont KEYWORD1
1314
grRasterOp_t KEYWORD1
1415

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun Qwiic OLED Arduino Library
2-
version=1.0.6
2+
version=1.0.8
33
author=SparkFun Electronics <[email protected]>
44
maintainer=SparkFun Electronics <sparkfun.com>
55
sentence=Library for SparkFun SSD1306 based OLED display products.

src/SparkFun_Qwiic_OLED.h

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include "qwiic_oledmicro.h"
5353
#include "qwiic_olednarrow.h"
5454
#include "qwiic_oledtransp.h"
55+
#include "qwiic_oled_1in3.h"
5556

5657
#include <Arduino.h>
5758
#include <Wire.h>
@@ -831,3 +832,7 @@ class QwiicNarrowOLED : public QwiicOLEDBaseClass<QwOLEDNarrow> {
831832
class QwiicTransparentOLED : public QwiicOLEDBaseClass<QwOLEDTransparent> {
832833
// nothing here - see above
833834
};
835+
836+
class Qwiic1in3OLED : public QwiicOLEDBaseClass<QwOLED1in3> {
837+
// nothing here - see above
838+
};

src/qwiic_oled_1in3.h

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// qwiic_oled_1in3.h
2+
//
3+
// This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4+
//
5+
// SparkFun sells these at its website: www.sparkfun.com
6+
//
7+
// Do you like this library? Help support SparkFun. Buy a board!
8+
//
9+
// Micro OLED https://www.sparkfun.com/products/14532
10+
// Transparent OLED https://www.sparkfun.com/products/15173
11+
// "Narrow" OLED https://www.sparkfun.com/products/17153
12+
// 1.3" OLED https://www.sparkfun.com/products/23453
13+
//
14+
//
15+
// Written by Kirk Benell @ SparkFun Electronics, March 2022
16+
//
17+
// This library configures and draws graphics to OLED boards that use the
18+
// SSD1306 display hardware. The library only supports I2C.
19+
//
20+
// Repository:
21+
// https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
22+
//
23+
// Documentation:
24+
// https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
25+
//
26+
//
27+
// SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
28+
//
29+
// SPDX-License-Identifier: MIT
30+
//
31+
// The MIT License (MIT)
32+
//
33+
// Copyright (c) 2022 SparkFun Electronics
34+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
35+
// associated documentation files (the "Software"), to deal in the Software without restriction,
36+
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
37+
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
38+
// do so, subject to the following conditions:
39+
// The above copyright notice and this permission notice shall be included in all copies or substantial
40+
// portions of the Software.
41+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
42+
// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
43+
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
45+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46+
47+
// Implementation for the 1.3" OLED device
48+
49+
#pragma once
50+
51+
#include "qwiic_grssd1306.h"
52+
53+
//////////////////////////////////////////////////////////////////
54+
// Set the defaults for the SparkFun Qwiic MicroOLED
55+
56+
#define kOLED1in3Width 128
57+
#define kOLED1in3Height 64
58+
59+
#define kOLED1in3XOffset 0
60+
#define kOLED1in3YOffset 0
61+
62+
// Parameters for this device
63+
#define kOLED1in3PinConfig 0x12
64+
#define kOLED1in3PreCharge 0xF1
65+
#define kOLED1in3VCOM 0x40
66+
#define kOLED1in3Contrast 0xCF
67+
68+
#define kOLED1in3DefaultAddress 0x3D
69+
#define kOLED1in3AltAddress 0x3C
70+
71+
class QwOLED1in3 : public QwGrSSD1306 {
72+
73+
public:
74+
// Constructor - setup the viewport and default address for this device.
75+
QwOLED1in3()
76+
: QwGrSSD1306(kOLED1in3XOffset, kOLED1in3YOffset, kOLED1in3Width, kOLED1in3Height)
77+
{
78+
default_address = kOLED1in3DefaultAddress;
79+
};
80+
81+
// set up the specific device settings
82+
bool init(void)
83+
{
84+
85+
setBuffer(m_graphicsBuffer); // The buffer to use
86+
87+
setCommPins(kOLED1in3PinConfig);
88+
setPreCharge(kOLED1in3PreCharge);
89+
setVcomDeselect(kOLED1in3VCOM);
90+
setContrast(kOLED1in3Contrast);
91+
92+
// Call the super class to do all the work
93+
return this->QwGrSSD1306::init();
94+
};
95+
96+
private:
97+
// Graphics buffer for this device.
98+
uint8_t m_graphicsBuffer[kOLED1in3Width * kOLED1in3Height / 8];
99+
};

0 commit comments

Comments
 (0)