glcd_ssd1306

Library for GLCD using the SSD1306 display controller.

Author Rob Jansen, Copyright © 2020..2026, all rights reserved.
Adapted-by
Compiler 2.5r9

Description

Text and graphics library for the graphic display module using 
             the SSD1306 display controller. The library supports displays
             with a resolution of 128 x 32 or 128 x 64 (default).


Sources

Library glcd_nokia_5110.jal used as starting point.
         SS1306 Data Sheet Revision 1.1 (April 2008)
         Adafruit_SSD1306 library and some others.         


Notes

This library supports the control of the display via one of two
       interfaces IIC or 4-wire SPI which depends on the interface that is 
       included by the main program before including this library. 
       This library supports control of the module using I2C software, 
       I2C hardware, I2C hardware2, SPI hardware and SPI hardware2. 
       Next to that the user can select a software SPI interface. In order 
       to use this define the following:
       -) const SSD1306_SOFTWARE_SPI = TRUE 


Dependencies


Summary

Global variables/contants

Procedures

Private

Functions

Private

API details

Global variables/contants

Procedures

  • ssd1306_display_resume()

    Description: Resume the display
    Parameters: 
     None
    
    

  • ssd1306_set_contrast(byte in contrast)

    Description: Set the display contrast
    Parameters: 
     contrast - 0x00..0xFF
    
    

  • ssd1306_send_command(byte in command)

    Description: Send a command to the 
    Parameters: 
     command - instruction for the SSD1306 from the datasheet
    
    

  • ssd1306_write_char(byte in x, byte in y, byte in char)

    Description: Write a character at position (x,y)
     It uses the font previously selected with glcd_font_use(FONT_ID) and honors
     glcd_background_color variable, and glcd_pen_color.
    Parameters: 
     x    - x-coordinate in range 0..SSD1306_MAX_X_PIXELS - 1
     y    - y-coordinate in range 0..SSD1306_MAX_Y_PIXELS - 1
     char - ASCII character
    Notes:
     Although x and y are given in pixels, the y coordindate will be mapped on
     display lines (pages) using glcd_font_current_height_. So when called y must
     always be defined in steps of glcd_font_current_height_. 
     When using glcd_common library, a glcd'put pseudo-variable will be defined,
     and can be called as an OUTPUT device (eg. glcd = "x").
     Only available when using fonts.
    
    

  • ssd1306_write_pixel(byte in x, byte in y)

    Description: Not implemented for text only mode
    Notes:
     Only defined as dummy procedure for the glcd_common library.
    
    

  • ssd1306_clear_cache()

    Description: Clear the graphics cache
    Parameters: 
     None
    Notes:
     Only used for graphics mode; sdd1306_update_display() must be called next. 
    
    

  • ssd1306_goto(byte in x, byte in y)

    Description: Set the display to given coordinates
    Parameters: 
     x - x-coordinate in range 0..SSD1306_MAX_X_PIXELS - 1
     y - page number in range 0..SSD1306_MAX_PAGES - 1
    Notes:
     Used in text mode. Text is positioned on page boundaries.
    
    

  • ssd1306_display_on()

    Description: Switch the display on
    Parameters: 
     None
    
    

  • ssd1306_start_scroll_right(byte in start, byte in stop)

    Description: Scroll the whole display right
    Parameters: 
     start - starting point
     stop  - ending point
    Notes:
     For scrolling the whole display start must be 0x00 and stop must be 0x07.
    
    

  • ssd1306_init()

    Description: Initialize the SSD1306 library and display
     When SPI is used and the reset pin is defined then the module will also be 
     hardware reset.
    Parameters: 
     None
    Notes:
     The use IIC interface or SPI interface must be initialized.
    
    

  • ssd1306_send_command_parameter(byte in command, byte in parameter)

    Description: Send a command to the SSD1306 with the given parameter 
    Parameters: 
     command   - instruction for the SSD1306 from the datasheet
     parameter - data for the SSD1306 as described in the datasheet
    
    

  • ssd1306_display_inverse()

    Description: Put the display in inverse mode
    Parameters: 
     None
    
    

  • ssd1306_start_scroll_left(byte in start, byte in stop)

    Description: Scroll the whole display left
    Parameters: 
     start - starting point
     stop  - ending point
    Notes:
     For scrolling the whole display start must be 0x00 and stop must be 0x07.
    
    

  • ssd1306_start_scroll_diagonal_right(byte in start, byte in stop)

    Description: Scroll the whole display right diagonal
    Parameters: 
     start - starting point
     stop  - ending point
    Notes:
     For scrolling the whole display start must be 0x00 and stop must be 0x07.
    
    

  • ssd1306_stop_scroll()

    Description: Stop scrolling the display
    Parameters: 
     None
    
    

  • ssd1306_set_start_line(byte in start_line)

    Description: Set the display start line.
     The procedure can be used to implement a vertical scroll feature.
    Parameters: 
     start_line - 0..SSD1305_MAX_Y_PIXELS - 1
    
    

  • ssd1306_start_scroll_diagonal_left(byte in start, byte in stop)

    Description: Scroll the whole display left diagonal
    Parameters: 
     start - starting point
     stop  - ending point
    Notes:
     For scrolling the whole display start must be 0x00 and stop must be 0x07.
    
    

  • ssd1306_display_all_on()

    Description: Put all segments of the display on
    Parameters: 
     None
    
    

  • ssd1306_display_off()

    Description: Switch the display off
    Parameters: 
     None
    
    

  • ssd1306_display_normal()

    Description: Put the display in normal (non-inverse) mode
    Parameters: 
     None
    
    

  • ssd1306_goto_pixel(byte in x, byte in y)

    Description: Set the display to given pixel coordinates
    Parameters: 
     x - x-coordinate in range 0..SSD1306_MAX_X_PIXELS - 1
     y - y-coordinate in range 0..SSD1306_MAX_Y_PIXELS - 1
    Notes:
     Used in graphics mode. Text is positioned on pixel coordinates.
    
    

  • ssd1306_clear_screen()

    Description: Clear the screen
    Parameters: 
     None
    Notes:
     Cursor is set to the position 0,0.
    
    

Private
  • _ssd1306_stop_transmission()

    Description: Stop an IIC transmission or SPI transmission
    Parameters: 
     None
    
    

  • _ssd1306_start_transmission(bit in transmission)

    Description: Start an IIC transmission or SPI data or command transmission 
    Parameters: 
     transmission - TRUE is data transmission, FALSE is command transmission
    
    

  • _ssd1306_write_one_data_byte(byte in data)

    Description: Write one data byte to the SSd1306
    Parameters: 
     data - data byte to be written.
    Notes:
     Used to send one data byte in one transmission. 
    
    

  • _ssd1306_write_byte(byte in data)

    Description: Write a byte to the SSD1306
    Parameters: 
     data - data byte to be written.
    Notes:
     Used to send a number of data bytes in one transmission.
     Transmission must have been started using _ssd1306_start_transmission() and
     must be stopped when done by using _ssd1306_stop_transmission().
    
    


Functions

Private

Related samples

Here are the list of samples which use this library:

16f182516f1825_dcf77_decoder_ssd1306.jal
16f182516f1825_nec_rc_decoder_ssd1306.jal
16f182516f1825_gps_neo_6m_ssd1306_clock.jal
16f182516f1825_glcd_ssd1306_font.jal
16f182516f1825_philips_rc_decoder_ssd1306.jal
16f1885716f18857_glcd_ssd1306_font_graphics.jal
16f1885716f18857_glcd_ssd1306_font.jal