Adafruit SSD1331 Arduino Library
Adafruit_SSD1331.h
Go to the documentation of this file.
1 
5 #ifndef ADAFRUIT_SSD1331_H
6 #define ADAFRUIT_SSD1331_H
7 
8 #include <Adafruit_SPITFT.h>
9 
13 #define SSD1331_COLORORDER_RGB
14 // #define SSD1331_COLORORDER_BGR
15 
16 #if defined SSD1331_COLORORDER_RGB && defined SSD1331_COLORORDER_BGR
17 #error "RGB and BGR can not both be defined for SSD1331_COLORORDER."
18 #endif
19 
20 // Timing Delays
21 #define SSD1331_DELAYS_HWFILL (3)
22 #define SSD1331_DELAYS_HWLINE (1)
23 
24 // SSD1331 Commands
25 #define SSD1331_CMD_DRAWLINE 0x21
26 #define SSD1331_CMD_DRAWRECT 0x22
27 #define SSD1331_CMD_FILL 0x26
28 #define SSD1331_CMD_SETCOLUMN 0x15
29 #define SSD1331_CMD_SETROW 0x75
30 #define SSD1331_CMD_CONTRASTA 0x81
31 #define SSD1331_CMD_CONTRASTB 0x82
32 #define SSD1331_CMD_CONTRASTC 0x83
33 #define SSD1331_CMD_MASTERCURRENT 0x87
34 #define SSD1331_CMD_SETREMAP 0xA0
35 #define SSD1331_CMD_STARTLINE 0xA1
36 #define SSD1331_CMD_DISPLAYOFFSET 0xA2
37 #define SSD1331_CMD_NORMALDISPLAY 0xA4
38 #define SSD1331_CMD_DISPLAYALLON 0xA5
39 #define SSD1331_CMD_DISPLAYALLOFF 0xA6
40 #define SSD1331_CMD_INVERTDISPLAY 0xA7
41 #define SSD1331_CMD_SETMULTIPLEX 0xA8
42 #define SSD1331_CMD_SETMASTER 0xAD
43 #define SSD1331_CMD_DISPLAYOFF 0xAE
44 #define SSD1331_CMD_DISPLAYON 0xAF
45 #define SSD1331_CMD_POWERMODE 0xB0
46 #define SSD1331_CMD_PRECHARGE 0xB1
47 #define SSD1331_CMD_CLOCKDIV \
48  0xB3
49 #define SSD1331_CMD_PRECHARGEA 0x8A
50 #define SSD1331_CMD_PRECHARGEB 0x8B
51 #define SSD1331_CMD_PRECHARGEC 0x8C
52 #define SSD1331_CMD_PRECHARGELEVEL 0xBB
53 #define SSD1331_CMD_VCOMH 0xBE
54 
55 class Adafruit_SSD1331 : public Adafruit_SPITFT {
57 public:
58  Adafruit_SSD1331(int8_t cs, int8_t dc, int8_t mosi, int8_t sclk, int8_t rst);
59  Adafruit_SSD1331(int8_t cs, int8_t dc, int8_t rst);
60  // 3-4 args using hardware SPI (must specify peripheral) (reset optional)
61  Adafruit_SSD1331(SPIClass *spi, int8_t cs, int8_t dc, int8_t rst = -1);
62 
63  // commands
64  void begin(uint32_t begin = 8000000);
65  void setRotation(uint8_t r);
66  void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
67 
68  void enableDisplay(boolean enable);
69 
70  static const int16_t TFTWIDTH = 96;
71  static const int16_t TFTHEIGHT = 64;
72 
73 private:
74 };
75 
76 #endif // ADAFRUIT_SSD1331_H
static const int16_t TFTWIDTH
The width of the display.
Definition: Adafruit_SSD1331.h:70
void setRotation(uint8_t r)
Set origin of (0,0) and orientation of OLED display.
Definition: Adafruit_SSD1331.cpp:206
void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
SPI displays set an address window rectangle for blitting pixels.
Definition: Adafruit_SSD1331.cpp:43
Adafruit_SSD1331(int8_t cs, int8_t dc, int8_t mosi, int8_t sclk, int8_t rst)
Instantiate Adafruit SSD1331 driver with software SPI.
Definition: Adafruit_SSD1331.cpp:146
void enableDisplay(boolean enable)
Change whether display is on or off.
Definition: Adafruit_SSD1331.cpp:187
void begin(uint32_t begin=8000000)
Initialize SSD1331 chip Connects to the SSD1331 over SPI and sends initialization procedure commands...
Definition: Adafruit_SSD1331.cpp:90
Class to manage hardware interface with SSD1331 chipset.
Definition: Adafruit_SSD1331.h:56
static const int16_t TFTHEIGHT
The height of the display.
Definition: Adafruit_SSD1331.h:71