Skip to content
Snippets Groups Projects
Commit 9790e131 authored by Daniel Eichhorn's avatar Daniel Eichhorn
Browse files

Add constructor overloading for backwards compatibility

parent 19b07d88
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,10 @@ class SH1106Brzo : public OLEDDisplay {
uint8_t _scl;
public:
SH1106Brzo(uint8_t _address, uint8_t _sda, uint8_t _scl) : SH1106Brzo(GEOMETRY_128_64, _address, _sda, _scl) {
}
SH1106Brzo(OLEDDISPLAY_GEOMETRY g, uint8_t _address, uint8_t _sda, uint8_t _scl) {
this->geometry = g;
if (g == GEOMETRY_128_64) {
......@@ -53,7 +57,7 @@ class SH1106Brzo : public OLEDDisplay {
} else if (g == GEOMETRY_128_32) {
this->displayWidth = 128;
this->displayHeight = 32;
this->displayBufferSize = 512;
this->displayBufferSize = 512;
}
this->_address = _address;
......@@ -100,7 +104,7 @@ class SH1106Brzo : public OLEDDisplay {
uint8_t sendBuffer[17];
sendBuffer[0] = 0x40;
// Calculate the colum offset
// Calculate the colum offset
uint8_t minBoundXp2H = (minBoundX + 2) & 0x0F;
uint8_t minBoundXp2L = 0x10 | ((minBoundX + 2) >> 4 );
......
......@@ -37,8 +37,11 @@ class SH1106Spi : public OLEDDisplay {
uint8_t _dc;
public:
SH1106Spi(uint8_t _rst, uint8_t _dc) : SH1106Spi(GEOMETRY_128_64, _rst, _dc) {
SH1106Spi(OLEDDISPLAY_GEOMETRY g, uint8_t _rst, uint8_t _dc) {
}
SH1106Spi(OLEDDISPLAY_GEOMETRY g, uint8_t _rst, uint8_t _dc) {
this->geometry = g;
if (g == GEOMETRY_128_64) {
this->displayWidth = 128;
......@@ -47,7 +50,7 @@ class SH1106Spi : public OLEDDisplay {
} else if (g == GEOMETRY_128_32) {
this->displayWidth = 128;
this->displayHeight = 32;
this->displayBufferSize = 512;
this->displayBufferSize = 512;
}
this->_rst = _rst;
......
......@@ -44,7 +44,11 @@ class SH1106Wire : public OLEDDisplay {
uint8_t _scl;
public:
SH1106Wire(OLEDDISPLAY_GEOMETRY g, uint8_t _address, uint8_t _sda, uint8_t _scl) {
SH1106Wire(uint8_t _address, uint8_t _sda, uint8_t _scl) : SH1106Wire(GEOMETRY_128_64, _address, _sda, _scl) {
}
SH1106Wire(OLEDDISPLAY_GEOMETRY g, uint8_t _address, uint8_t _sda, uint8_t _scl) {
this->geometry = g;
if (g == GEOMETRY_128_64) {
this->displayWidth = 128;
......@@ -53,7 +57,7 @@ class SH1106Wire : public OLEDDisplay {
} else if (g == GEOMETRY_128_32) {
this->displayWidth = 128;
this->displayHeight = 32;
this->displayBufferSize = 512;
this->displayBufferSize = 512;
}
this->_address = _address;
......
......@@ -44,6 +44,10 @@ class SSD1306Brzo : public OLEDDisplay {
uint8_t _scl;
public:
SSD1306Brzo(uint8_t _address, uint8_t _sda, uint8_t _scl) : SSD1306Brzo(GEOMETRY_128_64, _address, _sda, _scl) {
}
SSD1306Brzo(OLEDDISPLAY_GEOMETRY g, uint8_t _address, uint8_t _sda, uint8_t _scl) {
this->geometry = g;
if (g == GEOMETRY_128_64) {
......@@ -53,7 +57,7 @@ class SSD1306Brzo : public OLEDDisplay {
} else if (g == GEOMETRY_128_32) {
this->displayWidth = 128;
this->displayHeight = 32;
this->displayBufferSize = 512;
this->displayBufferSize = 512;
}
this->_address = _address;
......@@ -130,7 +134,7 @@ class SSD1306Brzo : public OLEDDisplay {
sendCommand(PAGEADDR);
sendCommand(0x0);
if (geometry == GEOMETRY_128_64) {
sendCommand(0x7);
} else if (geometry == GEOMETRY_128_32) {
......
......@@ -44,6 +44,10 @@ class SSD1306Spi : public OLEDDisplay {
uint8_t _cs;
public:
SSD1306Spi(uint8_t _rst, uint8_t _dc, uint8_t _cs) : SSD1306Spi(GEOMETRY_128_64, _rst, _dc, _cs) {
}
SSD1306Spi(OLEDDISPLAY_GEOMETRY g, uint8_t _rst, uint8_t _dc, uint8_t _cs) {
this->geometry = g;
if (g == GEOMETRY_128_64) {
......@@ -53,9 +57,9 @@ class SSD1306Spi : public OLEDDisplay {
} else if (g == GEOMETRY_128_32) {
this->displayWidth = 128;
this->displayHeight = 32;
this->displayBufferSize = 512;
this->displayBufferSize = 512;
}
this->_rst = _rst;
this->_dc = _dc;
this->_cs = _cs;
......
......@@ -38,6 +38,10 @@ class SSD1306Wire : public OLEDDisplay {
uint8_t _scl;
public:
SSD1306Wire(uint8_t _address, uint8_t _sda, uint8_t _scl) : SSD1306Wire(GEOMETRY_128_64, _address, _sda, _scl) {
}
SSD1306Wire(OLEDDISPLAY_GEOMETRY g, uint8_t _address, uint8_t _sda, uint8_t _scl) {
this->geometry = g;
if (g == GEOMETRY_128_64) {
......@@ -47,7 +51,7 @@ class SSD1306Wire : public OLEDDisplay {
} else if (g == GEOMETRY_128_32) {
this->displayWidth = 128;
this->displayHeight = 32;
this->displayBufferSize = 512;
this->displayBufferSize = 512;
}
this->_address = _address;
......@@ -129,7 +133,7 @@ class SSD1306Wire : public OLEDDisplay {
sendCommand(PAGEADDR);
sendCommand(0x0);
if (geometry == GEOMETRY_128_64) {
sendCommand(0x7);
} else if (geometry == GEOMETRY_128_32) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment