SSD1306 Library  1.0.0
Library for SSD1306 OLed Driver based on libohiboard
SSD1306_Core

Data Structures

struct  _SSD1306_Config_t
 
struct  _SSD1306_Device_t
 

Typedefs

typedef struct _SSD1306_Config_t SSD1306_Config_t
 
typedef struct _SSD1306_Device_t SSD1306_Device_t
 
typedef struct _SSD1306_Device_tSSD1306_DeviceHandle_t
 

Functions

void SSD1306_init (SSD1306_DeviceHandle_t dev, SSD1306_Config_t *config)
 
GDL_Errors_t SSD1306_drawPixel (SSD1306_DeviceHandle_t dev, uint8_t xPos, uint8_t yPos, SSD1306_Color_t color)
 
void SSD1306_drawLine (SSD1306_DeviceHandle_t dev, uint8_t xStart, uint8_t yStart, uint8_t xStop, uint8_t yStop, SSD1306_Color_t color)
 
void SSD1306_drawHLine (SSD1306_DeviceHandle_t dev, uint8_t xStart, uint8_t yStart, uint8_t width, SSD1306_Color_t color)
 
void SSD1306_drawVLine (SSD1306_DeviceHandle_t dev, uint8_t xStart, uint8_t yStart, uint8_t height, SSD1306_Color_t color)
 
void SSD1306_drawRectangle (SSD1306_DeviceHandle_t dev, uint16_t xStart, uint16_t yStart, uint16_t width, uint16_t height, uint8_t color, bool isFill)
 
GDL_Errors_t SSD1306_drawChar (SSD1306_DeviceHandle_t dev, uint16_t xPos, uint16_t yPos, uint8_t c, uint8_t color, uint8_t size)
 
GDL_Errors_t SSD1306_drawString (SSD1306_DeviceHandle_t dev, uint16_t xPos, uint16_t yPos, const char *text, uint8_t color, uint8_t size)
 
GDL_Errors_t SSD1306_drawPicture (SSD1306_DeviceHandle_t dev, uint16_t xPos, uint16_t yPos, uint16_t width, uint16_t height, const uint8_t *picture)
 
void SSD1306_inverseDisplay (SSD1306_DeviceHandle_t dev)
 
void SSD1306_normalDisplay (SSD1306_DeviceHandle_t dev)
 
void SSD1306_scroll (SSD1306_DeviceHandle_t dev, bool scroll)
 
void SSD1306_clear (SSD1306_DeviceHandle_t dev)
 
void SSD1306_flush (SSD1306_DeviceHandle_t dev)
 
void SSD1306_on (SSD1306_DeviceHandle_t dev)
 
void SSD1306_off (SSD1306_DeviceHandle_t dev)
 
void SSD1306_setContrast (SSD1306_DeviceHandle_t dev, uint8_t value)
 

Detailed Description

Typedef Documentation

◆ SSD1306_Config_t

SSD1306 configuration struct. An object of this class must be used to save all module configurations.

◆ SSD1306_Device_t

SSD1306 device class.

◆ SSD1306_DeviceHandle_t

Function Documentation

◆ SSD1306_clear()

void SSD1306_clear ( SSD1306_DeviceHandle_t  dev)

This function clear the display content. At the same time, the function clear the local buffer content.

Parameters
[in]devThe handle of the device.

◆ SSD1306_drawChar()

GDL_Errors_t SSD1306_drawChar ( SSD1306_DeviceHandle_t  dev,
uint16_t  xPos,
uint16_t  yPos,
uint8_t  c,
uint8_t  color,
uint8_t  size 
)

The function print a char in the selected position with the selected color and size. The starting point is the top-left corner of the char.

Note
To send the design to the display, you must use SSD1306_flush
Parameters
[in]devThe handle of the device
[in]xPosThe x position
[in]yPosThe y position
[in]cThe char to be draw
[in]colorThe foreground color of the char
[in]sizeThe size for the char, if 0 use default dimension
Returns
  • GDL_ERRORS_WRONG_POSITION if the dimension plus position of the char exceeds the width or height of the display
  • GDL_ERRORS_SUCCESS otherwise.

◆ SSD1306_drawHLine()

void SSD1306_drawHLine ( SSD1306_DeviceHandle_t  dev,
uint8_t  xStart,
uint8_t  yStart,
uint8_t  width,
SSD1306_Color_t  color 
)

The function print a horizontal line from the selected position with the selected width and color.

Note
To send the design to the display, you must use SSD1306_flush
Parameters
[in]devThe handle of the device
[in]xStartThe starting x position
[in]yStartThe starting y position
[in]widthThe width of the line
[in]colorThe color of the line

◆ SSD1306_drawLine()

void SSD1306_drawLine ( SSD1306_DeviceHandle_t  dev,
uint8_t  xStart,
uint8_t  yStart,
uint8_t  xStop,
uint8_t  yStop,
SSD1306_Color_t  color 
)

The function print a line in the selected position with the selected color.

Note
To send the design to the display, you must use SSD1306_flush
Parameters
[in]devThe handle of the device
[in]xStartThe starting x position
[in]yStartThe starting y position
[in]xStopThe ending x position
[in]yStopThe ending y position
[in]colorThe color of the line

◆ SSD1306_drawPicture()

