Skip to content

Commit 3ca18eb

Browse files
author
Kirk
committed
fixed merge issues
2 parents 70b9c86 + cf4cce5 commit 3ca18eb

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun Qwiic OLED Graphics Library
2-
version=1.0.2
2+
version=1.0.4
33
author=SparkFun Electronics <techsupport@sparkfun.com>
44
maintainer=SparkFun Electronics <sparkfun.com>
55
sentence=Library for SparkFun SSD1306 based OLED display products.

src/SparkFun_Qwiic_OLED.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,12 @@ class QwiicOLEDBaseClass : public Print { // NOTE: implementing Arduino Print
172172
//
173173
// Parameter Description
174174
// --------- -----------------------------
175+
// clearDisplay true - clear the internal buffers during reset
175176
// retval true on success, false on failure
176177

177-
bool reset(void)
178+
bool reset(bool clearDisplay)
178179
{
179-
return m_device.reset();
180+
return m_device.reset(clearDisplay);
180181
}
181182

182183
///////////////////////////////////////////////////////////////////////

src/qwiic_grssd1306.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ bool QwGrSSD1306::init(void)
291291
//
292292
// Returns true on success, false on failure
293293

294-
bool QwGrSSD1306::reset(void)
294+
bool QwGrSSD1306::reset(bool clearDisplay)
295295
{
296296
// If we are not in an init state, just call init
297297
if (!m_isInitialized)
@@ -302,11 +302,11 @@ bool QwGrSSD1306::reset(void)
302302
return false;
303303

304304
// setup oled
305-
setupOLEDDevice();
305+
setupOLEDDevice(clearDisplay);
306306

307307
// Init internal/drawing buffers and device screen buffer
308-
309-
initBuffers();
308+
if(clearDisplay)
309+
initBuffers();
310310

311311
return true;
312312
}
@@ -349,11 +349,16 @@ void QwGrSSD1306::setContrast(uint8_t contrast)
349349
// Method sends the init/setup commands to the OLED device, placing
350350
// it in a state for use by this driver/library.
351351

352-
void QwGrSSD1306::setupOLEDDevice(void)
352+
void QwGrSSD1306::setupOLEDDevice(bool clearDisplay)
353353
{
354354
// Start the device setup - sending commands to device. See command defs in
355355
// header, and device datasheet
356-
sendDevCommand(kCmdDisplayOff);
356+
if(clearDisplay)
357+
sendDevCommand(kCmdDisplayOff);
358+
359+
send_dev_command(kCmdSetDisplayClockDiv, 0x80);
360+
send_dev_command(kCmdSetMultiplex, _viewport.height - 1);
361+
send_dev_command(kCmdSetDisplayOffset, 0x0);
357362

358363
sendDevCommand(kCmdSetDisplayClockDiv, 0x80);
359364
sendDevCommand(kCmdSetMultiplex, m_viewport.height - 1);
@@ -375,7 +380,8 @@ void QwGrSSD1306::setupOLEDDevice(void)
375380
sendDevCommand(kCmdSetVComDeselect, m_initVCOMDeselect);
376381
sendDevCommand(kCmdDeactivateScroll);
377382

378-
sendDevCommand(kCmdDisplayOn);
383+
if(clearDisplay)
384+
sendDevCommand(kCmdDisplayOn);
379385
}
380386
////////////////////////////////////////////////////////////////////////////////////
381387
// setCommBus()

src/qwiic_grssd1306.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ class QwGrSSD1306 : public QwGrBufferDevice {
166166

167167
// Device setup
168168
virtual bool init(void);
169+
169170
bool isInitialized(void) { return m_isInitialized; };
170-
bool reset(void);
171+
bool reset(bool clearDisplay = true);
171172

172173
// method to set the communication bus this object should use
173174
void setCommBus(QwI2C& theBus, uint8_t id_bus);
@@ -236,7 +237,7 @@ class QwGrSSD1306 : public QwGrBufferDevice {
236237
void initBuffers(void); // clear graphics and screen buffer
237238
void clearScreenBuffer(void);
238239
void resendGraphics(void);
239-
void setupOLEDDevice(void);
240+
void setupOLEDDevice(bool clearDisplay = true);
240241

241242
// device communication methods
242243
void sendDevCommand(uint8_t command);

0 commit comments

Comments
 (0)