v0.1.0: added max7219 support, added signal handling

This commit is contained in:
Jan
2019-09-26 10:17:02 +02:00
parent 930a517982
commit 52a0af1d91
6 changed files with 716 additions and 192 deletions

28
changes.txt Normal file
View File

@@ -0,0 +1,28 @@
0.1.0:
* Added additional logging messages for end of alarm
* implemented SIGINT (Ctrl-C) handling to exit gracefully
0.0.5:
* initial working version
* show alarmtime in startup
------------------------------------------------------------
issues
------
* alarmtime 15min -> 30min
* max7219 1st second of alarm 100% brightness issue
* address more than the 1st 10 tracks
* more clear log entry when demoing sample track editing tracklist
* change 5 seconds of track demo to on-off click method
todo
----
add SIGHUP handling for reload config
changes config file format to json

527
clocky-font.py Normal file
View File

@@ -0,0 +1,527 @@
#: Bit patterns for SIXBYEIGHT_FONT,
#: source: https://www.urbanfonts.com/fonts/Led_8x6.font
#:
#: NOTE: Only characters 0x30 - 0x39 are 6x8
#: All others will appear as blanks
SIXBYEIGHT_FONT = [
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x00
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x01
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x02
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x03
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x04
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x05
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x06
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x07
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x08
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x09
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0A
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0B
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0C
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0D
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0E
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0F
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x10
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x11
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x12
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x13
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x14
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x15
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x16
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x17
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x18
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x19
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1A
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1B
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1C
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1D
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1E
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1F
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # ' '
[0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00], # '!'
[0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00], # '"'
[0x00, 0x24, 0x7E, 0x24, 0x24, 0x7E, 0x24, 0x00], # '#'
[0x00, 0x2E, 0x2A, 0x7F, 0x2A, 0x3A, 0x00, 0x00], # '$'
[0x00, 0x46, 0x26, 0x10, 0x08, 0x64, 0x62, 0x00], # '%'
[0x00, 0x20, 0x54, 0x4A, 0x54, 0x20, 0x50, 0x00], # '&'
[0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00], # '''
[0x00, 0x00, 0x00, 0x3C, 0x42, 0x00, 0x00, 0x00], # '('
[0x00, 0x00, 0x00, 0x42, 0x3C, 0x00, 0x00, 0x00], # ')'
[0x00, 0x10, 0x54, 0x38, 0x54, 0x10, 0x00, 0x00], # '*'
[0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00], # '+'
[0x00, 0x00, 0x00, 0x80, 0x60, 0x00, 0x00, 0x00], # '
[0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00], # '-'
[0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00], # '.'
[0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00], # '/'
[0x7E, 0xFF, 0x81, 0x81, 0xFF, 0x7E, 0x00, 0x00], # '0'
[0x00, 0x82, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00], # '1'
[0xC2, 0xE3, 0xB1, 0x99, 0x8F, 0x86, 0x00, 0x00], # '2'
[0x42, 0xC3, 0x81, 0x89, 0xFF, 0x76, 0x00, 0x00], # '3'
[0x38, 0x3C, 0x26, 0xF3, 0xF1, 0x20, 0x00, 0x00], # '4'
[0x4F, 0xCF, 0x89, 0x89, 0xF9, 0x71, 0x00, 0x00], # '5'
[0x7E, 0xFF, 0x89, 0x89, 0xFB, 0x72, 0x00, 0x00], # '6'
[0x03, 0x03, 0xF1, 0xF9, 0x0F, 0x07, 0x00, 0x00], # '7'
[0x76, 0xFF, 0x89, 0x89, 0xFF, 0x76, 0x00, 0x00], # '8'
[0x46, 0xCF, 0x89, 0x89, 0xFF, 0x7E, 0x00, 0x00], # '9'
[0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00], # ':'
[0x00, 0x00, 0x80, 0x64, 0x00, 0x00, 0x00, 0x00], # ';'
[0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00], # '<'
[0x00, 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00], # '='
[0x00, 0x00, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00], # '>'
[0x00, 0x04, 0x02, 0x02, 0x52, 0x0A, 0x04, 0x00], # '?'
[0x00, 0x3C, 0x42, 0x5A, 0x56, 0x5A, 0x1C, 0x00], # '@'
[0x7C, 0x12, 0x12, 0x12, 0x12, 0x7C, 0x00, 0x00], # 'A'
[0x7E, 0x4A, 0x4A, 0x4A, 0x4A, 0x34, 0x00, 0x00], # 'B'
[0x3C, 0x42, 0x42, 0x42, 0x42, 0x24, 0x00, 0x00], # 'C'
[0x7E, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00], # 'D'
[0x7E, 0x4A, 0x4A, 0x4A, 0x4A, 0x42, 0x00, 0x00], # 'E'
[0x7E, 0x0A, 0x0A, 0x0A, 0x0A, 0x02, 0x00, 0x00], # 'F'
[0x3C, 0x42, 0x42, 0x52, 0x52, 0x34, 0x00, 0x00], # 'G'
[0x7E, 0x08, 0x08, 0x08, 0x08, 0x7E, 0x00, 0x00], # 'H'
[0x00, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x00, 0x00], # 'I'
[0x30, 0x40, 0x40, 0x40, 0x40, 0x3E, 0x00, 0x00], # 'J'
[0x7E, 0x08, 0x08, 0x14, 0x22, 0x40, 0x00, 0x00], # 'K'
[0x7E, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00], # 'L'
[0x7E, 0x04, 0x08, 0x08, 0x04, 0x7E, 0x00, 0x00], # 'M'
[0x7E, 0x04, 0x08, 0x10, 0x20, 0x7E, 0x00, 0x00], # 'N'
[0x3C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00], # 'O'
[0x7E, 0x12, 0x12, 0x12, 0x12, 0x0C, 0x00, 0x00], # 'P'
[0x3C, 0x42, 0x52, 0x62, 0x42, 0x3C, 0x00, 0x00], # 'Q'
[0x7E, 0x12, 0x12, 0x12, 0x32, 0x4C, 0x00, 0x00], # 'R'
[0x24, 0x4A, 0x4A, 0x4A, 0x4A, 0x30, 0x00, 0x00], # 'S'
[0x02, 0x02, 0x02, 0x7E, 0x02, 0x02, 0x02, 0x00], # 'T'
[0x3E, 0x40, 0x40, 0x40, 0x40, 0x3E, 0x00, 0x00], # 'U'
[0x1E, 0x20, 0x40, 0x40, 0x20, 0x1E, 0x00, 0x00], # 'V'
[0x3E, 0x40, 0x20, 0x20, 0x40, 0x3E, 0x00, 0x00], # 'W'
[0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x00, 0x00], # 'X'
[0x02, 0x04, 0x08, 0x70, 0x08, 0x04, 0x02, 0x00], # 'Y'
[0x42, 0x62, 0x52, 0x4A, 0x46, 0x42, 0x00, 0x00], # 'Z'
[0x00, 0x00, 0x7E, 0x42, 0x42, 0x00, 0x00, 0x00], # '['
[0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00], # backslash
[0x00, 0x00, 0x42, 0x42, 0x7E, 0x00, 0x00, 0x00], # '
[0x00, 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, 0x00], # '^'
[0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00], # '_'
[0x3C, 0x42, 0x99, 0xA5, 0xA5, 0x81, 0x42, 0x3C], # '`'
[0x00, 0x20, 0x54, 0x54, 0x54, 0x78, 0x00, 0x00], # 'a'
[0x00, 0x7E, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00], # 'b'
[0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x00, 0x00], # 'c'
[0x00, 0x30, 0x48, 0x48, 0x48, 0x7E, 0x00, 0x00], # 'd'
[0x00, 0x38, 0x54, 0x54, 0x54, 0x48, 0x00, 0x00], # 'e'
[0x00, 0x00, 0x00, 0x7C, 0x0A, 0x02, 0x00, 0x00], # 'f'
[0x00, 0x18, 0xA4, 0xA4, 0xA4, 0xA4, 0x7C, 0x00], # 'g'
[0x00, 0x7E, 0x08, 0x08, 0x08, 0x70, 0x00, 0x00], # 'h'
[0x00, 0x00, 0x00, 0x48, 0x7A, 0x40, 0x00, 0x00], # 'i'
[0x00, 0x00, 0x40, 0x80, 0x80, 0x7A, 0x00, 0x00], # 'j'
[0x00, 0x7E, 0x18, 0x24, 0x40, 0x00, 0x00, 0x00], # 'k'
[0x00, 0x00, 0x00, 0x3E, 0x40, 0x40, 0x00, 0x00], # 'l'
[0x00, 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, 0x00], # 'm'
[0x00, 0x7C, 0x04, 0x04, 0x04, 0x78, 0x00, 0x00], # 'n'
[0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00], # 'o'
[0x00, 0xFC, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00], # 'p'
[0x00, 0x18, 0x24, 0x24, 0x24, 0xFC, 0x80, 0x00], # 'q'
[0x00, 0x00, 0x78, 0x04, 0x04, 0x04, 0x00, 0x00], # 'r'
[0x00, 0x48, 0x54, 0x54, 0x54, 0x20, 0x00, 0x00], # 's'
[0x00, 0x00, 0x04, 0x3E, 0x44, 0x40, 0x00, 0x00], # 't'
[0x00, 0x3C, 0x40, 0x40, 0x40, 0x3C, 0x00, 0x00], # 'u'
[0x00, 0x0C, 0x30, 0x40, 0x30, 0x0C, 0x00, 0x00], # 'v'
[0x00, 0x3C, 0x40, 0x38, 0x40, 0x3C, 0x00, 0x00], # 'w'
[0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00], # 'x'
[0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C, 0x00, 0x00], # 'y'
[0x00, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, 0x00], # 'z'
[0x00, 0x08, 0x08, 0x76, 0x42, 0x42, 0x00, 0x00], # '{'
[0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00], # '|'
[0x00, 0x42, 0x42, 0x76, 0x08, 0x08, 0x00, 0x00], # '}'
[0x00, 0x00, 0x04, 0x02, 0x04, 0x02, 0x00, 0x00], # '~'
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x7F
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x80
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x81
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x82
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x83
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x84
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x85
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x86
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x87
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x88
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x89
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8A
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8B
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8C
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8D
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8E
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8F
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x90
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x91
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x92
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x93
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x94
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x95
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x96
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x97
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x98
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x99
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9A
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9B
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9C
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9D
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9E
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9F
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAD
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAF
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBD
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBF
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCD
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCF
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDD
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDF
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xEA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xEB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xEC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xED
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xEE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xEF
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFD
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFF
]
SIXBYEIGHTTHIN_FONT = [
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x00
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x01
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x02
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x03
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x04
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x05
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x06
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x07
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x08
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x09
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0A
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0B
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0C
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0D
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0E
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x0F
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x10
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x11
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x12
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x13
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x14
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x15
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x16
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x17
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x18
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x19
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1A
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1B
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1C
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1D
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1E
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x1F
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # ' '
[0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00], # '!'
[0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00], # '"'
[0x00, 0x24, 0x7E, 0x24, 0x24, 0x7E, 0x24, 0x00], # '#'
[0x00, 0x2E, 0x2A, 0x7F, 0x2A, 0x3A, 0x00, 0x00], # '$'
[0x00, 0x46, 0x26, 0x10, 0x08, 0x64, 0x62, 0x00], # '%'
[0x00, 0x20, 0x54, 0x4A, 0x54, 0x20, 0x50, 0x00], # '&'
[0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00], # '''
[0x00, 0x00, 0x00, 0x3C, 0x42, 0x00, 0x00, 0x00], # '('
[0x00, 0x00, 0x00, 0x42, 0x3C, 0x00, 0x00, 0x00], # ')'
[0x00, 0x10, 0x54, 0x38, 0x54, 0x10, 0x00, 0x00], # '*'
[0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00], # '+'
[0x00, 0x00, 0x00, 0x80, 0x60, 0x00, 0x00, 0x00], # '
[0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00], # '-'
[0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00], # '.'
[0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00], # '/'
[0x7E, 0x81, 0x81, 0x81, 0x81, 0x7E, 0x00, 0x00], # '0'
[0x00, 0x00, 0x82, 0xFF, 0x80, 0x00, 0x00, 0x00], # '1'
[0xC2, 0xA1, 0x91, 0x91, 0x91, 0x8E, 0x00, 0x00], # '2'
[0x42, 0x81, 0x81, 0x89, 0x89, 0x76, 0x00, 0x00], # '3'
[0x18, 0x14, 0x12, 0x11, 0xFF, 0x10, 0x00, 0x00], # '4'
[0x4F, 0x89, 0x89, 0x89, 0x89, 0x71, 0x00, 0x00], # '5'
[0x7C, 0x8A, 0x89, 0x89, 0x89, 0x70, 0x00, 0x00], # '6'
[0x03, 0x01, 0xF1, 0x09, 0x09, 0x07, 0x00, 0x00], # '7'
[0x76, 0x89, 0x89, 0x89, 0x89, 0x76, 0x00, 0x00], # '8'
[0x06, 0x89, 0x89, 0x89, 0x49, 0x3E, 0x00, 0x00], # '9'
[0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00], # ':'
[0x00, 0x00, 0x80, 0x64, 0x00, 0x00, 0x00, 0x00], # ';'
[0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00], # '<'
[0x00, 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00], # '='
[0x00, 0x00, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00], # '>'
[0x00, 0x04, 0x02, 0x02, 0x52, 0x0A, 0x04, 0x00], # '?'
[0x00, 0x3C, 0x42, 0x5A, 0x56, 0x5A, 0x1C, 0x00], # '@'
[0x7C, 0x12, 0x12, 0x12, 0x12, 0x7C, 0x00, 0x00], # 'A'
[0x7E, 0x4A, 0x4A, 0x4A, 0x4A, 0x34, 0x00, 0x00], # 'B'
[0x3C, 0x42, 0x42, 0x42, 0x42, 0x24, 0x00, 0x00], # 'C'
[0x7E, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00], # 'D'
[0x7E, 0x4A, 0x4A, 0x4A, 0x4A, 0x42, 0x00, 0x00], # 'E'
[0x7E, 0x0A, 0x0A, 0x0A, 0x0A, 0x02, 0x00, 0x00], # 'F'
[0x3C, 0x42, 0x42, 0x52, 0x52, 0x34, 0x00, 0x00], # 'G'
[0x7E, 0x08, 0x08, 0x08, 0x08, 0x7E, 0x00, 0x00], # 'H'
[0x00, 0x42, 0x42, 0x7E, 0x42, 0x42, 0x00, 0x00], # 'I'
[0x30, 0x40, 0x40, 0x40, 0x40, 0x3E, 0x00, 0x00], # 'J'
[0x7E, 0x08, 0x08, 0x14, 0x22, 0x40, 0x00, 0x00], # 'K'
[0x7E, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00], # 'L'
[0x7E, 0x04, 0x08, 0x08, 0x04, 0x7E, 0x00, 0x00], # 'M'
[0x7E, 0x04, 0x08, 0x10, 0x20, 0x7E, 0x00, 0x00], # 'N'
[0x3C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00], # 'O'
[0x7E, 0x12, 0x12, 0x12, 0x12, 0x0C, 0x00, 0x00], # 'P'
[0x3C, 0x42, 0x52, 0x62, 0x42, 0x3C, 0x00, 0x00], # 'Q'
[0x7E, 0x12, 0x12, 0x12, 0x32, 0x4C, 0x00, 0x00], # 'R'
[0x24, 0x4A, 0x4A, 0x4A, 0x4A, 0x30, 0x00, 0x00], # 'S'
[0x02, 0x02, 0x02, 0x7E, 0x02, 0x02, 0x02, 0x00], # 'T'
[0x3E, 0x40, 0x40, 0x40, 0x40, 0x3E, 0x00, 0x00], # 'U'
[0x1E, 0x20, 0x40, 0x40, 0x20, 0x1E, 0x00, 0x00], # 'V'
[0x3E, 0x40, 0x20, 0x20, 0x40, 0x3E, 0x00, 0x00], # 'W'
[0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x00, 0x00], # 'X'
[0x02, 0x04, 0x08, 0x70, 0x08, 0x04, 0x02, 0x00], # 'Y'
[0x42, 0x62, 0x52, 0x4A, 0x46, 0x42, 0x00, 0x00], # 'Z'
[0x00, 0x00, 0x7E, 0x42, 0x42, 0x00, 0x00, 0x00], # '['
[0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00], # backslash
[0x00, 0x00, 0x42, 0x42, 0x7E, 0x00, 0x00, 0x00], # '
[0x00, 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, 0x00], # '^'
[0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00], # '_'
[0x3C, 0x42, 0x99, 0xA5, 0xA5, 0x81, 0x42, 0x3C], # '`'
[0x00, 0x20, 0x54, 0x54, 0x54, 0x78, 0x00, 0x00], # 'a'
[0x00, 0x7E, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00], # 'b'
[0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x00, 0x00], # 'c'
[0x00, 0x30, 0x48, 0x48, 0x48, 0x7E, 0x00, 0x00], # 'd'
[0x00, 0x38, 0x54, 0x54, 0x54, 0x48, 0x00, 0x00], # 'e'
[0x00, 0x00, 0x00, 0x7C, 0x0A, 0x02, 0x00, 0x00], # 'f'
[0x00, 0x18, 0xA4, 0xA4, 0xA4, 0xA4, 0x7C, 0x00], # 'g'
[0x00, 0x7E, 0x08, 0x08, 0x08, 0x70, 0x00, 0x00], # 'h'
[0x00, 0x00, 0x00, 0x48, 0x7A, 0x40, 0x00, 0x00], # 'i'
[0x00, 0x00, 0x40, 0x80, 0x80, 0x7A, 0x00, 0x00], # 'j'
[0x00, 0x7E, 0x18, 0x24, 0x40, 0x00, 0x00, 0x00], # 'k'
[0x00, 0x00, 0x00, 0x3E, 0x40, 0x40, 0x00, 0x00], # 'l'
[0x00, 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, 0x00], # 'm'
[0x00, 0x7C, 0x04, 0x04, 0x04, 0x78, 0x00, 0x00], # 'n'
[0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00], # 'o'
[0x00, 0xFC, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00], # 'p'
[0x00, 0x18, 0x24, 0x24, 0x24, 0xFC, 0x80, 0x00], # 'q'
[0x00, 0x00, 0x78, 0x04, 0x04, 0x04, 0x00, 0x00], # 'r'
[0x00, 0x48, 0x54, 0x54, 0x54, 0x20, 0x00, 0x00], # 's'
[0x00, 0x00, 0x04, 0x3E, 0x44, 0x40, 0x00, 0x00], # 't'
[0x00, 0x3C, 0x40, 0x40, 0x40, 0x3C, 0x00, 0x00], # 'u'
[0x00, 0x0C, 0x30, 0x40, 0x30, 0x0C, 0x00, 0x00], # 'v'
[0x00, 0x3C, 0x40, 0x38, 0x40, 0x3C, 0x00, 0x00], # 'w'
[0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00], # 'x'
[0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C, 0x00, 0x00], # 'y'
[0x00, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, 0x00], # 'z'
[0x00, 0x08, 0x08, 0x76, 0x42, 0x42, 0x00, 0x00], # '{'
[0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00], # '|'
[0x00, 0x42, 0x42, 0x76, 0x08, 0x08, 0x00, 0x00], # '}'
[0x00, 0x00, 0x04, 0x02, 0x04, 0x02, 0x00, 0x00], # '~'
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x7F
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x80
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x81
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x82
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x83
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x84
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x85
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x86
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x87
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x88
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x89
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8A
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8B
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8C
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8D
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8E
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x8F
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x90
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x91
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x92
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x93
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x94
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x95
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x96
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x97
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x98
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x99
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9A
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9B
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9C
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9D
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9E
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0x9F
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xA9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAD
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xAF
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xB9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBD
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xBF
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xC9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCD
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xCF
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xD9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDD
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xDF
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xE9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xEA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xEB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xEC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xED
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xEE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xEF
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF0
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF1
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF2
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF3
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF4
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF5
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF6
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF7
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF8
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xF9
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFA
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFB
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFC
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFD
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFE
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # 0xFF
]