GDL_Errors_t SSD1306_drawPicture ( SSD1306_DeviceHandle_t  dev,
uint16_t  xPos,
uint16_t  yPos,
uint16_t  width,
uint16_t  height,
const uint8_t *  picture 
)

The function print a picture in the selected position with the selected color and size. The starting point is the top-left corner of the char.

Note
To send the design to the display, you must use SSD1306_flush
Parameters
[in]devThe handle of the device
[in]xPosThe x position
[in]yPosThe y position
[in]widthThe width of picture
[in]heightThe height of picture
[in]pictureThe array of the picture. Pay attention: every byte of the array represent 8 pixel in the same row.
Returns
  • GDL_ERRORS_WRONG_POSITION if the dimension plus position of the char exceeds the width or height of the display
  • GDL_ERRORS_SUCCESS otherwise.

◆ SSD1306_drawPixel()

GDL_Errors_t SSD1306_drawPixel ( SSD1306_DeviceHandle_t  dev,
uint8_t  xPos,
uint8_t  yPos,
SSD1306_Color_t  color 
)

This function draw a single pixel into internal buffer.

Note
To send the design to the display, you must use SSD1306_flush
Parameters
[in]devThe handle of the device
[in]xPosThe x position
[in]yPosThe y position
[in]colorThe color of the pixel
Returns

◆ SSD1306_drawRectangle()

void SSD1306_drawRectangle ( SSD1306_DeviceHandle_t  dev,
uint16_t  xStart,
uint16_t  yStart,
uint16_t  width,
uint16_t  height,
uint8_t  color,
bool  isFill 
)

The function draw a rectangle. It can be fill or not.

Note
To send the design to the display, you must use SSD1306_flush
Parameters
[in]devThe handle of the device
[in]xStartThe starting x position
[in]yStartThe starting y position
[in]widthThe ending x position
[in]heightThe ending y position
[in]colorThe color of the rectangle
[in]isFillIf TRUE the rectangle will be fill

◆ SSD1306_drawString()

GDL_Errors_t SSD1306_drawString ( SSD1306_DeviceHandle_t  dev,
uint16_t  xPos,
uint16_t  yPos,
const char *  text,
uint8_t  color,
uint8_t  size 
)

The function print a string in the selected position with the selected color and size. The starting point is the top-left corner of the char.

Note
To send the design to the display, you must use SSD1306_flush
Parameters
[in]devThe handle of the device
[in]xPosThe x position
[in]yPosThe y position
[in]textThe string to be draw
[in]colorThe foreground color of the char
[in]sizeThe size for the char, if 0 use default dimension
Returns
  • GDL_ERRORS_WRONG_POSITION if the dimension plus position of the char exceeds the width or height of the display
  • GDL_ERRORS_SUCCESS otherwise.

◆ SSD1306_drawVLine()

void SSD1306_drawVLine ( SSD1306_DeviceHandle_t  dev,
uint8_t  xStart,
uint8_t  yStart,
uint8_t  height,
SSD1306_Color_t  color 
)

The function print a vertical line from the selected position with the selected height and color.

Note
To send the design to the display, you must use SSD1306_flush
Parameters
[in]devThe handle of the device
[in]xStartThe starting x position
[in]yStartThe starting y position
[in]heightThe height of the line
[in]colorThe color of the line

◆ SSD1306_flush()

void SSD1306_flush ( SSD1306_DeviceHandle_t  dev)

This function writes all the buffer content to the display. The function wrties all pixel.

Parameters
[in]devThe handle of the device.

◆ SSD1306_init()

void SSD1306_init ( SSD1306_DeviceHandle_t  dev,
SSD1306_Config_t config 
)

The function initialize and configure the display.

Parameters
[in]devThe handle of the device.
[in]configA structure with all configuration parameters.

◆ SSD1306_inverseDisplay()

void SSD1306_inverseDisplay ( SSD1306_DeviceHandle_t  dev)

The function shows black pixels on white background.

Parameters
[in]devThe handle of the device

◆ SSD1306_normalDisplay()

void SSD1306_normalDisplay ( SSD1306_DeviceHandle_t  dev)

The function shows white pixels on black background.

Parameters
[in]devThe handle of the device

◆ SSD1306_off()

void SSD1306_off ( SSD1306_DeviceHandle_t  dev)

This function turn the OLED panel display OFF.

Parameters
[in]devThe handle of the device

◆ SSD1306_on()

void SSD1306_on ( SSD1306_DeviceHandle_t  dev)

This function turn the OLED panel display ON.

Parameters
[in]devThe handle of the device

◆ SSD1306_scroll()

void SSD1306_scroll ( SSD1306_DeviceHandle_t  dev,
bool  scroll 
)

The function starts or stop the motion of scrolling. The start scrolling should only be issued after the scroll setup parameters have been defined by the scrolling setup function.

Todo:
Implement the setup scrolling parameters function.
Parameters
[in]devThe handle of the device.
[in]scrollTRUE for enable the scrolling, FALSE otherwise.

◆ SSD1306_setContrast()

void SSD1306_setContrast ( SSD1306_DeviceHandle_t  dev,
uint8_t  value 
)

This function sets the contrast setting of the display. The display has 256 contrast steps: from 00h to FFh.

Parameters
[in]devThe handle of the device
[in]valueThe contrast value.