LCDGFX LCD display driver  1.2.0
Lightweight graphics library for SSD1306, SSD1325, SSD1327, SSD1331, SSD1351, SH1106, SH1107, IL9163, ST7735, ST7789, ILI9341, PCD8544 displays over I2C/SPI
InterfaceSSD1306< I > Class Template Reference

Class implements interface functions to SSD1306 displays. More...

#include <lcd_ssd1306.h>

Inheritance diagram for InterfaceSSD1306< I >:
Collaboration diagram for InterfaceSSD1306< I >:

Public Member Functions

template<typename... Args>
 InterfaceSSD1306 (NanoDisplayBase< InterfaceSSD1306< I >> &base, int8_t dc, Args &&... data)
 Creates instance of interface to LCD display. More...
 
void startBlock (lcduint_t x, lcduint_t y, lcduint_t w)
 Sets block in RAM of lcd display controller to write data to. More...
 
void nextBlock ()
 Switches to the start of next RAM page for the block, specified by startBlock(). More...
 
void endBlock ()
 Closes data send operation to lcd display.
 
void setDataMode (uint8_t mode)
 Enables either data or command mode on SPI bus. More...
 
void commandStart ()
 Starts communication with LCD display in command mode. More...
 
void setStartLine (uint8_t line)
 Sets start line in GDRAM to begin display content with. More...
 
uint8_t getStartLine ()
 Returns the current start line offset in GDRAM. More...
 
void normalMode ()
 Switches display back to normal (non-inverted) mode. More...
 
void invertMode ()
 Switches display to inverted mode. More...
 
void setContrast (uint8_t contrast)
 Sets display contrast (brightness level). More...
 
void displayOff ()
 Turns off the display (enters sleep mode). More...
 
void displayOn ()
 Turns on the display, resuming normal output. More...
 
void flipHorizontal (uint8_t mode)
 Performs horizontal flip. More...
 
void flipVertical (uint8_t mode)
 Performs vertical flip. More...
 

Detailed Description

template<typename I>
class InterfaceSSD1306< I >

Class implements interface functions to SSD1306 displays.

Definition at line 43 of file lcd_ssd1306.h.

Constructor & Destructor Documentation

◆ InterfaceSSD1306()

template<typename I>
template<typename... Args>
InterfaceSSD1306< I >::InterfaceSSD1306 ( NanoDisplayBase< InterfaceSSD1306< I >> &  base,
int8_t  dc,
Args &&...  data 
)
inline

Creates instance of interface to LCD display.

Parameters
baseReference to base class, which represents Display
dcData/command control pin number, for i2c communication should be -1
datavariable argument list, accepted by platform interface (PlatformI2c, PlatformSpi)

Definition at line 54 of file lcd_ssd1306.h.

Member Function Documentation

◆ commandStart()

template<class I >
void InterfaceSSD1306< I >::commandStart ( )

Starts communication with LCD display in command mode.

To stop communication use m_intf.end().

Definition at line 74 of file lcd_ssd1306.inl.

◆ displayOff()

template<class I >
void InterfaceSSD1306< I >::displayOff ( )

Turns off the display (enters sleep mode).

Contents of display RAM are preserved.

See also
displayOn()

Definition at line 118 of file lcd_ssd1306.inl.

◆ displayOn()

template<class I >
void InterfaceSSD1306< I >::displayOn ( )

Turns on the display, resuming normal output.

See also
displayOff()

Definition at line 125 of file lcd_ssd1306.inl.

◆ flipHorizontal()

template<class I >
void InterfaceSSD1306< I >::flipHorizontal ( uint8_t  mode)

Performs horizontal flip.

Performs horizontal flip. To rotate the display by 180°, use both flipHorizontal() and flipVertical().

Parameters
mode0 to disable horizontal flip, 1 to enable
See also
flipVertical()

Definition at line 132 of file lcd_ssd1306.inl.

◆ flipVertical()

template<class I >
void InterfaceSSD1306< I >::flipVertical ( uint8_t  mode)

Performs vertical flip.

Performs vertical flip. To rotate the display by 180°, use both flipHorizontal() and flipVertical().

Parameters
mode0 to disable vertical flip, 1 to enable
See also
flipHorizontal()

Definition at line 139 of file lcd_ssd1306.inl.

◆ getStartLine()

template<class I >
uint8_t InterfaceSSD1306< I >::getStartLine ( )

Returns the current start line offset in GDRAM.

Returns
current start line value
See also
setStartLine()

Definition at line 91 of file lcd_ssd1306.inl.

◆ invertMode()

template<class I >
void InterfaceSSD1306< I >::invertMode ( )

Switches display to inverted mode.

In this mode, lit pixels become dark and dark pixels become lit.

See also
normalMode()

Definition at line 103 of file lcd_ssd1306.inl.

◆ nextBlock()

template<class I >
void InterfaceSSD1306< I >::nextBlock ( )

Switches to the start of next RAM page for the block, specified by startBlock().

For SSD1306 it does nothing, while for sh1106 the function moves cursor to next page.

Definition at line 56 of file lcd_ssd1306.inl.

◆ normalMode()

template<class I >
void InterfaceSSD1306< I >::normalMode ( )

Switches display back to normal (non-inverted) mode.

See also
invertMode()

Definition at line 96 of file lcd_ssd1306.inl.

◆ setContrast()

template<class I >
void InterfaceSSD1306< I >::setContrast ( uint8_t  contrast)

Sets display contrast (brightness level).

Higher values produce brighter output.

Parameters
contrastcontrast value (0–255), refer to SSD1306 datasheet
See also
displayOn()

Definition at line 110 of file lcd_ssd1306.inl.

◆ setDataMode()

template<class I >
void InterfaceSSD1306< I >::setDataMode ( uint8_t  mode)

Enables either data or command mode on SPI bus.

Parameters
mode1 to enable data mode, or 0 to enable command mode

Definition at line 66 of file lcd_ssd1306.inl.

◆ setStartLine()

template<class I >
void InterfaceSSD1306< I >::setStartLine ( uint8_t  line)

Sets start line in GDRAM to begin display content with.

Used for hardware scrolling effects.

Parameters
linestart line in range 0–63
See also
getStartLine()

Definition at line 83 of file lcd_ssd1306.inl.

◆ startBlock()

template<class I >
void InterfaceSSD1306< I >::startBlock ( lcduint_t  x,
lcduint_t  y,
lcduint_t  w 
)

Sets block in RAM of lcd display controller to write data to.

Sets block in RAM of lcd display controller to write data to. For SSD1306 it uses horizontal addressing mode, while for sh1106 the function uses page addressing mode. Width can be specified as 0, thus the library will set the right boundary to region of RAM block to the right column of the display.

Parameters
x- column (left region)
y- row (top region)
w- width of the block in pixels to control
Warning
- this function initiates session (i2c or spi) and does not close it. To close session, please, call endBlock().

Definition at line 35 of file lcd_ssd1306.inl.


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