summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/framebuf1.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-12-08 15:17:47 +1100
committerDamien George <damien.p.george@gmail.com>2016-12-08 15:17:47 +1100
commit898d4c1217e69497c67ca2ddb66641406a03700b (patch)
treebd55f50770afc479238181c7ca6307cd387a3882 /tests/extmod/framebuf1.py
parentad166857bc93e519bca8c4f14523dcce654a5994 (diff)
downloadmicropython-898d4c1217e69497c67ca2ddb66641406a03700b.tar.gz
micropython-898d4c1217e69497c67ca2ddb66641406a03700b.zip
extmod/modframebuf: Make framebuf implement the buffer protocol.
So that one can easily access the underlying data of the frame buffer, eg to write the data out to a display.
Diffstat (limited to 'tests/extmod/framebuf1.py')
-rw-r--r--tests/extmod/framebuf1.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py
index 7be3655284..7f09050b04 100644
--- a/tests/extmod/framebuf1.py
+++ b/tests/extmod/framebuf1.py
@@ -10,6 +10,9 @@ h = 16
buf = bytearray(w * h // 8)
fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.MVLSB)
+# access as buffer
+print(memoryview(fbuf)[0])
+
# fill
fbuf.fill(1)
print(buf)