From 4131b5595d97a290376e2fa832eead445eb9b4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= Date: Tue, 29 Jan 2019 19:55:19 +0100 Subject: [PATCH] add basic support for full eink updates --- ffi/framebuffer_android.lua | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/ffi/framebuffer_android.lua b/ffi/framebuffer_android.lua index 260c9db96..1ba11ac45 100644 --- a/ffi/framebuffer_android.lua +++ b/ffi/framebuffer_android.lua @@ -3,6 +3,16 @@ local android = require("android") local BB = require("ffi/blitbuffer") local C = ffi.C +local has_eink_screen = android.isEink() +local full, partial, a2, auto = 1, 2, 3, 4 -- luacheck: ignore + +local function update_eink(mode) + if has_eink_screen then + android.LOGV("requesting eink update " .. mode) + android.einkUpdate(mode) + end +end + local framebuffer = {} function framebuffer:init() @@ -18,7 +28,7 @@ function framebuffer:init() framebuffer.parent.init(self) end -function framebuffer:refreshFullImp() +function framebuffer:_updateWindow() if android.app.window == nil then android.LOGW("cannot blit: no window") return @@ -60,4 +70,29 @@ function framebuffer:refreshFullImp() android.lib.ANativeWindow_unlockAndPost(android.app.window); end +function framebuffer:refreshFullImp() + self:_updateWindow() + update_eink(full) +end + +function framebuffer:refreshPartialImp() + self:_updateWindow() +end + +function framebuffer:refreshFlashPartialImp() + self:_updateWindow() +end + +function framebuffer:refreshUIImp() + self:_updateWindow() +end + +function framebuffer:refreshFlashUIImp() + self:_updateWindow() +end + +function framebuffer:refreshFastImp() + self:_updateWindow() +end + return require("ffi/framebuffer"):extend(framebuffer)