forked from marcelstoer/nodemcu-max7219
-
Notifications
You must be signed in to change notification settings - Fork 0
/
font7seg.lua
80 lines (77 loc) · 1.6 KB
/
font7seg.lua
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
local modname = ...
local M = {}
_G[modname] = M
local digits = {}
digits[" "] = 0x00
digits["-"] = 0x01
digits["_"] = 0x08
digits["0"] = 0x7e
digits["1"] = 0x30
digits["2"] = 0x6d
digits["3"] = 0x79
digits["4"] = 0x33
digits["5"] = 0x5b
digits["6"] = 0x5f
digits["7"] = 0x70
digits["8"] = 0x7f
digits["9"] = 0x7b
digits["a"] = 0x7d
digits["b"] = 0x1f
digits["c"] = 0x0d
digits["d"] = 0x3d
digits["e"] = 0x6f
digits["f"] = 0x47
digits["g"] = 0x7b
digits["h"] = 0x17
digits["i"] = 0x10
digits["j"] = 0x18
--digits["k"] = 0x08 -- not supported
digits["l"] = 0x06
--digits["m"] = 0x08 -- not supported
digits["n"] = 0x15
digits["o"] = 0x1d
digits["p"] = 0x67
digits["q"] = 0x73
digits["r"] = 0x05
digits["s"] = 0x5b
digits["t"] = 0x0f
digits["u"] = 0x1c
digits["v"] = 0x1c
--digits["w"] = 0x08 -- not supported
--digits["x"] = 0x08 -- not supported
digits["y"] = 0x3b
digits["z"] = 0x6d
digits["A"] = 0x77
digits["B"] = 0x7f
digits["C"] = 0x4e
digits["D"] = 0x7e
digits["E"] = 0x4f
digits["F"] = 0x47
digits["G"] = 0x5e
digits["H"] = 0x37
digits["I"] = 0x30
digits["J"] = 0x38
--digits["K"] = 0x08 -- not supported
digits["L"] = 0x0e
--digits["M"] = 0x08 -- not supported
digits["N"] = 0x76
digits["O"] = 0x7e
digits["P"] = 0x67
digits["Q"] = 0x73
digits["R"] = 0x46
digits["S"] = 0x5b
digits["T"] = 0x0f
digits["U"] = 0x3e
digits["V"] = 0x3e
--digits["W"] = 0x08 -- not supported
--digits["X"] = 0x08 -- not supported
digits["Y"] = 0x3b
digits["Z"] = 0x6d
digits[","] = 0x80
digits["."] = 0x80
digits["°"] = 0x63
function M.GetChar(char)
local r = digits[char]
if (r == nil) then return digits["_"] else return r end
end
return M