Skip to content

Commit ec6df32

Browse files
committed
Fix broken reset logic if reset pin exceeds 127 due to int8 overflow
1 parent 126007f commit ec6df32

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Adafruit_GrayOLED.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
allocation is performed there!
6262
*/
6363
Adafruit_GrayOLED::Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h,
64-
TwoWire *twi, int8_t rst_pin,
64+
TwoWire *twi, int16_t rst_pin,
6565
uint32_t clkDuring, uint32_t clkAfter)
6666
: Adafruit_GFX(w, h), i2c_preclk(clkDuring), i2c_postclk(clkAfter),
6767
buffer(NULL), dcPin(-1), csPin(-1), rstPin(rst_pin), _bpp(bpp) {
@@ -97,9 +97,9 @@ Adafruit_GrayOLED::Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h,
9797
allocation is performed there!
9898
*/
9999
Adafruit_GrayOLED::Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h,
100-
int8_t mosi_pin, int8_t sclk_pin,
101-
int8_t dc_pin, int8_t rst_pin,
102-
int8_t cs_pin)
100+
int16_t mosi_pin, int16_t sclk_pin,
101+
int16_t dc_pin, int16_t rst_pin,
102+
int16_t cs_pin)
103103
: Adafruit_GFX(w, h), dcPin(dc_pin), csPin(cs_pin), rstPin(rst_pin),
104104
_bpp(bpp) {
105105

@@ -133,8 +133,8 @@ Adafruit_GrayOLED::Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h,
133133
allocation is performed there!
134134
*/
135135
Adafruit_GrayOLED::Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h,
136-
SPIClass *spi, int8_t dc_pin,
137-
int8_t rst_pin, int8_t cs_pin,
136+
SPIClass *spi, int16_t dc_pin,
137+
int16_t rst_pin, int16_t cs_pin,
138138
uint32_t bitrate)
139139
: Adafruit_GFX(w, h), dcPin(dc_pin), csPin(cs_pin), rstPin(rst_pin),
140140
_bpp(bpp) {

Adafruit_GrayOLED.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@
4747
class Adafruit_GrayOLED : public Adafruit_GFX {
4848
public:
4949
Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, TwoWire *twi = &Wire,
50-
int8_t rst_pin = -1, uint32_t preclk = 400000,
50+
int16_t rst_pin = -1, uint32_t preclk = 400000,
5151
uint32_t postclk = 100000);
52-
Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, int8_t mosi_pin,
53-
int8_t sclk_pin, int8_t dc_pin, int8_t rst_pin,
54-
int8_t cs_pin);
52+
Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, int16_t mosi_pin,
53+
int16_t sclk_pin, int16_t dc_pin, int16_t rst_pin,
54+
int16_t cs_pin);
5555
Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, SPIClass *spi,
56-
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin,
56+
int16_t dc_pin, int16_t rst_pin, int16_t cs_pin,
5757
uint32_t bitrate = 8000000UL);
5858

5959
~Adafruit_GrayOLED(void);

0 commit comments

Comments
 (0)