Adafruit SSD1305
Adafruit_SSD1305.h
1 /*********************************************************************
2 This is a library for our Monochrome OLEDs based on SSD1305 drivers
3 
4  Pick one up today in the adafruit shop!
5  ------> https://www.adafruit.com/products/2675
6 
7 These displays use I2C or SPI to communicate
8 
9 Adafruit invests time and resources providing this open source code,
10 please support Adafruit and open-source hardware by purchasing
11 products from Adafruit!
12 
13 Written by Limor Fried/Ladyada for Adafruit Industries.
14 BSD license, check license.txt for more information
15 All text above, and the splash screen must be included in any redistribution
16 *********************************************************************/
17 
18 #include <Adafruit_GrayOLED.h>
19 
20 #define BLACK 0
21 #define WHITE 1
22 
23 #define SSD1305_I2C_ADDRESS 0x3C // 011110+SA0+RW - 0x3C or 0x3D
24 
25 #define SSD1305_SETLOWCOLUMN 0x00
26 #define SSD1305_SETHIGHCOLUMN 0x10
27 #define SSD1305_MEMORYMODE 0x20
28 #define SSD1305_SETCOLADDR 0x21
29 #define SSD1305_SETPAGEADDR 0x22
30 #define SSD1305_SETSTARTLINE 0x40
31 
32 #define SSD1305_SETCONTRAST 0x81
33 #define SSD1305_SETBRIGHTNESS 0x82
34 
35 #define SSD1305_SETLUT 0x91
36 
37 #define SSD1305_SEGREMAP 0xA0
38 #define SSD1305_DISPLAYALLON_RESUME 0xA4
39 #define SSD1305_DISPLAYALLON 0xA5
40 #define SSD1305_NORMALDISPLAY 0xA6
41 #define SSD1305_INVERTDISPLAY 0xA7
42 #define SSD1305_SETMULTIPLEX 0xA8
43 #define SSD1305_DISPLAYDIM 0xAC
44 #define SSD1305_MASTERCONFIG 0xAD
45 #define SSD1305_DISPLAYOFF 0xAE
46 #define SSD1305_DISPLAYON 0xAF
47 
48 #define SSD1305_SETPAGESTART 0xB0
49 
50 #define SSD1305_COMSCANINC 0xC0
51 #define SSD1305_COMSCANDEC 0xC8
52 #define SSD1305_SETDISPLAYOFFSET 0xD3
53 #define SSD1305_SETDISPLAYCLOCKDIV 0xD5
54 #define SSD1305_SETAREACOLOR 0xD8
55 #define SSD1305_SETPRECHARGE 0xD9
56 #define SSD1305_SETCOMPINS 0xDA
57 #define SSD1305_SETVCOMLEVEL 0xDB
58 
60 class Adafruit_SSD1305 : public Adafruit_GrayOLED {
61 public:
62  Adafruit_SSD1305(uint16_t w, uint16_t h, TwoWire *twi = &Wire,
63  int8_t rst_pin = -1, uint32_t preclk = 400000,
64  uint32_t postclk = 100000);
65  Adafruit_SSD1305(uint16_t w, uint16_t h, int8_t mosi_pin, int8_t sclk_pin,
66  int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
67  Adafruit_SSD1305(uint16_t w, uint16_t h, SPIClass *spi, int8_t dc_pin,
68  int8_t rst_pin, int8_t cs_pin, uint32_t bitrate = 8000000UL);
69  ~Adafruit_SSD1305(void);
70 
71  bool begin(uint8_t i2caddr = SSD1305_I2C_ADDRESS, bool reset = true);
72  void display();
73  void sleep();
74  void wake();
75 
76 private:
77  uint8_t page_offset = 0;
78  uint8_t column_offset = 0;
79 };
void wake()
Wake the display driver from the low power mode.
Definition: Adafruit_SSD1305.cpp:350
bool begin(uint8_t i2caddr=SSD1305_I2C_ADDRESS, bool reset=true)
Allocate RAM for image buffer, initialize peripherals and pins.
Definition: Adafruit_SSD1305.cpp:149
void display()
Do the actual writing of the internal frame buffer to display RAM.
Definition: Adafruit_SSD1305.cpp:249
void sleep()
Put the display driver into a low power mode instead of just turning off all pixels.
Definition: Adafruit_SSD1305.cpp:345
Adafruit_SSD1305(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 SSD1305 displays.
Definition: Adafruit_SSD1305.cpp:56
Definition: Adafruit_SSD1305.h:60
~Adafruit_SSD1305(void)
Destructor for Adafruit_SSD1305 object.
Definition: Adafruit_SSD1305.cpp:125