Skip to content

Generic framebuffer implementation in Rust for use with embedded-graphics library

License

Notifications You must be signed in to change notification settings

jounathaen/embedded-graphics-framebuf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues Build Status MIT License LinkedIn


Embedded graphics logo

Framebuffer implementation for Rust's Embedded-graphics

Framebuffer approach helps to deal with display flickering when you update multiple parts of the display in separate operations. Intead, with this approach, you're going to write to a in-memory display and push it all at once into your hardware display when the whole picture is drawn.

This technique is useful when you're updating large portions of screen or just simply don't want to deal with partial display updates but comes at the cost of higher RAM usage.
The approach has been tested on TTGO (esp32) with ST7789
Explore the docs »

Rust Crate · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. License
  5. Contact
  6. Acknowledgments

About The Project

This library is a Rust implementation of framebuffer approach that is often used when driving hardware displays. The goal is to perform bulk-write of all the screen pixels at once, avoiding multiple individual updates that could lead to screen flickering.

This library has been designed to work with Rust's embedded-graphics library.

(back to top)

Built With

(back to top)

Getting Started

Make sure you have your rust environment configurated

Installation

  1. Add library to your Cargo.toml

    [dependencies]
    embedded-graphics-framebuf = "0.1.0"
  2. Use the library in you code

    use embedded_graphics_framebuf::FrameBuf;
    ...
    
    let mut display = st7789::ST7789::new(
        di,
        rst.into_output()?,
        // SP7789V is designed to drive 240x320 screens, even though the TTGO physical screen is smaller
        320,
        240,
    );
    
    let mut fbuff = FrameBuf<Rgb565, 240_usize, 135_usize> = FrameBuf([[Rgb565::BLACK; 240]; 135]);
    
    fbuff.clear_black();
    Text::new(
        &"Good luck!",
        Point::new(10, 13),
        MonoTextStyle::new(&FONT_10X20, Rgb565::WHITE.into()),
    )
    .draw(&mut fbuff).unwrap();
    
    display.draw_iter(fbuf.pixels()).unwrap();
  3. Your flickering problems should be solved at this point :)

(back to top)

Roadmap

  • add tests
  • add rustdocs
  • CI integration with GithHub Actions
  • better error generation & handling

See the open issues for a full list of proposed features (and known issues).

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Bernard Kobos - @bkobos - bkobos@gmail.com

Project Link: https://github.com/bernii/embedded-graphics-framebuf

(back to top)

Acknowledgments

(back to top)

About

Generic framebuffer implementation in Rust for use with embedded-graphics library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%