adafruit / Adafruit_SSD1306

Arduino library for SSD1306 monochrome 128x64 and 128x32 OLEDs
http://www.adafruit.com/category/63_98
Other
1.81k stars 984 forks source link

reset pin not activated properly on stm32 bluepill #254

Open gzied opened 1 year ago

gzied commented 1 year ago

setup: I am using STM32 to drive an ssd1306 display with 128x64 pixels. The reset pin is connected to PA3. Observation: The display is not going out of reset even when calling Adafruit_SSD1306::begin with reset param = true. Analysis: PA3 in STM32 is assigned to pin number 0xC3 (-61) which is higher than 80 -> sign bit is 1. In Adafruit_SSD1306::begin, the code is doing 'rstPin >= 0' to check if reset pin was configured. rstPin value is -61, therefore it is considered as not configured and the library is not resetting the display. Solution: replace 'if (reset && (rstPin >= 0))' by 'if (reset && (rstPin != -1))' in Adafruit_SSD1306::begin