Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/lcd/eboled.*: lcd - adding support for 128x64 spi oled modules #708

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
14 changes: 13 additions & 1 deletion src/lcd/eboled.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,27 @@ EBOLED::EBOLED(int spi, int CD, int reset) :

setAddressingMode(HORIZONTAL);

#ifdef EBOLED_128X64
//Set Page Address range, required for horizontal addressing mode.
command(CMD_SETPAGEADDRESS); // triple-byte cmd
command(0x00); //Initial page address
command(0x07); //Final page address use all 8 pages
//Set Column Address range, required for horizontal addressing mode.
command(CMD_SETCOLUMNADDRESS); // triple-byte cmd
command(0x00); // this display has no horizontal offset
command(0x7f); // 128 columns wide
#endif // 128x64
#ifndef EBOLED_128X64
//Set Page Address range, required for horizontal addressing mode.
command(CMD_SETPAGEADDRESS); // triple-byte cmd
command(0x00); //Initial page address
command(0x05); //Final page address

//Set Column Address range, required for horizontal addressing mode.
command(CMD_SETCOLUMNADDRESS); // triple-byte cmd
command(0x20); // this display has a horizontal offset of 20 columns
command(0x5f); // 64 columns wide - 0 based 63 offset
#endif // 64X48

}

EBOLED::~EBOLED()
Expand Down
13 changes: 13 additions & 0 deletions src/lcd/eboled.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,30 @@
#define EBOLED_DEFAULT_CD 36
#define EBOLED_DEFAULT_RESET 48

//#define EBOLED_128X64 1
/* uncomment for to work with 128x64 displays
* like https://robu.in/product/0-96-oled-display-module-spii2c-128x64-7-pin-blue/
*
*/
#define swap(a, b) { uint8_t t = a; a = b; b = t; }

namespace upm
{
const uint8_t COLOR_WHITE = 0x01;
const uint8_t COLOR_BLACK = 0x00;
const uint8_t COLOR_XOR = 0x02;
#ifdef EBOLED_128X64
const uint8_t OLED_WIDTH = 0x80; // 128 pixels
const uint8_t VERT_COLUMNS = 0x40; // half width for hi/lo 16bit writes.
const uint8_t OLED_HEIGHT = 0x40; // 64 pixels
const int BUFFER_SIZE = 512;
#endif //EBOLED_128X64
#ifndef EBOLED_128X64 // normal EBOLED screen - 64x48
const uint8_t OLED_WIDTH = 0x40; // 64 pixels
const uint8_t VERT_COLUMNS = 0x20; // half width for hi/lo 16bit writes.
const uint8_t OLED_HEIGHT = 0x30; // 48 pixels
const int BUFFER_SIZE = 192;
#endif //EBOLED 64x48

/**
* @library lcd
Expand Down