diff options
| author | Damien George | 2016-12-08 15:17:47 +1100 |
|---|---|---|
| committer | Damien George | 2016-12-08 15:17:47 +1100 |
| commit | 898d4c1217e69497c67ca2ddb66641406a03700b (patch) | |
| tree | bd55f50770afc479238181c7ca6307cd387a3882 /tests/extmod | |
| parent | ad166857bc93e519bca8c4f14523dcce654a5994 (diff) | |
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')
| -rw-r--r-- | tests/extmod/framebuf1.py | 3 | ||||
| -rw-r--r-- | tests/extmod/framebuf1.py.exp | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py index 7be365528..7f09050b0 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) diff --git a/tests/extmod/framebuf1.py.exp b/tests/extmod/framebuf1.py.exp index dae02ad86..4a83a2e9c 100644 --- a/tests/extmod/framebuf1.py.exp +++ b/tests/extmod/framebuf1.py.exp @@ -1,3 +1,4 @@ +0 bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff') bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') bytearray(b'\x01\x00\x00\x00\x01\x80\x00\x00\x00\x80') |
