Adafruit SSD1351 Arduino Library
Public Member Functions | List of all members
Adafruit_SSD1351 Class Reference

Class that stores state and functions for interacting with SSD1351 OLED displays. More...

#include <Adafruit_SSD1351.h>

Inheritance diagram for Adafruit_SSD1351:

Public Member Functions

 Adafruit_SSD1351 (uint16_t width, uint16_t height, int8_t cs_pin, int8_t dc_pin, int8_t mosi_pin, int8_t sclk_pin, int8_t rst_pin=-1)
 Constructor for SSD1351 displays, using software (bitbang) SPI. More...
 
 Adafruit_SSD1351 (uint16_t width, uint16_t height, SPIClass *spi, int8_t cs_pin, int8_t dc_pin, int8_t rst_pin=-1)
 Constructor for SSD1351 displays, using native hardware SPI. More...
 
 Adafruit_SSD1351 (int8_t cs_pin, int8_t dc_pin, int8_t mosi_pin, int8_t sclk_pin, int8_t rst_pin=-1)
 DEPRECATED constructor for SSD1351 displays, using software (bitbang) SPI. Provided for older code to maintain compatibility with the current library. Screen size is determined by editing the SSD1351WIDTH and SSD1351HEIGHT defines in Adafruit_SSD1351.h. New code should NOT use this. More...
 
 Adafruit_SSD1351 (int8_t cs_pin, int8_t dc_pin, int8_t rst_pin=-1)
 DEPRECATED constructor for SSD1351 displays, using native hardware SPI. Provided for older code to maintain compatibility with the current library. Screen size is determined by editing the SSD1351WIDTH and SSD1351HEIGHT defines in Adafruit_SSD1351.h. Only the primary SPI bus is supported, and bitrate is fixed at a default. New code should NOT use this. More...
 
 ~Adafruit_SSD1351 (void)
 Destructor for Adafruit_SSD1351 object.
 
void begin (uint32_t freq=0)
 Initialize SSD1351 chip. Configures pins, connects to the SSD1351 and sends initialization commands. More...
 
void setRotation (uint8_t r)
 Set origin of (0,0) and orientation of OLED display. More...
 
void invertDisplay (boolean i)
 Enable/Disable display color inversion. More...
 
void invert (boolean i)
 Enable/Disable display color inversion. More...
 
void enableDisplay (boolean enable)
 Change whether display is on or off. More...
 
void setAddrWindow (uint16_t x, uint16_t y, uint16_t w, uint16_t h)
 Set the "address window" - the rectangle we will write to graphics RAM with the next chunk of SPI data writes. The SSD1351 will automatically wrap the data as each row is filled. More...
 

Detailed Description

Class that stores state and functions for interacting with SSD1351 OLED displays.

Constructor & Destructor Documentation

◆ Adafruit_SSD1351() [1/4]

Adafruit_SSD1351::Adafruit_SSD1351 ( uint16_t  width,
uint16_t  height,
int8_t  cs_pin,
int8_t  dc_pin,
int8_t  mosi_pin,
int8_t  sclk_pin,
int8_t  rst_pin = -1 
)

Constructor for SSD1351 displays, using software (bitbang) SPI.

