Skip to content

Commit

Permalink
Fix broken reset logic if reset pin exceeds 127 due to int8 overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nocnokneo committed Jun 5, 2024
1 parent 7a0a5ee commit 6715ea4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
10 changes: 5 additions & 5 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,
uint32_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, uint32_t mosi_pin,
uint32_t sclk_pin, uint32_t dc_pin,
uint32_t rst_pin, uint32_t cs_pin)
: Adafruit_SH110X(w, h, mosi_pin, sclk_pin, dc_pin, rst_pin, cs_pin) {}

/*!
Expand Down Expand Up @@ -102,7 +102,7 @@ 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 dc_pin, uint32_t rst_pin, uint32_t cs_pin,
uint32_t bitrate)
: Adafruit_SH110X(w, h, spi, dc_pin, rst_pin, cs_pin, bitrate) {}

Expand Down
10 changes: 5 additions & 5 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,
uint32_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, uint32_t mosi_pin,
uint32_t sclk_pin, uint32_t dc_pin, uint32_t rst_pin,
uint32_t cs_pin)
: Adafruit_SH110X(w, h, mosi_pin, sclk_pin, dc_pin, rst_pin, cs_pin) {}

/*!
Expand Down Expand Up @@ -102,7 +102,7 @@ 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 dc_pin, uint32_t rst_pin, uint32_t cs_pin,
uint32_t bitrate)
: Adafruit_SH110X(w, h, spi, dc_pin, rst_pin, cs_pin, bitrate) {}

Expand Down
10 changes: 5 additions & 5 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,
uint32_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, uint32_t mosi_pin,
uint32_t sclk_pin, uint32_t dc_pin, uint32_t rst_pin,
uint32_t cs_pin)
: Adafruit_GrayOLED(1, w, h, mosi_pin, sclk_pin, dc_pin, rst_pin, cs_pin) {}

/*!
Expand Down Expand Up @@ -135,7 +135,7 @@ 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 dc_pin, uint32_t rst_pin, uint32_t cs_pin,
uint32_t bitrate)
: Adafruit_GrayOLED(1, w, h, spi, dc_pin, rst_pin, cs_pin, bitrate) {}

Expand Down
30 changes: 15 additions & 15 deletions Adafruit_SH110X.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ 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,
uint32_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, uint32_t mosi_pin, uint32_t sclk_pin,
uint32_t dc_pin, uint32_t rst_pin, uint32_t cs_pin);
Adafruit_SH110X(uint16_t w, uint16_t h, SPIClass *spi, uint32_t dc_pin,
uint32_t rst_pin, uint32_t cs_pin, uint32_t bitrate = 8000000UL);

virtual ~Adafruit_SH110X(void) = 0;

Expand All @@ -100,12 +100,12 @@ 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,
uint32_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, uint32_t mosi_pin, uint32_t sclk_pin,
uint32_t dc_pin, uint32_t rst_pin, uint32_t cs_pin);
Adafruit_SH1106G(uint16_t w, uint16_t h, SPIClass *spi, uint32_t dc_pin,
uint32_t rst_pin, uint32_t cs_pin, uint32_t bitrate = 8000000UL);

~Adafruit_SH1106G(void);

Expand All @@ -119,12 +119,12 @@ 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,
uint32_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, uint32_t mosi_pin, uint32_t sclk_pin,
uint32_t dc_pin, uint32_t rst_pin, uint32_t cs_pin);
Adafruit_SH1107(uint16_t w, uint16_t h, SPIClass *spi, uint32_t dc_pin,
uint32_t rst_pin, uint32_t cs_pin, uint32_t bitrate = 8000000UL);

~Adafruit_SH1107(void);

Expand Down

0 comments on commit 6715ea4

Please sign in to comment.