Skip to content

Commit

Permalink
[Android] Add basic support for full eink updates (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
pazos authored and Frenzie committed Jan 30, 2019
1 parent 25bf128 commit 3990638
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion ffi/framebuffer_android.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit 3990638

Please sign in to comment.