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