Skip to content

SSD1309 full function driver library for general MCU and Linux.

License

Notifications You must be signed in to change notification settings

libdriver/ssd1309

Repository files navigation

English | 简体中文 | 繁體中文 | 日本語 | Deutsch | 한국어

LibDriver SSD1309

MISRA API License

SSD1309 is a single-chip CMOS OLED/PLED driver with controller for organic / polymer light emitting diode dot-matrix graphic display system. It consists of 128 segments and 64 commons. This IC is designed for Common Cathode type OLED panel.The SSD1309 embeds with contrast control, display RAM and oscillator, which reduces the number of external components and power consumption. It has 256-step brightness control. Data/Commands are sent from general MCU through the hardware selectable 6800/8000 series compatible Parallel Interface, I2C interface or Serial Peripheral Interface. It is suitable for many compact portable applications, such as mobile phone sub-display, MP3 player and calculator, etc.

LibDriver SSD1309 is the full function driver of SSD1309 launched by LibDriver.It provides the functions of drawing single point, filling block, image display, etc. LibDriver is MISRA compliant.

Table of Contents

Instruction

/src includes LibDriver SSD1309 source files.

/interface includes LibDriver SSD1309 IIC, SPI platform independent template.

/test includes LibDriver SSD1309 driver test code and this code can test the chip necessary function simply.

/example includes LibDriver SSD1309 sample code.

/doc includes LibDriver SSD1309 offline document.

/datasheet includes SSD1309 datasheet.

/project includes the common Linux and MCU development board sample code. All projects use the shell script to debug the driver and the detail instruction can be found in each project's README.md.

/misra includes the LibDriver MISRA code scanning results.

Install

Reference /interface IIC, SPI platform independent template and finish your platform IIC, SPI driver.

Add the /src directory, the interface driver for your platform, and your own drivers to your project, if you want to use the default example drivers, add the /example directory to your project.

Usage

You can refer to the examples in the /example directory to complete your own driver. If you want to use the default programming examples, here's how to use them.

example basic

#include "driver_ssd1309_basic.h"

uint8_t res;

res = ssd1309_basic_init(SSD1309_INTERFACE_IIC, SSD1309_ADDR_SA0_0);
if (res != 0)
{
    return 1;
}

...

res = ssd1309_basic_clear();
if (res != 0)
{
    ssd1309_interface_debug_print("ssd1309: clear screen failed.\n");
    (void)ssd1309_basic_deinit();

    return 1;
}
res = ssd1309_basic_string(0, 0, "123", 3, 1, SSD1309_FONT_16);
if (res != 0)
{
    ssd1309_interface_debug_print("ssd1309: show string failed.\n");
    (void)ssd1309_basic_deinit();

    return 1;
}

...

res = ssd1309_basic_rect(0, 31, 31, 31, 1);
if (res != 0)
{
    (void)ssd1309_basic_deinit();

    return 1;
}    

...

(void)ssd1309_basic_deinit();

return 0;

example advance

The image extraction format is as follows and every pixel stored in one byte.

#include "driver_ssd1309_advance.h"

uint8_t res;
uint8_t image[8192];

res = ssd1309_advance_init(SSD1309_INTERFACE_IIC, SSD1309_ADDR_SA0_0);
if (res != 0)
{
    return 1;
}

...

res = ssd1309_advance_clear();
if (res != 0)
{
    ssd1309_interface_debug_print("ssd1309: clear screen failed.\n");
    (void)ssd1309_advance_deinit();

    return 1;
}
res = ssd1309_advance_string(0, 0, "123", 3, 1, SSD1309_FONT_16);
if (res != 0)
{
    ssd1309_interface_debug_print("ssd1309: show string failed.\n");
    (void)ssd1309_advance_deinit();

    return 1;
}

...

res = ssd1309_advance_write_point(38, 38, 1);
if (res != 0)
{
    (void)ssd1309_advance_deinit();

    return 1;
}

...

res = ssd1309_advance_rect(0, 31, 31, 31, 1);
if (res != 0)
{
    (void)ssd1309_advance_deinit();

    return 1;
}

...

res = ssd1309_advance_vertical_left_horizontal_scroll(0, 7, 0, SSD1309_SCROLL_FRAME_2, 0, 127);
if (res != 0)
{
    (void)ssd1309_advance_deinit();

    return 1;
}

...

res = ssd1309_advance_picture(0, 0, 0, 0, image);
if (res != 0)
{
    (void)ssd1309_advance_deinit();

    return 1;
}

...

(void)ssd1309_advance_deinit();

return 0;

Document

Online documents: https://www.libdriver.com/docs/ssd1309/index.html.

Offline documents: /doc/html/index.html.

Contributing

Please refer to CONTRIBUTING.md.

License

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy

of this software and associated documentation files (the "Software"), to deal

in the Software without restriction, including without limitation the rights

to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

copies of the Software, and to permit persons to whom the Software is

furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all

copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

SOFTWARE.

Contact Us

Please send an e-mail to [email protected].