Adafruit SH110x Arduino Library
|
Class that stores state and functions for interacting with SH1106G OLED displays. More...
#include <Adafruit_SH110X.h>
Public Member Functions | |
Adafruit_SH1106G (uint16_t w, uint16_t h, TwoWire *twi=&Wire, int16_t rst_pin=-1, uint32_t preclk=400000, uint32_t postclk=100000) | |
Constructor for I2C-interfaced SH1106G displays. More... | |
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) | |
Constructor for SPI SH1106G displays, using software (bitbang) SPI. More... | |
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) | |
Constructor for SPI SH1106G displays, using native hardware SPI. More... | |
~Adafruit_SH1106G (void) | |
Destructor for Adafruit_SH1106G object. | |
bool | begin (uint8_t i2caddr=0x3C, bool reset=true) |
Allocate RAM for image buffer, initialize peripherals and pins. More... | |
![]() | |
Adafruit_SH110X (uint16_t w, uint16_t h, TwoWire *twi=&Wire, int16_t rst_pin=-1, uint32_t preclk=400000, uint32_t postclk=100000) | |
Constructor for I2C-interfaced SH110X displays. More... | |
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) | |
Constructor for SPI SH110X displays, using software (bitbang) SPI. More... | |
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) | |
Constructor for SPI SH110X displays, using native hardware SPI. More... | |
virtual | ~Adafruit_SH110X (void)=0 |
Destructor for Adafruit_SH110X object. | |
void | display (void) |
Push data currently in RAM to SH110X display. More... | |
Additional Inherited Members | |
![]() | |
uint8_t | _page_start_offset = 0 |
Class that stores state and functions for interacting with SH1106G OLED displays.
Adafruit_SH1106G::Adafruit_SH1106G | ( | uint16_t | w, |
uint16_t | h, | ||
TwoWire * | twi = &Wire , |
||
int16_t | rst_pin = -1 , |
||
uint32_t | clkDuring = 400000 , |
||
uint32_t | clkAfter = 100000 |
||
) |
Constructor for I2C-interfaced SH1106G displays.
w | Display width in pixels |
h | Display height in pixels |
twi | Pointer to an existing TwoWire instance (e.g. &Wire, the microcontroller's primary I2C bus). |
rst_pin | Reset pin (using Arduino pin numbering), or -1 if not used (some displays might be wired to share the microcontroller's reset pin). |
clkDuring | Speed (in Hz) for Wire transmissions in SH110X library calls. Defaults to 400000 (400 KHz), a known 'safe' value for most microcontrollers, and meets the SH110X datasheet spec. Some systems can operate I2C faster (800 KHz for ESP32, 1 MHz for many other 32-bit MCUs), and some (perhaps not all) SH110X's can work with this – so it's optionally be specified here and is not a default behavior. (Ignored if using pre-1.5.7 Arduino software, which operates I2C at a fixed 100 KHz.) |
clkAfter | Speed (in Hz) for Wire transmissions following SH110X library calls. Defaults to 100000 (100 KHz), the default Arduino Wire speed. This is done rather than leaving it at the 'during' speed because other devices on the I2C bus might not be compatible with the faster rate. (Ignored if using pre-1.5.7 Arduino software, which operates I2C at a fixed 100 KHz.) |
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 | ||
) |
Constructor for SPI SH1106G displays, using software (bitbang) SPI.
w | Display width in pixels |
h | Display height in pixels |
mosi_pin | MOSI (master out, slave in) pin (using Arduino pin numbering). This transfers serial data from microcontroller to display. |
sclk_pin | SCLK (serial clock) pin (using Arduino pin numbering). This clocks each bit from MOSI. |
dc_pin | Data/command pin (using Arduino pin numbering), selects whether display is receiving commands (low) or data (high). |
rst_pin | Reset pin (using Arduino pin numbering), or -1 if not used (some displays might be wired to share the microcontroller's reset pin). |
cs_pin | Chip-select pin (using Arduino pin numbering) for sharing the bus with other devices. Active low. |
Adafruit_SH1106G::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 |
||
) |
Constructor for SPI SH1106G displays, using native hardware SPI.
w | Display width in pixels |
h | Display height in pixels |
spi | Pointer to an existing SPIClass instance (e.g. &SPI, the microcontroller's primary SPI bus). |
dc_pin | Data/command pin (using Arduino pin numbering), selects whether display is receiving commands (low) or data (high). |
rst_pin | Reset pin (using Arduino pin numbering), or -1 if not used (some displays might be wired to share the microcontroller's reset pin). |
cs_pin | Chip-select pin (using Arduino pin numbering) for sharing the bus with other devices. Active low. |
bitrate | SPI clock rate for transfers to this display. Default if unspecified is 8000000UL (8 MHz). |
bool Adafruit_SH1106G::begin | ( | uint8_t | addr = 0x3C , |
bool | reset = true |
||
) |
Allocate RAM for image buffer, initialize peripherals and pins.
addr | I2C address of corresponding SH110X display (or pass 0 to use default of 0x3C for 128x32 display, 0x3D for all others). SPI displays (hardware or software) do not use addresses, but this argument is still required (pass 0 or any value really, it will simply be ignored). Default if unspecified is 0. |
reset | If true, and if the reset pin passed to the constructor is valid, a hard reset will be performed before initializing the display. If using multiple SH110X displays on the same bus, and if they all share the same reset pin, you should only pass true on the first display being initialized, false on all others, else the already-initialized displays would be reset. Default if unspecified is true. |