Skip to content

Instantly share code, notes, and snippets.

@boochow
Created May 12, 2018 04:16
Show Gist options
  • Save boochow/9ac4efaaa33370bd928129277ffa227e to your computer and use it in GitHub Desktop.
Save boochow/9ac4efaaa33370bd928129277ffa227e to your computer and use it in GitHub Desktop.
sd = SD()
os.mount(sd, '/sd')
os.chdir('sd')
import gpu, framebuf
gpu.fb_init(320, 240, screen_w=1920, screen_h=1080)
fb = framebuf.FrameBuffer(gpu.fb_data(), 320, 240, framebuf.RGB565)
fb.fill_rect(0, 0, 320, 240, 0)
f = open('test1.raw', 'rb')
for y in range(240):
line = f.read(320 * 3)
for x in range(320):
r = (line[x * 3] >> 3) << 11
g = (line[x * 3 + 1] >> 2) << 5
b = line[x * 3 + 2] >> 3
fb.pixel(x, y, r | g | b)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment