aboutsummaryrefslogtreecommitdiff
path: root/display.oled.lua
blob: d68c214648dcd5e939d49ec143f802017e2253ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
local oled = require 'oled'

local display = {}

function display.init()
    oled.init()
    oled.update(function(disp)
        local output = 'Hello!'
        disp:setFont(u8g.font_gdr12)
        disp:setFontPosCenter()
        local w = disp:getStrWidth(output)
        disp:drawStr(64 - w / 2, 16, output)
    end)
end

function display.output(txt)
    oled.update(function(disp)
        disp:setFont(u8g.font_gdr30n)
        disp:setFontPosCenter()
        local w = disp:getStrWidth(txt)
        disp:drawStr(64 - w / 2, 16, txt)
    end)
end

return display