SSD1306 OLED display driver  1.7.17
This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
README.md
1 # ssd1306 library introduction # {#index}
2 
3 ***
4 
5 [tocstart]: # (toc start)
6 
7  * [Introduction](#introduction)
8  * [Key Features](#key-features)
9  * [Supported displays](#supported-displays)
10  * [Supported platforms](#supported-platforms)
11  * [Setting up](#setting-up)
12  * [License](#license)
13 
14 [tocend]: # (toc end)
15 
16 
17 <a name="introduction"></a>
18 ## Introduction
19 
20 SSD1306 driver is Arduino style C/C++ library with unicode support. The library can be compiled for plain Linux
21 (for example, raspberry spi), or you can use it with plain avr-gcc compiler without Arduino IDE, or with
22 ESP32 IDF. It supports monochrome and RGB oleds and has debug mode, allowing to execute code on PC, using SDL2.0.
23 Initially the library is intended for very small microcontrollers (with a little of RAM). It was developed to use as
24 few resources as possible, but still has powerful capabilities, allowing to develop nice animation.
25 It works on any powerful devices like raspberry pi, esp32; and can be easily ported to new platform.
26 
27 Since ssd1306 library supports different display types: monochrome, 8-bit color, 16-bit color displays, -
28 there are several group of API functions:
29 
30  * Generic API functions (font specific, cursor positioning, menu implementation)
31  * 1-bit API functions for monochrome displays (these ones can be used both for color and mono lcd)
32  * 8-bit API functions for color displays (these ones work only for color displays)
33  * 16-bit API functions for color displays (only color displays)
34 
35 Also, for graphics animation there special C++ API, called [Nano Engine](nano_engine/README.md).
36 
37 <a name="key-features"></a>
38 ## Key Features
39 
40  * Supports color, monochrome OLED displays, and VGA monitor
41  * The library has modular structure, and some modules can be excluded from compilation at all to reduce flash usage.
42  * Needs very little RAM (Attiny85 with Damellis package needs minimum 25 bytes of RAM to communicate with OLED)
43  * Fast implementation to provide reasonable speed on slow microcontrollers
44  * Supports i2c and spi interfaces:
45  * i2c (software implementation, Wire library, AVR Twi, Linux i2c-dev)
46  * spi (4-wire spi via Arduino SPI library, AVR Spi, AVR USI module)
47  * Primitive graphics functions (lines, rectangles, pixels, bitmaps)
48  * Printing text to display (using fonts of different size, you can use GLCD Font Creator to create new fonts)
49  * Includes [graphics engine](https://github.com/lexus2k/ssd1306/wiki/Using-NanoEngine-for-systems-with-low-resources) to support
50  double buffering on tiny microcontrollers.
51  * Can be used for game development (bonus examples):
52  * Arkanoid game ([arkanoid](examples/games/arkanoid) in old style API and [arkanoid8](examples/games/arkanoid8) in new style API)
53  * Simple [Lode runner](examples/games/lode_runner) game.
54  * [Snowflakes](examples/nano_engine/snowflakes)
55 
56 The i2c pins can be changed via API functions. Please, refer to documentation. Keep in mind,
57 that the pins, which are allowed for i2c or spi interface, depend on the hardware.
58 The default spi SCLK and MOSI pins are defined by SPI library, and DC, RST, CES pins are configurable
59 through API.
60 
61 <a name="supported-displays"></a>
62 ## Supported displays:
63 
64 | **Display** | **I2C** | **SPI** | **Orientation** | **Comments** |
65 | :-------- |:---:|:---:|:---:|:---------|
66 | sh1106 128x64 | X | | | |
67 | ssd1306 128x64 | X | X | | |
68 | ssd1306 128x32 | X | X | | |
69 | ssd1331 96x64 | | X | X | |
70 | ssd1351 128x128 | | X | | |
71 | il9163 128x128 | | X | X | |
72 | st7735 128x160 | | X | X | |
73 | ili9341 240x320 | | X | X | |
74 | pcd8544 84x48 | | X | | Nokia 5110 |
75 | vga 96x40 color | | | | direct D-sub output, atmega328p only |
76 | vga 128x64 bw | | | | direct D-sub output, atmega328p only |
77 
78 <a name="supported-platforms"></a>
79 ## Supported platforms
80 
81 | **Platforms** | **I2C** | **SPI** | **Comments** |
82 | :-------- |:---:|:---:|:---------|
83 | **Arduino** | | | |
84 | Attiny85, Attiny45 | X | X | Refer to [Damellis attiny package](https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json) |
85 | Attiny84, Attiny44 | X | X | Refer to [Damellis attiny package](https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json) |
86 | Atmega328p, Atmega168 | X | X | |
87 | Atmega32u4 | X | X | |
88 | Atmega2560 | X | X | |
89 | Digispark, including PRO version | X | X | check [examples compatibility list](examples/Digispark_compatibility.txt) |
90 | ESP8266 | X | X | check [examples compatibility list](examples/ESP8266_compatibility.txt) |
91 | ESP32 | X | X | check [examples compatibility list](examples/ESP8266_compatibility.txt) |
92 | STM32 | X | X | [stm32duino](https://github.com/stm32duino/wiki/wiki) |
93 | Arduino Zero | X | X | |
94 | Nordic nRF5 (nRF51, nRF52) | X | X | nRF users, enable c++11 in platform.txt `-std=gnu++11` |
95 | Nordic nRF5 (nRF51, nRF52) | X | X | via [Sandeep Mistry arduino-nRF5](https://github.com/sandeepmistry/arduino-nRF5) package |
96 | **Plain AVR** | | | |
97 | Attiny85, Attiny45 | X | X | |
98 | Atmega328p, Atmega168 | X | X | |
99 | Atmega32u4 | X | X | |
100 | **Plain ESP32** | | | |
101 | ESP32 | X | X | library can be used as IDF component |
102 | **Linux** | | | |
103 | Raspberry Pi | X | X | i2c-dev, spidev, sys/class/gpio |
104 | [SDL Emulation](https://github.com/lexus2k/ssd1306/wiki/How-to-run-emulator-mode) | X | X | demo code can be run without real OLED HW via SDL library |
105 | **Windows** | | | |
106 | [SDL Emulation](https://github.com/lexus2k/ssd1306/wiki/How-to-run-emulator-mode) | X | X | demo code can be run without real OLED HW via MinGW32 + SDL library |
107 
108 Digispark users, please check compilation options in your Arduino prior to using this library.
109 Ssd1306 library requires at least c++11 and c99 (by default Digispark package misses the options
110 -std=gnu11, -std=gnu++11).
111 
112 <a name="setting-up"></a>
113 ## Setting up
114 
115 *i2c Hardware setup is described [here](https://github.com/lexus2k/ssd1306/wiki/Hardware-setup)*
116 
117 *Setting up for Arduino from github sources)*
118  * Download source from https://github.com/lexus2k/ssd1306
119  * Put the sources to Arduino/libraries/ssd1306/ folder
120 
121 *Setting up for Arduino from Arduino IDE library manager*
122  * Install ssd1306 library (named ssd1306 by Alexey Dynda) via Arduino IDE library manager
123 
124 *Using with plain avr-gcc:*
125  * Download source from https://github.com/lexus2k/ssd1306
126  * Build the library (variant 1)
127  * cd ssd1306/src && make -f Makefile.avr MCU=<your_mcu>
128  * Link library to your project (refer to [Makefile.avr](examples/Makefile.avr) in examples folder).
129  * Build demo code (variant 2)
130  * cd ssd1306/tools && ./build_and_run.sh -p avr -m <your_mcu> ssd1306_demo
131 
132  *For esp32:*
133  * Download source from https://github.com/lexus2k/ssd1306
134  * Put downloaded sources to components/ssd1306/ folder.
135  * Compile your project as described in ESP-IDF build system documentation
136 
137 For more information about this library, please, visit https://github.com/lexus2k/ssd1306.
138 Doxygen documentation can be found at [github.io site](http://lexus2k.github.io/ssd1306).
139 If you found any problem or have any idea, please, report to Issues section.
140 
141 <a name="license"></a>
142 ## License
143 
144 The library is free. If this project helps you, you can give me a cup of coffee. [Donate via Paypal](https://www.paypal.me/lexus2k)
145 
146 MIT License
147 
148 Copyright (c) 2016-2019, Alexey Dynda
149 
150 Permission is hereby granted, free of charge, to any person obtaining a copy
151 of this software and associated documentation files (the "Software"), to deal
152 in the Software without restriction, including without limitation the rights
153 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
154 copies of the Software, and to permit persons to whom the Software is
155 furnished to do so, subject to the following conditions:
156 
157 The above copyright notice and this permission notice shall be included in all
158 copies or substantial portions of the Software.
159 
160 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
161 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
162 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
163 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
164 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
165 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
166 SOFTWARE.
167 
168