Skip to content

i2s SSD1306 library for ESP8266_RTOS_SDK. This is a port from esp-open-rtos extra/ssd1306

License

Notifications You must be signed in to change notification settings

0x0aa/ESP8266-RTOS-SSD1306

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ESP8266-RTOS-SSD1306

SSD1306/SH1106 components for ESP8266_RTOS_SDK. This is a direct port from extras/ssd1306 component from esp-open-rtos.

However, only i2s protocol is supported. If I have SPI version, I'll try to port and test it.

You can use this module along with ESP8266-RTOS-FONTS to display text to oled display.

Compatibility

Usage

Clone this into your project components folder.

#include <stdio.h>

#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <driver/gpio.h>

#include <ssd1306/ssd1306.h>
#include <driver/i2c.h>
#include <esp_err.h>

#define SCL_PIN 5
#define SDA_PIN 4
#define DISPLAY_WIDTH 128
#define DISPLAY_HEIGHT 64

void app_main()
{
    // init i2s
    int i2c_master_port = I2C_NUM_0;
    i2c_config_t conf;
    conf.mode = I2C_MODE_MASTER;
    conf.sda_io_num = SDA_PIN;
    conf.sda_pullup_en = 1;
    conf.scl_io_num = SCL_PIN;
    conf.scl_pullup_en = 1;
    conf.clk_stretch_tick = 300;
    ESP_ERROR_CHECK(i2c_driver_install(i2c_master_port, conf.mode));
    ESP_ERROR_CHECK(i2c_param_config(i2c_master_port, &conf));

    // init ssd1306
    ssd1306_t dev = {
        .i2c_port = i2c_master_port,
        .i2c_addr = SSD1306_I2C_ADDR_0,
        .screen = SSD1306_SCREEN, // or SH1106_SCREEN
        .width = DISPLAY_WIDTH,
        .height = DISPLAY_HEIGHT};

    ssd1306_init(&dev);

}

About

i2s SSD1306 library for ESP8266_RTOS_SDK. This is a port from esp-open-rtos extra/ssd1306

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 99.9%
  • Makefile 0.1%