test ssd1306 with arduino nano
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Ondřej Hruška 7f087ae854 initial 2 years ago
..
intf initial 2 years ago
lcd initial 2 years ago
nano_engine initial 2 years ago
ssd1306_hal initial 2 years ago
Makefile.avr initial 2 years ago
Makefile.common initial 2 years ago
Makefile.energia initial 2 years ago
Makefile.esp32 initial 2 years ago
Makefile.linux initial 2 years ago
Makefile.mingw32 initial 2 years ago
Makefile.src initial 2 years ago
Makefile.stm32 initial 2 years ago
README.md initial 2 years ago
doxygen.cfg initial 2 years ago
font6x8.h initial 2 years ago
nano_engine.h initial 2 years ago
nano_gfx.cpp initial 2 years ago
nano_gfx.h initial 2 years ago
nano_gfx_types.h initial 2 years ago
sprite_pool.cpp initial 2 years ago
sprite_pool.h initial 2 years ago
ssd1306.h initial 2 years ago
ssd1306_1bit.c initial 2 years ago
ssd1306_1bit.h initial 2 years ago
ssd1306_8bit.c initial 2 years ago
ssd1306_8bit.h initial 2 years ago
ssd1306_16bit.c initial 2 years ago
ssd1306_16bit.h initial 2 years ago
ssd1306_console.cpp initial 2 years ago
ssd1306_console.h initial 2 years ago
ssd1306_fonts.c initial 2 years ago
ssd1306_fonts.h initial 2 years ago
ssd1306_generic.c initial 2 years ago
ssd1306_generic.h initial 2 years ago
ssd1306_menu.c initial 2 years ago
ssd1306_uart.c initial 2 years ago
ssd1306_uart.h initial 2 years ago

README.md

ssd1306 library introduction


Introduction

SSD1306 driver is Arduino style C/C++ library with unicode support. The library can be compiled for plain Linux (for example, raspberry spi), or you can use it with plain avr-gcc compiler without Arduino IDE, or with ESP32 IDF. It supports monochrome and RGB oleds and has debug mode, allowing to execute code on PC, using SDL2.0. Initially the library is intended for very small microcontrollers (with a little of RAM). It was developed to use as few resources as possible, but still has powerful capabilities, allowing to develop nice animation. It works on any powerful devices like raspberry pi, esp32; and can be easily ported to new platform.

Since ssd1306 library supports different display types: monochrome, 8-bit color, 16-bit color displays, - there are several group of API functions:

  • Generic API functions (font specific, cursor positioning, menu implementation)
  • 1-bit API functions for monochrome displays (these ones can be used both for color and mono lcd)
  • 8-bit API functions for color displays (these ones work only for color displays)
  • 16-bit API functions for color displays (only color displays)

Also, for graphics animation there special C++ API, called Nano Engine.

Key Features

  • Supports color, monochrome OLED displays, and VGA monitor
  • The library has modular structure, and some modules can be excluded from compilation at all to reduce flash usage.
  • Needs very little RAM (Attiny85 with Damellis package needs minimum 25 bytes of RAM to communicate with OLED)
  • Fast implementation to provide reasonable speed on slow microcontrollers
  • Supports i2c and spi interfaces:
    • i2c (software implementation, Wire library, AVR Twi, Linux i2c-dev)
    • spi (4-wire spi via Arduino SPI library, AVR Spi, AVR USI module)
  • Primitive graphics functions (lines, rectangles, pixels, bitmaps)
  • Printing text to display (using fonts of different size, you can use GLCD Font Creator to create new fonts)
  • Includes graphics engine to support double buffering on tiny microcontrollers.
  • Can be used for game development (bonus examples):

The i2c pins can be changed via API functions. Please, refer to documentation. Keep in mind, that the pins, which are allowed for i2c or spi interface, depend on the hardware. The default spi SCLK and MOSI pins are defined by SPI library, and DC, RST, CES pins are configurable through API.

Supported displays:

Display I2C SPI Orientation Comments
sh1106 128x64 X
ssd1306 128x64 X X
ssd1306 128x32 X X
ssd1325 128x64 X
ssd1327 128x128 X
ssd1351 128x128 X
il9163 128x128 X X
st7735 128x160 X X
ili9341 240x320 X X
pcd8544 84x48 X Nokia 5110
vga 96x40 color direct D-sub output, atmega328p only
vga 128x64 bw direct D-sub output, atmega328p only

Supported platforms

Platforms I2C SPI Comments
Arduino
Attiny85, Attiny45 X X Refer to Damellis attiny package
Attiny84, Attiny44 X X Refer to Damellis attiny package
Atmega328p, Atmega168 X X
Atmega32u4 X X
Atmega2560 X X
Digispark, including PRO version X X check examples compatibility list
ESP8266 X X check examples compatibility list
ESP32 X X check examples compatibility list
STM32 X X stm32duino
Arduino Zero X X
Nordic nRF5 (nRF51, nRF52) X X nRF users, enable c++11 in platform.txt -std=gnu++11
Nordic nRF5 (nRF51, nRF52) X X via Sandeep Mistry arduino-nRF5 package
Plain AVR
Attiny85, Attiny45 X X
Atmega328p, Atmega168 X X
Atmega32u4 X X
Plain ESP32
ESP32 X X library can be used as IDF component
Linux
Raspberry Pi X X i2c-dev, spidev, sys/class/gpio
SDL Emulation X X demo code can be run without real OLED HW via SDL library
Windows
SDL Emulation X X demo code can be run without real OLED HW via MinGW32 + SDL library

Digispark users, please check compilation options in your Arduino prior to using this library. Ssd1306 library requires at least c++11 and c99 (by default Digispark package misses the options -std=gnu11, -std=gnu++11).

Setting up

i2c Hardware setup is described here

Setting up for Arduino from github sources)

Setting up for Arduino from Arduino IDE library manager

  • Install ssd1306 library (named ssd1306 by Alexey Dynda) via Arduino IDE library manager

Using with plain avr-gcc:

  • Download source from https://github.com/lexus2k/ssd1306
  • Build the library (variant 1)
    • cd ssd1306/src && make -f Makefile.avr MCU=<your_mcu>
    • Link library to your project (refer to Makefile.avr in examples folder).
  • Build demo code (variant 2)
    • cd ssd1306/tools && ./build_and_run.sh -p avr -m <your_mcu> ssd1306_demo

For esp32:

  • Download source from https://github.com/lexus2k/ssd1306
  • Put downloaded sources to components/ssd1306/ folder.
  • Compile your project as described in ESP-IDF build system documentation

For more information about this library, please, visit https://github.com/lexus2k/ssd1306. Doxygen documentation can be found at github.io site. If you found any problem or have any idea, please, report to Issues section.

License

The library is free. If this project helps you, you can give me a cup of coffee. Donate via Paypal

MIT License

Copyright (c) 2016-2019, Alexey Dynda

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.