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

Fix broken reset logic if reset pin exceeds 127 due to int8 overflow #20

Merged
merged 1 commit into from
Sep 11, 2024
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: 6 additions & 6 deletions Adafruit_SH1106G.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
allocation is performed there!
*/
Adafruit_SH1106G::Adafruit_SH1106G(uint16_t w, uint16_t h, TwoWire *twi,
int8_t rst_pin, uint32_t clkDuring,
int16_t rst_pin, uint32_t clkDuring,
uint32_t clkAfter)
: Adafruit_SH110X(w, h, twi, rst_pin, clkDuring, clkAfter) {}

Expand Down Expand Up @@ -71,9 +71,9 @@ Adafruit_SH1106G::Adafruit_SH1106G(uint16_t w, uint16_t h, TwoWire *twi,
@note Call the object's begin() function before use -- buffer
allocation is performed there!
*/
Adafruit_SH1106G::Adafruit_SH1106G(uint16_t w, uint16_t h, int8_t mosi_pin,
int8_t sclk_pin, int8_t dc_pin,
int8_t rst_pin, int8_t cs_pin)
Adafruit_SH1106G::Adafruit_SH1106G(uint16_t w, uint16_t h, int16_t mosi_pin,
int16_t sclk_pin, int16_t dc_pin,
int16_t rst_pin, int16_t cs_pin)
: Adafruit_SH110X(w, h, mosi_pin, sclk_pin, dc_pin, rst_pin, cs_pin) {}

/*!
Expand Down Expand Up @@ -102,8 +102,8 @@ Adafruit_SH1106G::Adafruit_SH1106G(uint16_t w, uint16_t h, int8_t mosi_pin,
allocation is performed there!
*/
Adafruit_SH1106G::Adafruit_SH1106G(uint16_t w, uint16_t h, SPIClass *spi,
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin,
uint32_t bitrate)
int16_t dc_pin, int16_t rst_pin,
int16_t cs_pin, uint32_t bitrate)
: Adafruit_SH110X(w, h, spi, dc_pin, rst_pin, cs_pin, bitrate) {}

/*!
Expand Down
12 changes: 6 additions & 6 deletions Adafruit_SH1107.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
allocation is performed there!
*/
Adafruit_SH1107::Adafruit_SH1107(uint16_t w, uint16_t h, TwoWire *twi,
int8_t rst_pin, uint32_t clkDuring,
int16_t rst_pin, uint32_t clkDuring,
uint32_t clkAfter)
: Adafruit_SH110X(w, h, twi, rst_pin, clkDuring, clkAfter) {}

Expand Down Expand Up @@ -71,9 +71,9 @@ Adafruit_SH1107::Adafruit_SH1107(uint16_t w, uint16_t h, TwoWire *twi,
@note Call the object's begin() function before use -- buffer
allocation is performed there!
*/
Adafruit_SH1107::Adafruit_SH1107(uint16_t w, uint16_t h, int8_t mosi_pin,
int8_t sclk_pin, int8_t dc_pin, int8_t rst_pin,
int8_t cs_pin)
Adafruit_SH1107::Adafruit_SH1107(uint16_t w, uint16_t h, int16_t mosi_pin,
int16_t sclk_pin, int16_t dc_pin,
int16_t rst_pin, int16_t cs_pin)
: Adafruit_SH110X(w, h, mosi_pin, sclk_pin, dc_pin, rst_pin, cs_pin) {}

/*!
Expand Down Expand Up @@ -102,8 +102,8 @@ Adafruit_SH1107::Adafruit_SH1107(uint16_t w, uint16_t h, int8_t mosi_pin,
allocation is performed there!
*/
Adafruit_SH1107::Adafruit_SH1107(uint16_t w, uint16_t h, SPIClass *spi,
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin,
uint32_t bitrate)
int16_t dc_pin, int16_t rst_pin,
int16_t cs_pin, uint32_t bitrate)
: Adafruit_SH110X(w, h, spi, dc_pin, rst_pin, cs_pin, bitrate) {}

/*!
Expand Down
12 changes: 6 additions & 6 deletions Adafruit_SH110X.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
allocation is performed there!
*/
Adafruit_SH110X::Adafruit_SH110X(uint16_t w, uint16_t h, TwoWire *twi,
int8_t rst_pin, uint32_t clkDuring,
int16_t rst_pin, uint32_t clkDuring,
uint32_t clkAfter)
: Adafruit_GrayOLED(1, w, h, twi, rst_pin, clkDuring, clkAfter) {}

