forked from caternuson/rpi-weather
-
Notifications
You must be signed in to change notification settings - Fork 0
/
led8x8icons.py
executable file
·94 lines (93 loc) · 4.08 KB
/
led8x8icons.py
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
81
82
83
84
85
86
87
88
89
90
91
92
93
#===============================================================================
# led8x8icons.py
#
# Dictionary of LED 8x8 matrix icons as 64 bit values.
#
# Code snippet for computing value from bitmap:
#
# BITMAP = [
# [1, 1, 1, 1, 1, 1, 1, 1,],
# [1, 1, 0, 0, 0, 0, 0, 1,],
# [1, 0, 1, 0, 0, 0, 0, 1,],
# [1, 0, 0, 1, 0, 0, 0, 1,],
# [1, 0, 0, 0, 1, 0, 0, 1,],
# [1, 0, 0, 0, 0, 1, 0, 1,],
# [1, 0, 0, 0, 0, 0, 1, 1,],
# [1, 0, 0, 0, 0, 0, 0, 1,],
# ]
# value = 0
# for y,row in enumerate(BITMAP):
# row_byte = 0
# for x,bit in enumerate(row):
# row_byte += bit<<x
# value += row_byte<<(8*y)
# print '0x'+format(value,'02x')
#
# Code snippet for setting individual LEDs on the display.
#
# def set_raw64(value):
# led8x8matrix.clear()
# for y in xrange(8):
# row_byte = value>>(8*y)
# for x in xrange(8):
# pixel_bit = row_byte>>x&1
# led8x8matrix.set_pixel(x,y,pixel_bit)
# led8x8mmatrix.write_display()
#
# 2014-10-20
# Carter Nelson
#==============================================================================
LED8x8ICONS = {
#---------------------------------------------------------
# default
#---------------------------------------------------------
'' : 0x0000000000000000 ,
#---------------------------------------------------------
# misc
#---------------------------------------------------------
'ALL_ON' : 0xffffffffffffffff ,
'ALL_OFF' : 0x0000000000000000 ,
'UNKNOWN' : 0x00004438006c6c00 ,
'BOTTOM_ROW' : 0xff00000000000000 ,
'TOP_ROW' : 0x00000000000000ff ,
'LEFT_COL' : 0x0101010101010101 ,
'RIGHT_COL' : 0x8080808080808080 ,
'BOX' : 0xff818181818181ff ,
'XBOX' : 0xffc3a59999a5c3ff ,
#---------------------------------------------------------
# weather
#---------------------------------------------------------
'SUNNY' : 0x9142183dbc184289 ,
'RAIN' : 0x55aa55aa55aa55aa ,
'CLOUD' : 0x00007e818999710e ,
'SHOWERS' : 0x152a7e818191710e ,
'SNOW' : 0xa542a51818a542a5 ,
'STORM' : 0x0a04087e8191710e ,
'MOON' : 0x1824120949122418 ,
#---------------------------------------------------------
# digits
#---------------------------------------------------------
'0' : 0x003c42464a52623c ,
'1' : 0x003e0808080e0808 ,
'2' : 0x007e02023c40403e ,
'3' : 0x003e40403040403e ,
'4' : 0x004040407e424242 ,
'5' : 0x003e40403e02027e ,
'6' : 0x003c42423e02027c ,
'7' : 0x004040404042427e ,
'8' : 0x003c42423c42423c ,
'9' : 0x003c40407c42423c ,
#---------------------------------------------------------
# kanji digits
#---------------------------------------------------------
'KANJI_0' : 0x3c4281818181423c ,
'KANJI_1' : 0x000000ff00000000 ,
'KANJI_2' : 0x00ff0000007e0000 ,
'KANJI_3' : 0xff00003c00007e00 ,
'KANJI_4' : 0x81ff81b3d59595ff ,
'KANJI_5' : 0xff44487e08087e00 ,
'KANJI_6' : 0x81422400ff080804 ,
'KANJI_7' : 0x788808087e080800 ,
'KANJI_8' : 0xc162241414141400 ,
'KANJI_9' : 0x61a22424243f0404 ,
}