Treehopper C# API
Ssd1306 Class Reference

Solomon SSD1306 128x64 OLED display controller More...

Inheritance diagram for Ssd1306:
MonoGraphicDisplay GraphicDisplay ICharacterDisplay IFlushable

Public Types

enum  DisplaySize { Pixels128x32, Pixels128x64, Pixels96x16 }
 The size of the pixel array More...
 
enum  VccMode { External, SwitchCap }
 Whether VCC is supplied externally or internally More...
 

Public Member Functions

 Ssd1306 (I2C I2c, int width=128, int height=32, byte address=0x3C, int rate=400, VccMode mode=VccMode.SwitchCap)
 Construct a new SSD1306 OLED display More...
 
async Task SetCursorPosition (int left, int top)
 Set left/right cursor position More...
 
void SetPixel (int row, int column, bool state)
 Set a pixel's state. More...
 
async Task Write (dynamic value)
 Display an alphanumeric value using a 5x7 font at the given character column and row More...
 
async Task WriteLine (dynamic value)
 Write a line of text, advancing the cursor to the next line More...
 
override Task Clear ()
 Clear the display More...
 
Task FlushAsync (bool force=false)
 Flush changed data to the port expander More...
 

Protected Member Functions

override async Task flush ()
 Flush the display More...
 
override void setBrightness (double brightness)
 Set the global brightness of this display More...
 

Properties

bool [,] BoolBuffer [get, set]
 A bool array representing pixel states More...
 
bool [,] PixelBuffer [get, set]
 The raw byte buffer used by the display in its native format More...
 
int Columns [get]
 
int Rows [get]
 
int CursorLeft [get, set]
 
int CursorTop [get, set]
 
int Height [get, protected set]
 The height of the display, in pixels More...
 
int Width [get, protected set]
 The width of the display, in pixels. More...
 
byte [] RawBuffer [get, protected set]
 The raw byte buffer used by the display in its native format More...
 
double Brightness [get, set]
 Gets or sets the global brightness of the display More...
 
bool AutoFlush = true [get, set]
 
IFlushable Parent [get]
 

Detailed Description

Solomon SSD1306 128x64 OLED display controller

Member Enumeration Documentation

◆ DisplaySize

enum DisplaySize
strong

The size of the pixel array

Enumerator
Pixels128x32 

128x32 display

Pixels128x64 

128x64 display

Pixels96x16 

96x16 display

◆ VccMode

enum VccMode
strong

Whether VCC is supplied externally or internally

Enumerator
External 

External VCC supply

SwitchCap 

Switched-capacitor VCC supply

Constructor & Destructor Documentation

◆ Ssd1306()

Ssd1306 ( I2C  I2c,
int  width = 128,
int  height = 32,
byte  address = 0x3C,
int  rate = 400,
VccMode  mode = VccMode.SwitchCap 
)

Construct a new SSD1306 OLED display

Parameters
I2cThe I2c module to use
widthThe number of pixels wide
heightThe number of pixels tall
addressThe address
rateThe rate, in kHz, to use
modeThe VCC mode of the display

Member Function Documentation

◆ flush()

override async Task flush ( )
protectedvirtual

Flush the display

Returns
An awaitable task that completes when finished

Implements GraphicDisplay.

◆ setBrightness()

override void setBrightness ( double  brightness)
protectedvirtual

Set the global brightness of this display

Parameters
brightnessThe brightness, from 0-1, of this display

Implements GraphicDisplay.

◆ SetCursorPosition()

async Task SetCursorPosition ( int  left,
int  top 
)
inherited

Set left/right cursor position

Parameters
leftThe left position
topThe top position
Returns
An awaitable task that completes once the cursor is updated

Implements ICharacterDisplay.

◆ SetPixel()

void SetPixel ( int  row,
int  column,
bool  state 
)
inherited

Set a pixel's state.

You must explicitly flush to the display to write out the changes.

Parameters
rowThe row of the pixel
columnThe column of the pixel
stateWhether the pixel should be on or off

◆ Write()

async Task Write ( dynamic  value)
inherited

Display an alphanumeric value using a 5x7 font at the given character column and row

Parameters
valueThe alphanumeric value to use
Returns
An awaitable task that will finish upon completion

This method is used for quickly rendering fixed-size sharp, monospaced text on a monochrome graphic display, allowing these displays to be dropped into a project in place of a (usually more costly and older) character display. If you want control over the size and font family used to display the text, use the extremely extensible System.Drawing.Graphics class.

If you want control over

Implements ICharacterDisplay.

◆ WriteLine()

async Task WriteLine ( dynamic  value)
inherited

Write a line of text, advancing the cursor to the next line

Parameters
valuethe text to write
Returns
An awaitable task that completes when finished

Implements ICharacterDisplay.

◆ Clear()

override Task Clear ( )
virtualinherited

Clear the display

Returns
An awaitable task

Reimplemented from GraphicDisplay.

◆ FlushAsync()

Task FlushAsync ( bool  force = false)
inherited

Flush changed data to the port expander

Parameters
forcewhether to flush all data to the port expander, even if it doesn't appear to have been changed

Implements IFlushable.

Property Documentation

◆ BoolBuffer

bool [,] BoolBuffer
getset

A bool array representing pixel states

◆ PixelBuffer

bool [,] PixelBuffer
getsetinherited

The raw byte buffer used by the display in its native format

The format of this raw buffer depends on the particular implementation of this class

◆ Columns

int Columns
getinherited

◆ Rows

int Rows
getinherited

◆ CursorLeft

int CursorLeft
getsetinherited

◆ CursorTop

int CursorTop
getsetinherited

◆ Height

int Height
getprotected setinherited

The height of the display, in pixels

◆ Width

int Width
getprotected setinherited

The width of the display, in pixels.

◆ RawBuffer

byte [] RawBuffer
getprotected setinherited

The raw byte buffer used by the display in its native format

The format of this raw buffer depends on the particular implementation of this class

◆ Brightness

double Brightness
getsetinherited

Gets or sets the global brightness of the display

◆ AutoFlush

bool AutoFlush = true
getsetinherited

◆ Parent

IFlushable Parent
getinherited

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