Expand Down Expand Up @@ -104,9 +104,9 @@ Adafruit_SH110X::Adafruit_SH110X(uint16_t w, uint16_t h, TwoWire *twi,
@note Call the object's begin() function before use -- buffer
allocation is performed there!
*/
Adafruit_SH110X::Adafruit_SH110X(uint16_t w, uint16_t h, int8_t mosi_pin,
int8_t sclk_pin, int8_t dc_pin, int8_t rst_pin,
int8_t cs_pin)
Adafruit_SH110X::Adafruit_SH110X(uint16_t w, uint16_t h, int16_t mosi_pin,
int16_t sclk_pin, int16_t dc_pin,
int16_t rst_pin, int16_t cs_pin)
: Adafruit_GrayOLED(1, w, h, mosi_pin, sclk_pin, dc_pin, rst_pin, cs_pin) {}

/*!
Expand Down Expand Up @@ -135,8 +135,8 @@ Adafruit_SH110X::Adafruit_SH110X(uint16_t w, uint16_t h, int8_t mosi_pin,
allocation is performed there!
*/
Adafruit_SH110X::Adafruit_SH110X(uint16_t w, uint16_t h, SPIClass *spi,
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin,
uint32_t bitrate)
int16_t dc_pin, int16_t rst_pin,
int16_t cs_pin, uint32_t bitrate)
: Adafruit_GrayOLED(1, w, h, spi, dc_pin, rst_pin, cs_pin, bitrate) {}

/*!
Expand Down
33 changes: 18 additions & 15 deletions Adafruit_SH110X.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ class Adafruit_SH110X : public Adafruit_GrayOLED {
public:
// NEW CONSTRUCTORS -- recommended for new projects
Adafruit_SH110X(uint16_t w, uint16_t h, TwoWire *twi = &Wire,
int8_t rst_pin = -1, uint32_t preclk = 400000,
int16_t rst_pin = -1, uint32_t preclk = 400000,
uint32_t postclk = 100000);
Adafruit_SH110X(uint16_t w, uint16_t h, int8_t mosi_pin, int8_t sclk_pin,
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
Adafruit_SH110X(uint16_t w, uint16_t h, SPIClass *spi, int8_t dc_pin,
int8_t rst_pin, int8_t cs_pin, uint32_t bitrate = 8000000UL);
Adafruit_SH110X(uint16_t w, uint16_t h, int16_t mosi_pin, int16_t sclk_pin,
int16_t dc_pin, int16_t rst_pin, int16_t cs_pin);
Adafruit_SH110X(uint16_t w, uint16_t h, SPIClass *spi, int16_t dc_pin,
int16_t rst_pin, int16_t cs_pin,
uint32_t bitrate = 8000000UL);

virtual ~Adafruit_SH110X(void) = 0;

Expand All @@ -100,12 +101,13 @@ class Adafruit_SH110X : public Adafruit_GrayOLED {
class Adafruit_SH1106G : public Adafruit_SH110X {
public:
Adafruit_SH1106G(uint16_t w, uint16_t h, TwoWire *twi = &Wire,
int8_t rst_pin = -1, uint32_t preclk = 400000,
int16_t rst_pin = -1, uint32_t preclk = 400000,
uint32_t postclk = 100000);
Adafruit_SH1106G(uint16_t w, uint16_t h, int8_t mosi_pin, int8_t sclk_pin,
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
Adafruit_SH1106G(uint16_t w, uint16_t h, SPIClass *spi, int8_t dc_pin,
int8_t rst_pin, int8_t cs_pin, uint32_t bitrate = 8000000UL);
Adafruit_SH1106G(uint16_t w, uint16_t h, int16_t mosi_pin, int16_t sclk_pin,
int16_t dc_pin, int16_t rst_pin, int16_t cs_pin);
Adafruit_SH1106G(uint16_t w, uint16_t h, SPIClass *spi, int16_t dc_pin,
int16_t rst_pin, int16_t cs_pin,
uint32_t bitrate = 8000000UL);

~Adafruit_SH1106G(void);

Expand All @@ -119,12 +121,13 @@ class Adafruit_SH1106G : public Adafruit_SH110X {
class Adafruit_SH1107 : public Adafruit_SH110X {
public:
Adafruit_SH1107(uint16_t w, uint16_t h, TwoWire *twi = &Wire,
int8_t rst_pin = -1, uint32_t preclk = 400000,
int16_t rst_pin = -1, uint32_t preclk = 400000,
uint32_t postclk = 100000);
Adafruit_SH1107(uint16_t w, uint16_t h, int8_t mosi_pin, int8_t sclk_pin,
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
Adafruit_SH1107(uint16_t w, uint16_t h, SPIClass *spi, int8_t dc_pin,
int8_t rst_pin, int8_t cs_pin, uint32_t bitrate = 8000000UL);
Adafruit_SH1107(uint16_t w, uint16_t h, int16_t mosi_pin, int16_t sclk_pin,
int16_t dc_pin, int16_t rst_pin, int16_t cs_pin);
Adafruit_SH1107(uint16_t w, uint16_t h, SPIClass *spi, int16_t dc_pin,
int16_t rst_pin, int16_t cs_pin,
uint32_t bitrate = 8000000UL);

~Adafruit_SH1107(void);

Expand Down
Loading