NetBurner 3.5.8
PDF Version
Toggle main menu visibility
qwiic_oledtransp.h
1
// qwiic_oledtransp.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
//
13
//
14
// Written by Kirk Benell @ SparkFun Electronics, March 2022
15
//
16
// This library configures and draws graphics to OLED boards that use the
17
// SSD1306 display hardware. The library only supports I2C.
18
//
19
// Repository:
20
// https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21
//
22
// Documentation:
23
// https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24
//
25
//
26
// SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27
//
28
// SPDX-License-Identifier: MIT
29
//
30
// The MIT License (MIT)
31
//
32
// Copyright (c) 2022 SparkFun Electronics
33
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34
// associated documentation files (the "Software"), to deal in the Software without restriction,
35
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37
// do so, subject to the following conditions:
38
// The above copyright notice and this permission notice shall be included in all copies or substantial
39
// portions of the Software.
40
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41
// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45
46
// Implementation for the Transparent OLED device
47
48
#pragma once
49
50
#include "qwiic_grssd1306.h"
51
53
// Set the defaults for the SparkFun Qwiic MicroOLED
54
55
#define kOLEDTransWidth 128
56
#define kOLEDTransHeight 64
57
58
// The viewport x is off by 2 on this device - starts at value 2
59
#define kOLEDTransXOffset 0
60
#define kOLEDTransYOffset 0
61
62
// Parameters for this device
63
#define kOLEDTransPinConfig 0x12
64
#define kOLEDTransPreCharge 0x25
65
#define kOLEDTransVCOM 0x40
66
67
#define kOLEDTransDefaultAddress 0x3C
68
69
class
QwOLEDTransparent :
public
QwGrSSD1306 {
70
71
public
:
72
// Constructor - setup the viewport and default address for this device.
73
QwOLEDTransparent()
74
: QwGrSSD1306(kOLEDTransXOffset, kOLEDTransYOffset, kOLEDTransWidth, kOLEDTransHeight)
75
{
76
default_address = kOLEDTransDefaultAddress;
77
};
78
79
// set up the specific device settings
80
bool
init
(
void
)
81
{
82
83
setBuffer(m_graphicsBuffer);
// The buffer to use
84
85
setCommPins(kOLEDTransPinConfig);
86
setPreCharge(kOLEDTransPreCharge);
87
setVcomDeselect(kOLEDTransVCOM);
88
89
// Call the super class to do all the work
90
return
this->QwGrSSD1306::init();
91
};
92
93
private
:
94
// Graphics buffer for this device.
95
uint8_t m_graphicsBuffer[kOLEDTransWidth * kOLEDTransHeight / 8];
96
};
init
void init()
System initialization. Ideally called at the beginning of all applications, since the easiest Recover...
examples
I2C
Wire
SparkFunQwiic
OLEDDisplay
src
qwiic_oledtransp.h
Generated by
1.18.0