12
clocky-font.txt Normal file
View File

@@ -0,0 +1,12 @@
to use the 6x8 font, cat clocky-font.py >>/home/pi/.local/lib/python2.7/site-packages/luma/core/legacy/font.py
cat clocky-font.py >>/usr/local/lib/python2.7/dist-packages/luma/core/legacy/font.py
or wherever the luma-core font.py is. This can be found by running python manually:
python
>>> import from luma.core.legacy.font
>>> luma.core.legacy.font
<module 'luma.core.legacy.font' from '/home/pi/.local/lib/python2.7/site-packages/luma/core/legacy/font.pyc'>

96
clocky.py Normal file → Executable file
View File

@@ -5,6 +5,7 @@ import os.path
import time import time
import sys import sys
import tm1637 import tm1637
import max7219
import pygame import pygame
from time import sleep,strftime from time import sleep,strftime
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
@@ -16,19 +17,19 @@ looptype=0
quit=0 quit=0
print "\n +----------+\n | Clocky |\n | v0.0.5 |\n +----------+\n" print "\n +----------+\n | Clocky |\n | v0.1.0 |\n +----------+\n"
o_configfilename = "clocky.conf" o_configfilename = "clocky.conf"
o_defaultalarmtime = 60*7+45 # hh*60+mm o_defaultalarmtime = 60*7+45 # hh*60+mm
o_showalarmtime=3 # time that the alarmtime shows after short press o_showalarmtime=3 # time that the alarmtime shows after short press
o_showtracktime=2 # note that this is per track, so total time is 10 times longer o_showtracktime=2 # note that this is per track, so total time is 10 times longer
o_editdelaytime=3 # time it takes to qualify as longpress o_editdelaytime=3 # time it takes to qualify as longpress
o_showtimeout=6 # timeout to exit edit modus o_showtimeout=6 # timeout to exit edit modus
o_snoozetime = 9 # time to snooze o_snoozetime = 9 # time to snooze
o_timetomaxvol = 150 # seconds it takes to go from 0% to 100% volume o_timetomaxvol = 150# seconds it takes to go from 0% to 100% volume
o_maxplaytime = 1800 # seconds it to play o_maxplaytime = 900 # seconds it to play
o_soundpreviewtime=5 o_soundpreviewtime=5
o_defaultbrightness=1 o_defaultbrightness=0
o_loopdelay=0.25 o_loopdelay=0.25
track=0 track=0
@@ -44,37 +45,6 @@ def signal_handler(signal,frame):
def stamp(): def stamp():
sys.stdout.write(strftime("[%Y%m%d %H%M%S] ")) sys.stdout.write(strftime("[%Y%m%d %H%M%S] "))
def showclock(tstr):
"Show da clock"
# sys.stdout.write( "%s [%d]\r" % (tstr,looptype))
# sys.stdout.flush()
d=0
if tstr[2]==':':
display.ShowDoublepoint(True)
else:
display.ShowDoublepoint(False)
if tstr[0]==' ':
display.Show1(0,0x7f)
else:
display.Show1(0,int(tstr[0]))
if tstr[1]==' ':
display.Show1(1,0x7f)
elif tstr[1]=='=':
display.Show1(1,16)
else:
display.Show1(1,int(tstr[1]))
if tstr[3]==' ':
display.Show1(2,0x7f)
else:
display.Show1(2,int(tstr[3]))
if tstr[4]==' ':
display.Show1(3,0x7f)
else:
display.Show1(3,int(tstr[4]))
def writesettings(): def writesettings():
"write settings to conf file" "write settings to conf file"
with open(o_configfilename, 'wb') as handle: with open(o_configfilename, 'wb') as handle:
@@ -112,11 +82,13 @@ alarmstarted=0
silencedalarm=0 silencedalarm=0
tvol=0 tvol=0
volume=0.0 volume=0.0
brightness=0.0 brightness=0
snooze=0 snooze=0
signal.signal(signal.SIGINT,signal_handler) signal.signal(signal.SIGINT,signal_handler)
display=tm1637.TM1637(CLK=14, DIO=4, brightness=1.0) #display=tm1637.TM1637(CLK=14, DIO=4, brightness=1)
display=max7219.MAX7219(brightness=1)
display.Clear() display.Clear()
display.SetBrightnessRaw(o_defaultbrightness) display.SetBrightnessRaw(o_defaultbrightness)
@@ -125,12 +97,8 @@ print "reading mp3s from directory:"
allmp3s=readmp3list() allmp3s=readmp3list()
if allmp3s==0: if allmp3s==0:
print "ERROR: No mp3's found!" print "ERROR: No mp3's found!"
display.ShowDoublepoint(False) display.showclock(" E rr")
display.Show1(0,0x7f); sleep(30)
display.Show1(1,14);
display.Show1(2,17);
display.Show1(3,17);
GPIO.cleanup()
sys.exit() sys.exit()
c=0 c=0
@@ -250,7 +218,7 @@ while quit!=True:
tim="%02d:%02d" % (mytime[3] , mytime[4]) tim="%02d:%02d" % (mytime[3] , mytime[4])
else: else:
tim="%02d %02d" % (mytime[3] , mytime[4]) tim="%02d %02d" % (mytime[3] , mytime[4])
showclock(tim) display.showclock(tim)
if count % 4 == 0: if count % 4 == 0:
colon=1-colon colon=1-colon
@@ -265,14 +233,10 @@ while quit!=True:
tim="%02d:%02d" % (a_hour, a_mins) tim="%02d:%02d" % (a_hour, a_mins)
else: else:
tim="%02d %02d" % (a_hour, a_mins) tim="%02d %02d" % (a_hour, a_mins)
showclock(tim) display.showclock(tim)
colon=1-colon colon=1-colon
else: else:
display.ShowDoublepoint(False) display.showclock(" O FF")
display.Show1(0,0x7f);
display.Show1(1,0);
display.Show1(2,15);
display.Show1(3,15);
if showtime > o_showalarmtime: if showtime > o_showalarmtime:
if but1.WasPressed(): # drop intermediate presses if but1.WasPressed(): # drop intermediate presses
@@ -342,7 +306,7 @@ while quit!=True:
tim="%0d%0d:%0d " % (dh,sh,dm ) tim="%0d%0d:%0d " % (dh,sh,dm )
delta=0 delta=0
showclock(tim) display.showclock(tim)
colon=1-colon colon=1-colon
@@ -413,7 +377,7 @@ while quit!=True:
tr+=1; tr+=1;
if tr>9: if tr>9:
looptype=0 looptype=0
showclock(tim) display.showclock(tim)
colon=1-colon colon=1-colon
if soundpreview: if soundpreview:
@@ -482,7 +446,7 @@ while quit!=True:
tim="%d=:%d " % (tr,th ) tim="%d=:%d " % (tr,th )
delta=0 delta=0
showclock(tim) display.showclock(tim)
colon=1-colon colon=1-colon
settings["track%d"%tr]=th*10+tl settings["track%d"%tr]=th*10+tl
@@ -514,7 +478,7 @@ while quit!=True:
else: else:
display.SetBrightnessRaw(brightness) display.SetBrightnessRaw(brightness)
tim="%02d:%02d" % (mytime[3] , mytime[4]) tim="%02d:%02d" % (mytime[3] , mytime[4])
showclock(tim) display.showclock(tim)
if count % 2 == 0: if count % 2 == 0:
colon=1-colon colon=1-colon
@@ -540,9 +504,9 @@ while quit!=True:
alarmstarted=1 alarmstarted=1
else: # alarmstarted else: # alarmstarted
if playtime < o_timetomaxvol: if playtime < o_timetomaxvol:
brightness=(playtime / o_timetomaxvol)*6 brightness=int((playtime / o_timetomaxvol)*255)
volume = float(int((playtime*100) / o_timetomaxvol))/100 volume = float(int((playtime*100) / o_timetomaxvol))/100
# print "------> %d / %d => %f - %f"%(playtime,o_timetomaxvol,tvol,volume) # print "------> %d / %d => %f - %f [%d]"%(playtime,o_timetomaxvol,tvol,volume,brightness)
else: else:
volume=1 volume=1
@@ -576,6 +540,8 @@ while quit!=True:
pygame.mixer.quit() pygame.mixer.quit()
display.SetBrightnessRaw(o_defaultbrightness) display.SetBrightnessRaw(o_defaultbrightness)
alarmstarted=0 alarmstarted=0
stamp()
print "Alarmtime expired"
if but1.WasPressed(): if but1.WasPressed():
if but1.WasLong(): # Finished if but1.WasLong(): # Finished
@@ -621,7 +587,11 @@ while quit!=True:
#------------------------------------------------------------------ #------------------------------------------------------------------
if pygame.mixer.get_init():
pygame.mixer.music.set_volume(0)
pygame.mixer.music.stop()
pygame.mixer.quit()
display.cleanup()
sys.stdout.flush()
stamp() stamp()
print "Shutdown!" print "Shutdown!"
sys.stdout.flush()
display.cleanup()

