Adafruit SH110x Arduino Library
Adafruit_SH110X.h
Go to the documentation of this file.
1 
24 #ifndef _Adafruit_SH110X_H_
25 #define _Adafruit_SH110X_H_
26 
27 #include <Adafruit_GrayOLED.h>
28 
30 #define SH110X_BLACK 0
31 #define SH110X_WHITE 1
32 #define SH110X_INVERSE 2
33 
34 // Uncomment to disable Adafruit splash logo
35 //#define SH110X_NO_SPLASH
36 
37 #define SH110X_MEMORYMODE 0x20
38 #define SH110X_COLUMNADDR 0x21
39 #define SH110X_PAGEADDR 0x22
40 #define SH110X_SETCONTRAST 0x81
41 #define SH110X_CHARGEPUMP 0x8D
42 #define SH110X_SEGREMAP 0xA0
43 #define SH110X_DISPLAYALLON_RESUME 0xA4
44 #define SH110X_DISPLAYALLON 0xA5
45 #define SH110X_NORMALDISPLAY 0xA6
46 #define SH110X_INVERTDISPLAY 0xA7
47 #define SH110X_SETMULTIPLEX 0xA8
48 #define SH110X_DCDC 0xAD
49 #define SH110X_DISPLAYOFF 0xAE
50 #define SH110X_DISPLAYON 0xAF
51 #define SH110X_SETPAGEADDR \
52  0xB0
53 #define SH110X_COMSCANINC 0xC0
55 #define SH110X_COMSCANDEC 0xC8
56 #define SH110X_SETDISPLAYOFFSET 0xD3
57 #define SH110X_SETDISPLAYCLOCKDIV 0xD5
58 #define SH110X_SETPRECHARGE 0xD9
59 #define SH110X_SETCOMPINS 0xDA
60 #define SH110X_SETVCOMDETECT 0xDB
61 #define SH110X_SETDISPSTARTLINE \
62  0xDC
63 
65 #define SH110X_SETLOWCOLUMN 0x00
66 #define SH110X_SETHIGHCOLUMN 0x10
67 #define SH110X_SETSTARTLINE 0x40
68 
69 
73 class Adafruit_SH110X : public Adafruit_GrayOLED {
74 public:
75  // NEW CONSTRUCTORS -- recommended for new projects
76  Adafruit_SH110X(uint16_t w, uint16_t h, TwoWire *twi = &Wire,
77  int8_t rst_pin = -1, uint32_t preclk = 400000,
78  uint32_t postclk = 100000);
79  Adafruit_SH110X(uint16_t w, uint16_t h, int8_t mosi_pin, int8_t sclk_pin,
80  int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
81  Adafruit_SH110X(uint16_t w, uint16_t h, SPIClass *spi, int8_t dc_pin,
82  int8_t rst_pin, int8_t cs_pin, uint32_t bitrate = 8000000UL);
83 
84  virtual ~Adafruit_SH110X(void) = 0;
85 
86  void display(void);
87 
88 protected:
91  uint8_t _page_start_offset = 0;
92 
93 private:
94 };
95 
101 public:
102  Adafruit_SH1106G(uint16_t w, uint16_t h, TwoWire *twi = &Wire,
103  int8_t rst_pin = -1, uint32_t preclk = 400000,
104  uint32_t postclk = 100000);
105  Adafruit_SH1106G(uint16_t w, uint16_t h, int8_t mosi_pin, int8_t sclk_pin,
106  int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
107  Adafruit_SH1106G(uint16_t w, uint16_t h, SPIClass *spi, int8_t dc_pin,
108  int8_t rst_pin, int8_t cs_pin, uint32_t bitrate = 8000000UL);
109 
110  ~Adafruit_SH1106G(void);
111 
112  bool begin(uint8_t i2caddr = 0x3C, bool reset = true);
113 };
114 
120 public:
121  Adafruit_SH1107(uint16_t w, uint16_t h, TwoWire *twi = &Wire,
122  int8_t rst_pin = -1, uint32_t preclk = 400000,
123  uint32_t postclk = 100000);
124  Adafruit_SH1107(uint16_t w, uint16_t h, int8_t mosi_pin, int8_t sclk_pin,
125  int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
126  Adafruit_SH1107(uint16_t w, uint16_t h, SPIClass *spi, int8_t dc_pin,
127  int8_t rst_pin, int8_t cs_pin, uint32_t bitrate = 8000000UL);
128 
129  ~Adafruit_SH1107(void);
130 
131  bool begin(uint8_t i2caddr = 0x3C, bool reset = true);
132 };
133 #endif // _Adafruit_SH110X_H_
Class that stores state and functions for interacting with SH1107 OLED displays.
Definition: Adafruit_SH110X.h:119
virtual ~Adafruit_SH110X(void)=0
Destructor for Adafruit_SH110X object.
Definition: Adafruit_SH110X.cpp:145
uint8_t _page_start_offset
Definition: Adafruit_SH110X.h:91
Class that stores state and functions for interacting with SH1106G OLED displays. ...
Definition: Adafruit_SH110X.h:100
Class that stores state and functions for interacting with SH110X OLED displays. Not instantiatable -...
Definition: Adafruit_SH110X.h:73
void display(void)
Push data currently in RAM to SH110X display.
Definition: Adafruit_SH110X.cpp:155
Adafruit_SH110X(uint16_t w, uint16_t h, TwoWire *twi=&Wire, int8_t rst_pin=-1, uint32_t preclk=400000, uint32_t postclk=100000)
Constructor for I2C-interfaced SH110X displays.
Definition: Adafruit_SH110X.cpp:76