Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • F firmware
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare
  • Issues 74
    • Issues 74
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 29
    • Merge requests 29
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • External wiki
    • External wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • card10card10
  • firmware
  • Merge requests
  • !211

First working implementation of framebuffer rendering in Python

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Florian Gross requested to merge flgr/firmware:flgr-framebuf into master Aug 23, 2019
  • Overview 18
  • Commits 2
  • Pipelines 2
  • Changes 3

Sample code:

import framebuf
import urandom
import display

bytes = bytearray(160 * 80 * 2)
fb = framebuf.FrameBuffer(bytes, 160, 80, framebuf.RGB565)
d = display.open()

while True:
    fb.scroll(-1, -1)
    for _ in range(10):
        rx = urandom.randint(0, 160 - 10)
        ry = urandom.randint(0, 80 - 10)
        fb.fill_rect(rx, ry, 10, 10, urandom.randint(0, 0b11111_111111_11111))
    display.sys_display.framebuffer(fb)

Would be cool to add Python plumbing for this. We could either wrap the framebuf module in more Python code to convert coordinates (top right corner is 0,0) and colors (5bit green red blue iirc) or add our own display format to the framebuf ext module maybe.

Edited Jan 10, 2021 by schneider
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: flgr-framebuf