64
max7219.py Normal file
View File

@@ -0,0 +1,64 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017-18 Richard Hull and contributors
# See LICENSE.rst for details.
import re
import time
from luma.led_matrix.device import max7219
from luma.core.interface.serial import spi, noop
from luma.core.render import canvas
from luma.core.legacy import text
from luma.core.legacy.font import SIXBYEIGHT_FONT, SIXBYEIGHTTHIN_FONT
class MAX7219:
__doublePoint = False
__brightness = 1.0 # default to min brightness
def __init__(self, brightness):
self.__brightness = brightness
serial = spi(port=0, device=0, gpio=noop())
self.__device = max7219(serial, cascaded=4, block_orientation=-90, rotate=0) # last arg is rotate: 0,1,2 or 3)
def Clear(self):
with canvas(self.__device) as draw:
draw.point((15,2), fill=None)
def showclock(self,tstr):
with canvas(self.__device) as draw:
text(draw, (0 ,0), tstr[0] , fill="white", font=SIXBYEIGHTTHIN_FONT)
text(draw, (8 ,0), tstr[1] , fill="white", font=SIXBYEIGHTTHIN_FONT)
text(draw, (17,0), tstr[3] , fill="white", font=SIXBYEIGHTTHIN_FONT)
text(draw, (25,0), tstr[4] , fill="white", font=SIXBYEIGHTTHIN_FONT)
if tstr[2]==':':
draw.point((15,2), fill="white")
draw.point((15,5), fill="white")
def SetBrightnessRaw(self, brightness):
"""Accepts raw brightness from 0 - 255"""
self.__device.contrast(brightness)
def ShowDoublepoint(self, on):
"""Show or hide double point divider"""
if(self.__doublePoint != on):
self.__doublePoint = on
draw.point((15,2), fill="white")
draw.point((15,5), fill="white")
def cleanup(self):
self.__brightness=0
if __name__ == "__main__":
try:
# demo()
showclock("01:23")
wait=raw_input("enter")
except KeyboardInterrupt:
pass

181
tm1637.py
View File

@@ -2,22 +2,21 @@ import math
import RPi.GPIO as IO import RPi.GPIO as IO
import threading import threading
from time import sleep, localtime from time import sleep, localtime
# from tqdm import tqdm
# IO.setwarnings(False) # IO.setwarnings(False)
IO.setmode(IO.BCM) IO.setmode(IO.BCM)
HexDigits = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, HexDigits = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d,
0x07, 0x7f, 0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71, 0x49, 0x50 ] 0x07, 0x7f, 0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71, 0x49, 0x50, 0x40]
# 0 1 2 3 4 5 6 # 0 1 2 3 4 5 6
# 7 8 9 A B C D E F = r # 7 8 9 A B C D E F = r -
# 10 11 12 13 14 15 16 17 # 10 11 12 13 14 15 16 17 18
# #
# 0 # 0
# --- # ---
# | | # | |
# 5 | 7 | 1 # 5 | 6 | 1
# --- # ---
# | | # | |
# 4 | | 2 # 4 | | 2
@@ -31,6 +30,36 @@ STARTADDR = 0xC0
# DEBUG = False # DEBUG = False
# return array value of a certain character
def s2c(s):
if s>='0' and s<='9':
return(int(s))
elif s=='A':
return(10)
elif s=='B':
return(11)
elif s=='C':
return(12)
elif s=='D':
return(13)
elif s=='E':
return(14)
elif s=='F':
return(15)
elif s=='=':
return(16)
elif s=='r':
return(17)
elif s=='-':
return(18)
elif s=='O':
return(0)
else:
return(0x7f)
class TM1637: class TM1637:
__doublePoint = False __doublePoint = False
__Clkpin = 0 __Clkpin = 0
@@ -47,6 +76,7 @@ class TM1637:
def cleanup(self): def cleanup(self):
"""Stop updating clock, turn off display, and cleanup GPIO""" """Stop updating clock, turn off display, and cleanup GPIO"""
self.showclock(" ")
IO.cleanup() IO.cleanup()
def Clear(self): def Clear(self):
@@ -60,11 +90,18 @@ class TM1637:
self.__brightness = b self.__brightness = b
self.__doublePoint = point self.__doublePoint = point
def ShowInt(self, i): def showclock(self,tstr):
s = str(i) "Show da clock"
self.Clear()
for i in range(0, len(s)): if tstr[2]==':':
self.Show1(i, int(s[i])) self.ShowDoublepoint(True)
else:
self.ShowDoublepoint(False)
self.Show1(0,s2c(tstr[0]))
self.Show1(1,s2c(tstr[1]))
self.Show1(2,s2c(tstr[3]))
self.Show1(3,s2c(tstr[4]))
def Show(self, data): def Show(self, data):
for i in range(0, 4): for i in range(0, 4):
@@ -96,21 +133,13 @@ class TM1637:
self.writeByte(0x88 + int(self.__brightness)) self.writeByte(0x88 + int(self.__brightness))
self.stop() self.stop()
def SetBrightness(self, percent): def SetBrightnessRaw(self, briteness):
"""Accepts percent brightness from 0 - 1""" """Accepts raw brightness from 0 - 255"""
max_brightness = 7.0 brightness=briteness>>5
brightness = math.ceil(max_brightness * percent) print "BR=",brightness
if (brightness < 0):
brightness = 0
if(self.__brightness != brightness): if(self.__brightness != brightness):
self.__brightness = brightness self.__brightness = brightness
self.Show(self.__currentData) # self.Show(self.__currentData)
def SetBrightnessRaw(self, brightness):
"""Accepts raw brightness from 0 - 7"""
if(self.__brightness != brightness):
self.__brightness = brightness
self.Show(self.__currentData)
def ShowDoublepoint(self, on): def ShowDoublepoint(self, on):
"""Show or hide double point divider""" """Show or hide double point divider"""
@@ -171,109 +200,3 @@ class TM1637:
else: else:
data = HexDigits[data] + pointData data = HexDigits[data] + pointData
return data return data
def clock(self, military_time):
"""Clock script modified from:
https://github.com/johnlr/raspberrypi-tm1637"""
self.ShowDoublepoint(True)
while (not self.__stop_event.is_set()):
t = localtime()
hour = t.tm_hour
if not military_time:
hour = 12 if (t.tm_hour % 12) == 0 else t.tm_hour % 12
d0 = hour // 10 if hour // 10 else 0
d1 = hour % 10
d2 = t.tm_min // 10
d3 = t.tm_min % 10
digits = [d0, d1, d2, d3]
self.Show(digits)
# # Optional visual feedback of running alarm:
# print digits
# for i in tqdm(range(60 - t.tm_sec)):
for i in range(60 - t.tm_sec):
if (not self.__stop_event.is_set()):
sleep(1)
def StartClock(self, military_time=True):
# Stop event based on: http://stackoverflow.com/a/6524542/3219667
self.__stop_event = threading.Event()
self.__clock_thread = threading.Thread(
target=self.clock, args=(military_time,))
self.__clock_thread.start()
def StopClock(self):
try:
print 'Attempting to stop live clock'
self.__stop_event.set()
except:
print 'No clock to close'
if __name__ == "__main__":
"""Confirm the display operation"""
display = TM1637(CLK=14, DIO=4, brightness=1.0)
display.Clear()
digits = [1, 2, 3, 4]
display.Show(digits)
print "1234 - Working? (Press Key)"
scrap = raw_input()
print "Updating one digit at a time:"
display.Clear()
display.Show1(1, 3)
sleep(0.5)
display.Show1(2, 2)
sleep(0.5)
display.Show1(3, 1)
sleep(0.5)
display.Show1(0, 4)
print "4321 - (Press Key)"
scrap = raw_input()
print "Add double point\n"
display.ShowDoublepoint(True)
sleep(0.2)
print "Brightness Off"
display.SetBrightness(0)
sleep(0.5)
print "Full Brightness"
display.SetBrightness(1)
sleep(0.5)
print "30% Brightness"
display.SetBrightness(0.3)
sleep(0.3)
display.ShowDoublepoint(False)
display.Show1(0,0x7f);
display.Show1(1,14);
display.Show1(2,17);
display.Show1(3,17);
# See clock.py for how to use the clock functions!
display.SetBrightnessRaw(0)
print "level=0"
scrap=raw_input()
display.SetBrightnessRaw(1)
print "level=1"
scrap=raw_input()
display.SetBrightnessRaw(2)
print "level=2"
scrap=raw_input()
display.SetBrightnessRaw(3)
print "level=3"
scrap=raw_input()
display.SetBrightnessRaw(4)
print "level=4"
scrap=raw_input()
display.SetBrightnessRaw(5)
print "level=5"
scrap=raw_input()
display.SetBrightnessRaw(6)
print "level=6"
scrap=raw_input()
display.SetBrightnessRaw(7)
print "level=7"
scrap=raw_input()