Skip to content

gega/sbuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sbuf

Scanline buffering for generic rendering engines on serial displays

Highlights

  • Scanline based buffering
  • No dynamic memory allocation
  • Minimal RAM needed
  • Double buffering to support DMA
  • Overlappig segments supported
  • Interlacing

Configuration

name default note
SBF_SW 240 width
SBF_SH 240 height
SBF_MAX_SECTIONS 8 max number of sections in a scanline, depends on the complexity of the object

RAM

  • two scanlines -- SBF_SW * 2
  • scanline buffer -- SBF_SH * SBF_MAX_SECTIONS * 4 bytes
  • work array -- SBF_SH / 2 bytes

Usage

  1. define SBUF_IMPLEMENTATION
  2. include sbuf.h
  3. implement the callback function
    void fill_scanline_type(uint8_t *buf, int y, int x0, int x1)
    {
      if( NULL == buf ) {
        // clear this scanline 'y' between x0 and x1 including x0 and x1
        // or render the background image to this area
      } else {
        // render the provided 'buf' to line 'y' from x0 to x1
      }
    }
  4. call sbf_init() once
  5. render your scene calling sbf_add_segment() as many times as needed NOTE: No more than SBF_MAX_SECTIONS calls per scanline!
  6. call sbf_render_frame() to render the result
  7. if interlacing is used, negate the flip marker

Demo

st7789-driver-demo.mp4

also using the ninety3d library

About

Scanline buffering for generic rendering engines on serial displays

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages