Example #1
0
File: led.py Project: ppxu/sys
def static_chinese_bytes(text_bytes):
    max_chinese = int(m7219.NUM_MATRICES / 4)
    available_matrices = max_chinese * 4
    # print('there are ' + str(available_matrices) + ' available.')
    for matrix in range(available_matrices):
        if matrix < available_matrices / 2:
            num = 2
            row = 0
            cur_char = int(matrix / 2)
        else:
            num = (max_chinese + 1) * 2
            row = 1
            cur_char = int((matrix - available_matrices / 2) / 2)
        if cur_char < len(text_bytes):
            cur_char_byte = text_bytes[cur_char]
            # print('cur matrix: ' + str(matrix) + '; cur number: ' + str(num) + '; cur char: ' + str(cur_char))
            if row == 0:
                j = (matrix - cur_char * 2) * 8
            else:
                j = ((matrix - available_matrices / 2) - (cur_char - 1) * 2) * 8
            # print('cur num: ' + str(j))
            for i in range(8):
                byte = cur_char_byte[j + i]
                byte = int(byte, 16) - 0x00
                m7219.send_matrix_reg_byte(matrix, i+1, byte)