FabGL
ESP32 Display Controller and Graphics Library
SSD1306Controller Class Reference

Display driver for SSD1306 based OLED display, with I2C connection. More...

#include <SSD1306Controller.h>

Inherits GenericBitmappedDisplayController.

Public Member Functions

bool available ()
 Checks the SSD1306 device availability. More...
 
void begin ()
 Initializes SSD1306. More...
 
void begin (I2C *i2c, int address=0x3C, gpio_num_t resetGPIO=GPIO_UNUSED)
 Initializes SSD1306 assigning I2C bus, reset pin and address. More...
 
virtual int colorsCount ()
 Determines number of colors this display can provide. More...
 
DisplayControllerType controllerType ()
 Determines the display controller type. More...
 
void enableBackgroundPrimitiveExecution (bool value)
 Enables or disables drawings inside vertical retracing time. More...
 
void enableBackgroundPrimitiveTimeout (bool value)
 Enables or disables execution time limitation inside vertical retracing interrupt. More...
 
int getScreenHeight ()
 Determines the screen height in pixels. More...
 
int getScreenWidth ()
 Determines the screen width in pixels. More...
 
int getViewPortHeight ()
 Determines vertical size of the viewport. More...
 
int getViewPortWidth ()
 Determines horizontal size of the viewport. More...
 
void invert (bool value)
 Inverts display colors. More...
 
bool isDoubleBuffered ()
 Determines whether BitmappedDisplayController is on double buffered mode. More...
 
NativePixelFormat nativePixelFormat ()
 Represents the native pixel format used by this display. More...
 
void processPrimitives ()
 Draws immediately all primitives in the queue. More...
 
void refreshSprites ()
 Forces the sprites to be updated. More...
 
void removeSprites ()
 Empties the list of active sprites. More...
 
void resumeBackgroundPrimitiveExecution ()
 Resumes drawings after suspendBackgroundPrimitiveExecution(). More...
 
int screenCol ()
 Gets initial left column of the viewport. More...
 
int screenRow ()
 Gets initial top row of the viewport. More...
 
void setMouseCursor (Cursor *cursor)
 Sets mouse cursor and make it visible. More...
 
void setMouseCursor (CursorName cursorName)
 Sets mouse cursor from a set of predefined cursors. More...
 
void setMouseCursorPos (int X, int Y)
 Sets mouse cursor position. More...
 
void setOrientation (SSD1306Orientation value)
 Set display orientation and rotation. More...
 
void setResolution (char const *modeline, int viewPortWidth=-1, int viewPortHeight=-1, bool doubleBuffered=false)
 Sets SSD1306 resolution and viewport size. More...
 
void setScreenCol (int value)
 Set initial left column of the viewport. More...
 
void setScreenRow (int value)
 Set initial top row of the viewport. More...
 
template<typename T >
void setSprites (T *sprites, int count)
 Sets the list of active sprites. More...
 
void suspendBackgroundPrimitiveExecution ()
 Suspends drawings. More...
 

Static Public Attributes

static int queueSize = 1024
 Size of display controller primitives queue. More...
 

Detailed Description

Display driver for SSD1306 based OLED display, with I2C connection.

This driver should also work with SH1106 (untested).

Example:

fabgl::I2C               I2C;
fabgl::SSD1306Controller SSD1306Controller;

void setup() {
  // SDA = gpio-4, SCL = gpio-15  (WARN: disconnect VGA connector!!)
  I2C.begin(GPIO_NUM_4, GPIO_NUM_15);

  // default OLED address is 0x3C
  SSD1306Controller.begin(&I2C);
  SSD1306Controller.setResolution(OLED_128x64);

  Canvas cv(&SSD1306Controller);
  cv.clear();
  cv.drawText(0, 0, "Hello World!");
}
Examples
SSD1306_OLED/128x32/CollisionDetection/CollisionDetection.ino, SSD1306_OLED/128x32/SimpleTerminalOut/SimpleTerminalOut.ino, SSD1306_OLED/128x64/CollisionDetection/CollisionDetection.ino, SSD1306_OLED/128x64/DoubleBuffer/DoubleBuffer.ino, SSD1306_OLED/128x64/NetworkTerminal/NetworkTerminal.ino, SSD1306_OLED/128x64/RTClock/RTClock.ino, SSD1306_OLED/128x64/SimpleTerminalOut/SimpleTerminalOut.ino, and SSD1306_OLED/128x64/UI/UI.ino.

Definition at line 92 of file SSD1306Controller.h.


The documentation for this class was generated from the following files: