SSD1306Ascii

Public Member Functions | List of all members
SSD1306AsciiSpi Class Reference

Class for SPI displays on the hardware SPI bus. More...

`#include <SSD1306AsciiSpi.h>`

Inheritance diagram for SSD1306AsciiSpi:
[legend]
Collaboration diagram for SSD1306AsciiSpi:
[legend]

## Public Member Functions
void | begin (const DevType *dev, uint8_t cs, uint8_t dc)
| Initialize the display controller. More...
void | begin (const DevType *dev, uint8_t cs, uint8_t dc, uint8_t rst)
| Initialize the display controller. More...
uint8_t | charWidth (uint8_t c) const
| Determine the width of a character. More...
void | clear ()
| Clear the display and set the cursor to (0, 0).
void | clear (uint8_t c0, uint8_t c1, uint8_t r0, uint8_t r1)
| Clear a region of the display. More...
void | clearField (uint8_t col, uint8_t row, uint8_t n)
| Clear a field of n fieldWidth() characters. More...
void | clearToEOL ()
| Clear the display to the end of the current line. More...
uint8_t | col () const
uint8_t | displayHeight () const
void | displayRemap (bool mode)
| Set display to normal or 180 degree remap mode. More...
uint8_t | displayRows () const
uint8_t | displayWidth () const
size_t | fieldWidth (uint8_t n)
| Width of a field in pixels. More...
const uint8_t * | font () const
uint8_t | fontCharCount () const
char | fontFirstChar () const
uint8_t | fontHeight () const
uint8_t | fontRows () const
uint8_t | fontWidth () const
void | home ()
| Set the cursor position to (0, 0).
void | init (const DevType *dev)
| Initialize the display controller. More...
void | invertDisplay (bool invert)
| Set pixel mode for for entire display. More...
bool | invertMode () const
uint8_t | letterSpacing () const
uint8_t | magFactor () const
uint8_t | pageOffset () const
uint8_t | pageOffsetLine () const
uint8_t | row () const
void | scrollDisplay (int8_t lines)
| Scroll the Display window. More...
bool | scrollIsSynced () const
void | scrollMemory (int8_t rows)
| Scroll the RAM window. More...
void | set1X ()
| Set the character magnification factor to one.
void | set2X ()
| Set the character magnification factor to two.
void | setCol (uint8_t col)
| Set the current column number. More...
void | setContrast (uint8_t value)
| Set the display contrast. More...
void | setCursor (uint8_t col, uint8_t row)
| Set the cursor position. More...
void | setFont (const uint8_t *font)
| Set the current font. More...
void | setInvertMode (bool mode)
| Set invert mode for write/print. More...
void | setLetterSpacing (uint8_t pixels)
| Set letter-spacing. setFont() will restore default letter-spacing. More...
void | setPageOffset (uint8_t page)
| Set page offset. More...
void | setRow (uint8_t row)
| Set the current row number. More...
void | setScroll (bool enable)
| Enable or disable scroll mode. Deprecated use setScrollMode(). More...
void | setScrollMode (uint8_t mode)
| Set scroll mode. More...
void | setStartLine (uint8_t line)
| Set the display start line register. More...
void | ssd1306WriteCmd (uint8_t c)
| Write a command byte to the display controller. More...
void | ssd1306WriteRam (uint8_t c)
| Write a byte to RAM in the display controller. More...
void | ssd1306WriteRamBuf (uint8_t c)
| Write a byte to RAM in the display controller. More...
uint8_t | startLine () const
size_t | strWidth (const char *str) const
size_t | write (uint8_t c)
| Display a character. More...
size_t | write (const char *s)
| Display a string. More...

## Detailed Description

Class for SPI displays on the hardware SPI bus.

## Member Function Documentation

## ◆ begin() [1/2]

void SSD1306AsciiSpi::begin | ( | const DevType * | dev,
|  | uint8_t | cs,
|  | uint8_t | dc
| ) |  |
| inline

Initialize the display controller.

Parameters

  [in] | dev | A device initialization structure.
  [in] | cs | The display controller chip select pin.
  [in] | dc | The display controller data/command pin.

## ◆ begin() [2/2]

void SSD1306AsciiSpi::begin | ( | const DevType * | dev,
|  | uint8_t | cs,
|  | uint8_t | dc,
|  | uint8_t | rst
| ) |  |
| inline

Initialize the display controller.

Parameters

  [in] | dev | A device initialization structure.
  [in] | cs | The display controller chip select pin.
  [in] | dc | The display controller cdata/command pin.
  [in] | rst | The display controller reset pin.

## ◆ charWidth()

uint8_t SSD1306Ascii::charWidth | ( | uint8_t | c | ) | const
| inherited

Determine the width of a character.

Parameters

  [in] | c | Character code.

Returns
  Width of the character in pixels.

## ◆ clear()

void SSD1306Ascii::clear | ( | uint8_t | c0,
|  | uint8_t | c1,
|  | uint8_t | r0,
|  | uint8_t | r1
| ) |  |
| inherited

Clear a region of the display.

Parameters

  [in] | c0 | Starting column.
  [in] | c1 | Ending column.
  [in] | r0 | Starting row;
  [in] | r1 | Ending row;

Note
  The final cursor position will be (c0, r0).

## ◆ clearField()

void SSD1306Ascii::clearField | ( | uint8_t | col,
|  | uint8_t | row,
|  | uint8_t | n
| ) |  |
| inherited

Clear a field of n fieldWidth() characters.

Parameters

  [in] | col | Field start column.
  [in] | row | Field start row.
  [in] | n | Number of characters in the field.

## ◆ clearToEOL()

void SSD1306Ascii::clearToEOL | ( |  | ) |
| inherited

Clear the display to the end of the current line.

Note
  The number of rows cleared will be determined by the height of the current font.
  The cursor will be returned to the original position.

## ◆ col()

uint8_t SSD1306Ascii::col | ( |  | ) | const
| inline inherited

Returns
  The current column in pixels.

## ◆ displayHeight()

uint8_t SSD1306Ascii::displayHeight | ( |  | ) | const
| inline inherited

Returns
  The display hight in pixels.

## ◆ displayRemap()

void SSD1306Ascii::displayRemap | ( | bool | mode | ) |
| inherited

Set display to normal or 180 degree remap mode.

Parameters

  [in] | mode | true for normal mode, false for remap mode.

Note
  Adafruit and many ebay displays use remap mode. Use normal mode to rotate these displays 180 degrees.

## ◆ displayRows()

uint8_t SSD1306Ascii::displayRows | ( |  | ) | const
| inline inherited

Returns
  The display height in rows with eight pixels to a row.

## ◆ displayWidth()

uint8_t SSD1306Ascii::displayWidth | ( |  | ) | const
| inline inherited

Returns
  The display width in pixels.

## ◆ fieldWidth()

size_t SSD1306Ascii::fieldWidth | ( | uint8_t | n | ) |
| inherited

Width of a field in pixels.

Parameters

  [in] | n | Number of characters in the field.

Returns
  Width of the field.

## ◆ font()

const uint8_t* SSD1306Ascii::font | ( |  | ) | const
| inline inherited

Returns
  The current font pointer.

## ◆ fontCharCount()

uint8_t SSD1306Ascii::fontCharCount | ( |  | ) | const
| inherited

Returns
  The count of characters in a font.

## ◆ fontFirstChar()

char SSD1306Ascii::fontFirstChar | ( |  | ) | const
| inherited

Returns
  The first character in a font.

## ◆ fontHeight()

uint8_t SSD1306Ascii::fontHeight | ( |  | ) | const
| inherited

Returns
  The current font height in pixels.

## ◆ fontRows()

uint8_t SSD1306Ascii::fontRows | ( |  | ) | const
| inherited

Returns
  The number of eight pixel rows required to display a character in the current font.

## ◆ fontWidth()

uint8_t SSD1306Ascii::fontWidth | ( |  | ) | const
| inherited

Returns
  The maximum width of characters in the current font.

## ◆ init()

void SSD1306Ascii::init | ( | const DevType * | dev | ) |
| inherited

Initialize the display controller.

Parameters

  [in] | dev | A display initialization structure.

## ◆ invertDisplay()

void SSD1306Ascii::invertDisplay | ( | bool | invert | ) |
| inherited

Set pixel mode for for entire display.

Parameters

  [in] | invert | Inverted display if true or normal display if false.

## ◆ invertMode()

bool SSD1306Ascii::invertMode | ( |  | ) | const
| inline inherited

Returns
  invert mode.

## ◆ letterSpacing()

uint8_t SSD1306Ascii::letterSpacing | ( |  | ) | const
| inline inherited

Returns
  letter-spacing in pixels with magnification factor.

## ◆ magFactor()

uint8_t SSD1306Ascii::magFactor | ( |  | ) | const
| inline inherited

Returns
  The character magnification factor.

## ◆ pageOffset()

uint8_t SSD1306Ascii::pageOffset | ( |  | ) | const
| inline inherited

Returns
  the RAM page for top of the RAM window.

## ◆ pageOffsetLine()

uint8_t SSD1306Ascii::pageOffsetLine | ( |  | ) | const
| inline inherited

Returns
  the display line for pageOffset.

## ◆ row()

uint8_t SSD1306Ascii::row | ( |  | ) | const
| inline inherited

Returns
  the current row number with eight pixels to a row.

## ◆ scrollDisplay()

void SSD1306Ascii::scrollDisplay | ( | int8_t | lines | ) |
| inline inherited

Scroll the Display window.

Parameters

  [in] | lines | Number of lines to scroll the window.

## ◆ scrollIsSynced()

bool SSD1306Ascii::scrollIsSynced | ( |  | ) | const
| inline inherited

Returns
  true if the first display line is equal to the start of the RAM window.

## ◆ scrollMemory()

void SSD1306Ascii::scrollMemory | ( | int8_t | rows | ) |
| inline inherited

Scroll the RAM window.

Parameters

  [in] | rows | Number of rows to scroll the window.

## ◆ setCol()

void SSD1306Ascii::setCol | ( | uint8_t | col | ) |
| inherited

Set the current column number.

Parameters

  [in] | col | The desired column number in pixels.

## ◆ setContrast()

void SSD1306Ascii::setContrast | ( | uint8_t | value | ) |
| inherited

Set the display contrast.

Parameters

  [in] | value | The contrast level in th range 0 to 255.

## ◆ setCursor()

void SSD1306Ascii::setCursor | ( | uint8_t | col,
|  | uint8_t | row
| ) |  |
| inherited

Set the cursor position.

Parameters

  [in] | col | The column number in pixels.
  [in] | row | the row number in eight pixel rows.

## ◆ setFont()

void SSD1306Ascii::setFont | ( | const uint8_t * | font | ) |
| inherited

Set the current font.

Parameters

  [in] | font | Pointer to a font table.

## ◆ setInvertMode()

void SSD1306Ascii::setInvertMode | ( | bool | mode | ) |
| inline inherited

Set invert mode for write/print.

Parameters

  [in] | mode | Invert pixels if true and use normal mode if false.

## ◆ setLetterSpacing()

void SSD1306Ascii::setLetterSpacing | ( | uint8_t | pixels | ) |
| inline inherited

Set letter-spacing. setFont() will restore default letter-spacing.

Parameters

  [in] | pixels | letter-spacing in pixels before magnification.

## ◆ setPageOffset()

void SSD1306Ascii::setPageOffset | ( | uint8_t | page | ) |
| inherited

Set page offset.

Parameters

  [in] | page | the RAM page for start of the RAM window

## ◆ setRow()

void SSD1306Ascii::setRow | ( | uint8_t | row | ) |
| inherited

Set the current row number.

Parameters

  [in] | row | the row number in eight pixel rows.

## ◆ setScroll()

void SSD1306Ascii::setScroll | ( | bool | enable | ) |
| inline inherited

Enable or disable scroll mode. Deprecated use setScrollMode().

Parameters

  [in] | enable | true enable scroll on newline false disable scroll.

## ◆ setScrollMode()

void SSD1306Ascii::setScrollMode | ( | uint8_t | mode | ) |
| inline inherited

Set scroll mode.

Parameters

  [in] | mode | One of the following.

SCROLL_MODE_OFF - newline will not scroll the display or RAM window.

SCROLL_MODE_AUTO - newline will scroll both the display and RAM windows.

SCROLL_MODE_APP - newline scrolls the RAM window. The app scrolls the display window.

## ◆ setStartLine()

void SSD1306Ascii::setStartLine | ( | uint8_t | line | ) |
| inherited

Set the display start line register.

Parameters

  [in] | line | RAM line to be mapped to first display line.

## ◆ ssd1306WriteCmd()

void SSD1306Ascii::ssd1306WriteCmd | ( | uint8_t | c | ) |
| inline inherited

Write a command byte to the display controller.

Parameters

  [in] | c | The command byte.

Note
  The byte will immediately be sent to the controller.

## ◆ ssd1306WriteRam()

void SSD1306Ascii::ssd1306WriteRam | ( | uint8_t | c | ) |
| inherited

Write a byte to RAM in the display controller.

Parameters

  [in] | c | The data byte.

Note
  The byte will immediately be sent to the controller.

## ◆ ssd1306WriteRamBuf()

void SSD1306Ascii::ssd1306WriteRamBuf | ( | uint8_t | c | ) |
| inherited

Write a byte to RAM in the display controller.

Parameters

  [in] | c | The data byte.

Note
  The byte may be buffered until a call to ssd1306WriteCmd or ssd1306WriteRam.

## ◆ startLine()

uint8_t SSD1306Ascii::startLine | ( |  | ) | const
| inline inherited

Returns
  the display startline.

## ◆ strWidth()

size_t SSD1306Ascii::strWidth | ( | const char * | str | ) | const
| inherited

Parameters

  [in] | str | The pointer to string.

Returns
  the width of the string in pixels.

## ◆ write() [1/2]

size_t SSD1306Ascii::write | ( | uint8_t | c | ) |
| inherited

Display a character.

Parameters

  [in] | c | The character to display.

Returns
  the value one.

## ◆ write() [2/2]

size_t SSD1306Ascii::write | ( | const char * | s | ) |
| inherited

Display a string.

Parameters

  [in] | s | The string to display.

Returns
  The length of the string.

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

- Arduino/libraries/SSD1306Ascii/src/SSD1306AsciiSpi.h