Skip to content
Merged
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
12 changes: 12 additions & 0 deletions src/oled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@ void OLED::display()
i2c_start();
i2c_send(i2c_address << 1); // address + write
i2c_send(0x40); // data
if(usingOffset){
i2c_send(0);
i2c_send(0);
}
for (uint_fast8_t column = 0; column < width; column++)
{
i2c_send(buffer[index++]);
Expand Down Expand Up @@ -987,3 +991,11 @@ void OLED::setTTYMode(bool Enabled)
{
ttyMode=Enabled;
}


void OLED::useOffset(bool offset)
{
if(isSH1106){
usingOffset = offset;
}
}
8 changes: 8 additions & 0 deletions src/oled.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ class OLED : public Print
* Initialize the display controller, clean memory and switch output on.
*/
void begin();

/**
* Will use offset for wired cases when controller uses SSH1106 132x64 but display is 128x64
*/
void useOffset(bool offset=true);

/**
* Enable or disable the charge pump and display output. May be used to save power.
Expand Down Expand Up @@ -336,6 +341,9 @@ class OLED : public Print

/** true=SH1106 controller, false=SSD1306 controller */
const bool isSH1106;

/** Offset for SH1106 132x64 controller with 128x64 matrix */
bool usingOffset;

/** Number of pages in the display and buffer */
const uint_fast8_t pages;
Expand Down