Adafruit SSD1351 Arduino Library
Adafruit_SSD1351.h
Go to the documentation of this file.
1 
31 #ifndef _Adafruit_SSD1351_H_
32 #define _Adafruit_SSD1351_H_
33 
34 #include <Adafruit_SPITFT.h>
35 
36 // These #defines are DEPRECATED but present for older code compatibility:
37 #define SSD1351WIDTH 128
38 #define SSD1351HEIGHT 128
39 // (NEW CODE SHOULD IGNORE THIS, USE THE CONSTRUCTORS THAT ACCEPT WIDTH
40 // AND HEIGHT ARGUMENTS).
41 
42 #define SSD1351_CMD_SETCOLUMN 0x15
43 #define SSD1351_CMD_SETROW 0x75
44 #define SSD1351_CMD_WRITERAM 0x5C
45 #define SSD1351_CMD_READRAM 0x5D
46 #define SSD1351_CMD_SETREMAP 0xA0
47 #define SSD1351_CMD_STARTLINE 0xA1
48 #define SSD1351_CMD_DISPLAYOFFSET 0xA2
49 #define SSD1351_CMD_DISPLAYALLOFF 0xA4
50 #define SSD1351_CMD_DISPLAYALLON 0xA5
51 #define SSD1351_CMD_NORMALDISPLAY 0xA6
52 #define SSD1351_CMD_INVERTDISPLAY 0xA7
53 #define SSD1351_CMD_FUNCTIONSELECT 0xAB
54 #define SSD1351_CMD_DISPLAYOFF 0xAE
55 #define SSD1351_CMD_DISPLAYON 0xAF
56 #define SSD1351_CMD_PRECHARGE 0xB1
57 #define SSD1351_CMD_DISPLAYENHANCE 0xB2
58 #define SSD1351_CMD_CLOCKDIV 0xB3
59 #define SSD1351_CMD_SETVSL 0xB4
60 #define SSD1351_CMD_SETGPIO 0xB5
61 #define SSD1351_CMD_PRECHARGE2 0xB6
62 #define SSD1351_CMD_SETGRAY 0xB8
63 #define SSD1351_CMD_USELUT 0xB9
64 #define SSD1351_CMD_PRECHARGELEVEL 0xBB
65 #define SSD1351_CMD_VCOMH 0xBE
66 #define SSD1351_CMD_CONTRASTABC 0xC1
67 #define SSD1351_CMD_CONTRASTMASTER 0xC7
68 #define SSD1351_CMD_MUXRATIO 0xCA
69 #define SSD1351_CMD_COMMANDLOCK 0xFD
70 #define SSD1351_CMD_HORIZSCROLL 0x96
71 #define SSD1351_CMD_STOPSCROLL 0x9E
72 #define SSD1351_CMD_STARTSCROLL 0x9F
73 
74 
78 class Adafruit_SSD1351 : public Adafruit_SPITFT {
79 public:
80  // NEW CONSTRUCTORS -- recommended for new projects
81  // 6-7 args using soft SPI (reset optional)
82  Adafruit_SSD1351(uint16_t width, uint16_t height, int8_t cs_pin,
83  int8_t dc_pin, int8_t mosi_pin, int8_t sclk_pin,
84  int8_t rst_pin = -1);
85  // 5-6 args using hardware SPI (must specify peripheral) (reset optional)
86  Adafruit_SSD1351(uint16_t width, uint16_t height, SPIClass *spi,
87  int8_t cs_pin, int8_t dc_pin, int8_t rst_pin = -1);
88 
89  // DEPRECATED CONSTRUCTORS for back compatibility, avoid in new projects
90  // 4-5 args using soft SPI (reset optional)
91  Adafruit_SSD1351(int8_t cs_pin, int8_t dc_pin, int8_t mosi_pin,
92  int8_t sclk_pin, int8_t rst_pin = -1);
93  // 2-3 args using default hardware SPI peripheral (reset optional)
94  Adafruit_SSD1351(int8_t cs_pin, int8_t dc_pin, int8_t rst_pin = -1);
95 
96  ~Adafruit_SSD1351(void);
97 
98  void begin(uint32_t freq = 0), setRotation(uint8_t r),
99  invertDisplay(boolean i), // Preferred syntax (same as other screens)
100  invert(boolean i), // For compatibility with old code
101  enableDisplay(boolean enable),
102  setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
103 };
104 
105 #endif // _Adafruit_SSD1351_H_
~Adafruit_SSD1351(void)
Destructor for Adafruit_SSD1351 object.
Definition: Adafruit_SSD1351.cpp:174
void enableDisplay(boolean enable)
Change whether display is on or off.
Definition: Adafruit_SSD1351.cpp:377
Class that stores state and functions for interacting with SSD1351 OLED displays. ...
Definition: Adafruit_SSD1351.h:78
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 dat...
Definition: Adafruit_SSD1351.cpp:354
void invertDisplay(boolean i)
Enable/Disable display color inversion.
Definition: Adafruit_SSD1351.cpp:322
void invert(boolean i)
Enable/Disable display color inversion.
Definition: Adafruit_SSD1351.cpp:334
void setRotation(uint8_t r)
Set origin of (0,0) and orientation of OLED display.
Definition: Adafruit_SSD1351.cpp:273
void begin(uint32_t freq=0)
Initialize SSD1351 chip. Configures pins, connects to the SSD1351 and sends initialization commands...
Definition: Adafruit_SSD1351.cpp:238
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.
Definition: Adafruit_SSD1351.cpp:65