sh1107-driver

Crates.iosh1107-driver
lib.rssh1107-driver
version0.1.0
created_at2025-09-07 15:58:39.393194+00
updated_at2025-09-07 15:58:39.393194+00
descriptionI2C driver for the SH1107 display chip using embedded-hal
homepage
repository
max_upload_size
id1828278
size27,930
Ben Magill (BenMagill)

documentation

README

sh1107 driver

NOTE: this driver only supports the 128x64 display version currently, 128x128 may be supported in the future, but I do not have the hardware to test it myself.

Driver for the Adafruit FeatherWing OLED 128x64, supporting I2C communication ONLY.

  • It uses embedded_hal for I2C, so it can be used with any supported chip
  • Build with #![no_std] so it can be used with any chip
  • Can be used with both portrait and horizontal orientations
  • Includes optional graphics feature for text rendering functions
  • Based off Adafruit's C++ Arduino driver, which was used to understand how the chip works

This library is still under development, and all contributions and suggestions are welcome.

Example

// ...

use SH1107::{Rotation, SH1107Color};
use SH1107::SH1107;

fn main() {
  // ... other setup code

  let i2c_config = I2cConfig::new().baudrate(100.kHz().into());
  let i2c = I2cDriver::new(
      peripherals.i2c0,
      peripherals.pins.gpio19,
      peripherals.pins.gpio18,
      &i2c_config,
  )
  .unwrap();

  let mut sh1107 = SH1107::new(i2c);

  sh1107.begin();
  sh1107.rotation = Rotation::Wide;
  sh1107.display_all();
  sh1107.set_contrast(0x0F);

  sh1107.draw_string("Hello world!", 0, 0, true);
  sh1107.display_changed();
}
Commit count: 0

cargo fmt