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

Changing dafault I2C address #230

Closed ITstreet1 closed 2 years ago

ITstreet1 commented 2 years ago

I am using this lib with an STM32 MCU. How can I set I2C pins other than default? The other than the default is THE must. I looked in cpp and h files but not sure where and how to change it.

dhalbert commented 2 years ago

This constructor:

  Adafruit_SSD1306(uint8_t w, uint8_t h, TwoWire *twi = &Wire,
                   int8_t rst_pin = -1, uint32_t clkDuring = 400000UL,
                   uint32_t clkAfter = 100000UL);

allows you to specify the TwoWire. Pass in a different instance of TwoWire.

The deatils depend on your particular STM32, but here are some examples: https://forum.arduino.cc/t/using-2nd-i2c-peripheral-with-stm32/591066 https://stm32duinoforum.com/forum/viewtopic_f_51_t_3175.html

A websearch will get you more.

This is more of a support question than a bug report or enhancement request. A better place to ask is in the forums: https://forums.adafruit.com or discord: https://adafru.it/discord.