Parameters
widthDisplay width in pixels (usu. 128)
heightDisplay height in pixels (usu. 128 or 96)
cs_pinChip-select pin (using Arduino pin numbering) for sharing the bus with other devices. Active low.
dc_pinData/command pin (using Arduino pin numbering), selects whether display is receiving commands (low) or data (high).
mosi_pinMOSI (master out, slave in) pin (using Arduino pin numbering). This transfers serial data from microcontroller to display.
sclk_pinSCLK (serial clock) pin (using Arduino pin numbering). This clocks each bit from MOSI.
rst_pinReset pin (using Arduino pin numbering), or -1 if not used (some displays might be wired to share the microcontroller's reset pin).
Returns
Adafruit_SSD1351 object.
Note
Call the object's begin() function before use.

◆ Adafruit_SSD1351() [2/4]

Adafruit_SSD1351::Adafruit_SSD1351 ( uint16_t  width,
uint16_t  height,
SPIClass *  spi,
int8_t  cs_pin,
int8_t  dc_pin,
int8_t  rst_pin = -1 
)

Constructor for SSD1351 displays, using native hardware SPI.

Parameters
widthDisplay width in pixels
heightDisplay height in pixels
spiPointer to an existing SPIClass instance (e.g. &SPI, the microcontroller's primary SPI bus).
cs_pinChip-select pin (using Arduino pin numbering) for sharing the bus with other devices. Active low.
dc_pinData/command pin (using Arduino pin numbering), selects whether display is receiving commands (low) or data (high).
rst_pinReset pin (using Arduino pin numbering), or -1 if not used (some displays might be wired to share the microcontroller's reset pin).
Returns
Adafruit_SSD1351 object.
Note
Call the object's begin() function before use.

◆ Adafruit_SSD1351() [3/4]

Adafruit_SSD1351::Adafruit_SSD1351 ( int8_t  cs_pin,
int8_t  dc_pin,
int8_t  mosi_pin,
int8_t  sclk_pin,
int8_t  rst_pin = -1 
)

DEPRECATED constructor for SSD1351 displays, using software (bitbang) SPI. Provided for older code to maintain compatibility with the current library. Screen size is determined by editing the SSD1351WIDTH and SSD1351HEIGHT defines in Adafruit_SSD1351.h. New code should NOT use this.

Parameters
cs_pinChip-select pin (using Arduino pin numbering) for sharing the bus with other devices. Active low.
dc_pinData/command pin (using Arduino pin numbering), selects whether display is receiving commands (low) or data (high).
mosi_pinMOSI (master out, slave in) pin (using Arduino pin numbering). This transfers serial data from microcontroller to display.
sclk_pinSCLK (serial clock) pin (using Arduino pin numbering). This clocks each bit from MOSI.
rst_pinReset pin (using Arduino pin numbering), or -1 if not used (some displays might be wired to share the microcontroller's reset pin).
Returns
Adafruit_SSD1351 object.
Note
Call the object's begin() function before use.

◆ Adafruit_SSD1351() [4/4]

Adafruit_SSD1351::Adafruit_SSD1351 ( int8_t  cs_pin,
int8_t  dc_pin,
int8_t  rst_pin = -1 
)

DEPRECATED constructor for SSD1351 displays, using native hardware SPI. Provided for older code to maintain compatibility with the current library. Screen size is determined by editing the SSD1351WIDTH and SSD1351HEIGHT defines in Adafruit_SSD1351.h. Only the primary SPI bus is supported, and bitrate is fixed at a default. New code should NOT use this.

Parameters
cs_pinChip-select pin (using Arduino pin numbering) for sharing the bus with other devices. Active low.
dc_pinData/command pin (using Arduino pin numbering), selects whether display is receiving commands (low) or data (high).
rst_pinReset pin (using Arduino pin numbering), or -1 if not used (some displays might be wired to share the microcontroller's reset pin).
Returns
Adafruit_SSD1351 object.
Note
Call the object's begin() function before use.

Member Function Documentation

◆ begin()

void Adafruit_SSD1351::begin ( uint32_t  freq = 0)

Initialize SSD1351 chip. Configures pins, connects to the SSD1351 and sends initialization commands.

Parameters
freqSPI bitrate – default of 0 will use a (usually) platform- optimized value, e.g. 8 MHz on AVR, 12 MHz on M0.
Returns
None (void).

◆ setRotation()

void Adafruit_SSD1351::setRotation ( uint8_t  r)

Set origin of (0,0) and orientation of OLED display.

Parameters
rThe index for rotation, from 0-3 inclusive
Returns
None (void).
Note
SSD1351 works differently than most (all?) other SPITFT displays. With certain rotation changes the screen contents may change immediately into a peculiar format (mirrored, not necessarily rotated) (other displays, this only affects new drawing – rotation combinations can apply to different areas). Therefore, it's recommend to clear the screen (fillScreen(0)) before changing rotation.

◆ invertDisplay()

void Adafruit_SSD1351::invertDisplay ( boolean  i)

Enable/Disable display color inversion.

Parameters
iTrue to invert display, False for normal color.
Returns
None (void).
Note
This syntax is used by other SPITFT compatible libraries. New code should use this.

◆ invert()

void Adafruit_SSD1351::invert ( boolean  i)

Enable/Disable display color inversion.

Parameters
iTrue to invert display, False for normal color.
Returns
None (void).
Note
This is an older syntax used by this library prior to the SPITFT library. New code should avoid it.

◆ enableDisplay()

void Adafruit_SSD1351::enableDisplay ( boolean  enable)

Change whether display is on or off.

Parameters
enableTrue if you want the display ON, false OFF

◆ setAddrWindow()

void Adafruit_SSD1351::setAddrWindow ( uint16_t  x1,
uint16_t  y1,
uint16_t  w,
uint16_t  h 
)

Set the "address window" - the rectangle we will write to graphics RAM with the next chunk of SPI data writes. The SSD1351 will automatically wrap the data as each row is filled.

Parameters
x1Leftmost column of rectangle (screen pixel coordinates).
y1Topmost row of rectangle (screen pixel coordinates).
wWidth of rectangle.
hHeight of rectangle.
Returns
None (void).

The documentation for this class was generated from the following files: