Lost + Found SSD1306 OLED display driver library for Raspberry Pi Pico C SDK
  • C 90.2%
  • CMake 6%
  • Python 3.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-04 16:03:45 -07:00
.gitignore Initial commit: Lost + Found SSD1306 OLED display driver library with multi-resolution demo 2026-08-04 16:03:45 -07:00
CMakeLists.txt Initial commit: Lost + Found SSD1306 OLED display driver library with multi-resolution demo 2026-08-04 16:03:45 -07:00
conanfile.py Initial commit: Lost + Found SSD1306 OLED display driver library with multi-resolution demo 2026-08-04 16:03:45 -07:00
example.c Initial commit: Lost + Found SSD1306 OLED display driver library with multi-resolution demo 2026-08-04 16:03:45 -07:00
lf_ssd1306.c Initial commit: Lost + Found SSD1306 OLED display driver library with multi-resolution demo 2026-08-04 16:03:45 -07:00
lf_ssd1306.h Initial commit: Lost + Found SSD1306 OLED display driver library with multi-resolution demo 2026-08-04 16:03:45 -07:00
pico_sdk_import.cmake Initial commit: Lost + Found SSD1306 OLED display driver library with multi-resolution demo 2026-08-04 16:03:45 -07:00
README.md Initial commit: Lost + Found SSD1306 OLED display driver library with multi-resolution demo 2026-08-04 16:03:45 -07:00

lf-ssd1306

Re-usable SSD1306 OLED display driver library for the Raspberry Pi Pico C SDK, packaged as a Conan package. This driver supports both 128x32 and 128x64 pixel OLED display breakout modules connected via I2C.

This is part of the Lost + Found suite of projects.


🛠️ Usage with CMake

Copy the driver directory into your project as a subdirectory:

add_subdirectory(lib/lf-ssd1306)

target_link_libraries(your_project PRIVATE
    lf-ssd1306
)

And in your C/C++ source code:

#include "lf_ssd1306.h"

🔌 Hardware Setup

Connect your SSD1306 OLED display I2C pins to your Raspberry Pi Pico:

  • Pico GP4 (SDA) <-> Display SDA
  • Pico GP5 (SCL) <-> Display SCL
  • Pico GND <-> Display GND
  • Pico 3V3 OUT <-> Display VCC (Ensure it is powered at 3.3V, as Pico's GPIO pins are not 5V tolerant).

(Note: Pins can be configured on any available Pico I2C bus and GPIOs).


💡 Example

#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/i2c.h"
#include "lf_ssd1306.h"

#define I2C_PORT       i2c0
#define PIN_SDA        4
#define PIN_SCL        5
#define DISPLAY_WIDTH  128
#define DISPLAY_HEIGHT 32 // Can be 32 or 64

// Buffer size = (width * height) / 8
static uint8_t frame_buf[(DISPLAY_WIDTH * DISPLAY_HEIGHT) / 8];

int main() {
    stdio_init_all();
    sleep_ms(2000);

    // Initialize I2C
    i2c_init(I2C_PORT, 400 * 1000);
    gpio_set_function(PIN_SDA, GPIO_FUNC_I2C);
    gpio_set_function(PIN_SCL, GPIO_FUNC_I2C);
    gpio_pull_up(PIN_SDA);
    gpio_pull_up(PIN_SCL);

    // Create and initialize device context
    lf_ssd1306_t disp;
    if (!lf_ssd1306_init(&disp, I2C_PORT, 0x3C, DISPLAY_WIDTH, DISPLAY_HEIGHT, frame_buf)) {
        printf("Failed to initialize SSD1306 OLED at 0x3C!\n");
        return -1;
    }
    printf("SSD1306 OLED detected and initialized.\n");

    // Clear buffer, write some text, and render
    lf_ssd1306_clear(&disp);
    lf_ssd1306_write_string(&disp, 10, 12, "HELLO WORLD", true);
    lf_ssd1306_render(&disp);

    while (true) {
        sleep_ms(1000);
    }

    return 0;
}

⚙️ Prerequisites: Setting up Conan with uv

To install the Conan CLI package manager securely and in an isolated environment on your system, it is recommended to use uv:

# Install Conan globally as an isolated tool
uv tool install conan

📦 Consumption via Forgejo Conan Registry

The package is hosted and distributed through the Forgejo Conan Package Registry at git.clowderlabs.com.

1. Add the Remote Registry

Add the remote repository to your local Conan configuration:

conan remote add clowder https://git.clowderlabs.com/api/packages/blong/conan

2. Authenticate

Log in using your personal access token:

conan remote login -p <your_token> clowder <username>

3. Add to your Project

Add the dependency to your conanfile.txt (or conanfile.py):

[requires]
lf-ssd1306/0.0.1

Then install the dependencies:

conan install . --output-folder=build --build=missing

🛠️ Local Testing

To test building and exporting this Conan package locally without uploading, run:

conan export .

This will register lf-ssd1306/0.0.1 in your local Conan cache for offline testing.