Skip to content

Commit

Permalink
Add support for QualcommOnyxEPDController (#1221)
Browse files Browse the repository at this point in the history
* Adds support for QualcommOnyxEPDController
* Refactors code to rely on epd constants returned from android-luajit-launcher
  • Loading branch information
Galunid committed Nov 6, 2020
1 parent a4dab90 commit ec3d502
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions ffi/framebuffer_android.lua
Expand Up @@ -11,14 +11,8 @@ local has_eink_screen, eink_platform = android.isEink()
-- does the device needs to handle all screen refreshes
local has_eink_full_support = android.isEinkFull()

-- for *some* rockchip devices
local rk_full, rk_partial, rk_a2, rk_auto = 1, 2, 3, 4 -- luacheck: ignore

-- for *some* freescale devices
local update_full, update_partial = 32, 0 -- luacheck: ignore
local waveform_du, waveform_gc16, waveform_regal = 1, 2, 7 -- luacheck: ignore
local partial_du, partial_gc16, partial_regal = waveform_du, waveform_gc16, waveform_regal -- luacheck: ignore
local full_gc16, full_regal = update_full + waveform_gc16, update_full + waveform_regal -- luacheck: ignore
local full, partial, full_ui, partial_ui, fast, delay_page, delay_ui, delay_fast = android.getEinkConstants()

local framebuffer = {}

Expand All @@ -35,18 +29,18 @@ end
-- update the entire screen
function framebuffer:_updateFull()
-- freescale ntx platform
if has_eink_screen and (eink_platform == "freescale") then
if has_eink_screen and (eink_platform == "freescale" or eink_platform == "qualcomm") then
if has_eink_full_support then
-- we handle the screen entirely. No delay is needed
self:_updatePartial(full_gc16, 0)
-- we handle the screen entirely
self:_updatePartial(full, delay_page)
else
-- we're racing against system driver. Let the system win and apply
-- a full update after it.
self:_updatePartial(full_gc16, 500)
self:_updatePartial(full, 500)
end
-- rockchip rk3x platform
elseif has_eink_screen and (eink_platform == "rockchip") then
android.einkUpdate(rk_full)
android.einkUpdate(full)
end
end

Expand Down Expand Up @@ -141,43 +135,43 @@ function framebuffer:_updateWindow()
android.lib.ANativeWindow_unlockAndPost(android.app.window);
end

function framebuffer:refreshFullImp(x, y, w, h)
function framebuffer:refreshFullImp(x, y, w, h) -- luacheck: ignore
self:_updateWindow()
self:_updateFull()
end

function framebuffer:refreshPartialImp(x, y, w, h)
self:_updateWindow()
if has_eink_full_support then
self:_updatePartial(partial_regal, 0, x, y, w, h)
self:_updatePartial(partial, delay_page, x, y, w, h)
end
end

function framebuffer:refreshFlashPartialImp(x, y, w, h)
self:_updateWindow()
if has_eink_full_support then
self:_updatePartial(full_regal, 0, x, y, w, h)
self:_updatePartial(full, delay_page, x, y, w, h)
end
end

function framebuffer:refreshUIImp(x, y, w, h)
self:_updateWindow()
if has_eink_full_support then
self:_updatePartial(partial_regal, 0, x, y, w, h)
self:_updatePartial(partial_ui, delay_ui, x, y, w, h)
end
end

function framebuffer:refreshFlashUIImp(x, y, w, h)
self:_updateWindow()
if has_eink_full_support then
self:_updatePartial(full_regal, 0, x, y, w, h)
self:_updatePartial(full_ui, delay_ui, x, y, w, h)
end
end

function framebuffer:refreshFastImp(x, y, w, h)
self:_updateWindow()
if has_eink_full_support then
self:_updatePartial(partial_du, 0, x, y, w, h)
self:_updatePartial(fast, delay_fast, x, y, w, h)
end
end

Expand Down

0 comments on commit ec3d502

Please sign in to comment.