10 releases

0.3.1 Nov 12, 2023
0.3.0 Aug 16, 2023
0.2.0 Jun 9, 2023
0.1.6 Jan 7, 2023
0.1.3 Aug 16, 2022

#100 in Embedded development

Download history 29/week @ 2023-08-12 1/week @ 2023-08-19 10/week @ 2023-08-26 2/week @ 2023-09-02 13/week @ 2023-09-09 16/week @ 2023-09-16 3/week @ 2023-09-23 2/week @ 2023-09-30 3/week @ 2023-10-07 2/week @ 2023-10-14 5/week @ 2023-10-21 17/week @ 2023-10-28 35/week @ 2023-11-11 3/week @ 2023-11-18 35/week @ 2023-11-25

73 downloads per month


863 lines


DOGM132W-5 display showing the graphics example

Crates.io Crates.io License Build Status docs.rs

This crate aims to provide an embedded-graphics compatible driver for displays based on the ST7565 chipset.


The following example is intended for the DOGM132W-5 display connected to an nRF52840 microcontroller.

Note the MODE_3 of the SPI. The DOGM132W-5 display expects the clock to be configured with CPOL=1 and CPHA=1, which is also called SPI Mode 3.

// Create DOGM132W-5 spi bus
let disp_spi = SPIInterface::new(
        hal::spim::Pins {
            sck: disp_scl,
            mosi: Some(disp_si),
            miso: None,

// Create DOGM132W-5 display driver
let mut page_buffer = GraphicsPageBuffer::new();
let mut disp = ST7565::new(disp_spi, DOGM132W5).into_graphics_mode(&mut page_buffer);
disp.reset(&mut disp_rst, &mut timer).unwrap();

// Draw on it using the embedded_graphics library
Circle::new(Point::new(10, 6), 20)
    .into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 2))
    .draw(&mut disp)

Note the DOGM132W5 object. This is the display specification that contains all the display specific configuration options that need to be applied to the ST7565 chip.

Further note the into_graphics_mode() call, which switches the driver from its initial mode to the embedded-graphics driver mode. The disp object can then be used as a DrawTarget in embedded-graphics calls.

After drawing something, a flush() call has to be issued to actually send the modified data to the display.

Adding support for new ST7565 based displays

The example above uses the DOGM132W5 struct in the [ST7565::new()] call.

To initialize the ST7565 driver struct with a different display, a new display specification has to be created. This can be done by creating an empty struct that implements the DisplaySpecs trait.

For example, the definition of the DOGM132W5 struct looks like this:

pub struct DOGM132W5;
impl DisplaySpecs<132, 32, 4> for DOGM132W5 {
    const FLIP_ROWS: bool = false;
    const FLIP_COLUMNS: bool = true;
    const INVERTED: bool = false;
    const BIAS_MODE_1: bool = false;
    const POWER_CONTROL: PowerControlMode = PowerControlMode {
        booster_circuit: true,
        voltage_regulator_circuit: true,
        voltage_follower_circuit: true,
    const ELECTRONIC_VOLUME: u8 = 0b011111;
    const BOOSTER_RATIO: BoosterRatio = BoosterRatio::StepUp2x3x4x;

The exact values for the respective display have to be taken from the display's manual.

If you created a specification for a new display, please open a pull request on https://github.com/Finomnis/st7565/pulls to make it available to the public.