import machine
from machine import I2C
from lcd_api import LcdApi
from i2c_lcd import I2cLcd
I2C_ADDR = 0x27
totalRows = 2
totalColumns = 16
i2c = I2C(0, sda=machine.Pin(0), scl=machine.Pin(1), freq=400000)
lcd = I2cLcd(i2c, I2C_ADDR, totalRows, totalColumns)
nula = bytearray([0x1E,0x12,0x12,0x12,0x12,0x12,0x1E,0x00])
nulat = bytearray([0x1E,0x12,0x12,0x12,0x12,0x12,0x1F,0x00])
jedna = bytearray([0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00])
jednat = bytearray([0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x00])
dve = bytearray([0x1E,0x02,0x02,0x1E,0x10,0x10,0x1E,0x00])
dvet = bytearray([0x1E,0x02,0x02,0x1E,0x10,0x10,0x1F,0x00])
tri = bytearray([0x1E,0x02,0x02,0x1E,0x02,0x02,0x1E,0x00])
trit = bytearray([0x1E,0x02,0x02,0x1E,0x02,0x02,0x1F,0x00])
ctyri = bytearray([0x12,0x12,0x12,0x1E,0x02,0x02,0x02,0x00])
ctyrit = bytearray([0x12,0x12,0x12,0x1E,0x02,0x02,0x03,0x00])
pet = bytearray([0x1E,0x10,0x10,0x1E,0x02,0x02,0x1E,0x00])
sest = bytearray([0x1E,0x10,0x10,0x1E,0x12,0x12,0x1E,0x00])
sedm = bytearray([0x1E,0x02,0x02,0x02,0x02,0x02,0x02,0x00])
osm = bytearray([0x1E,0x12,0x12,0x1E,0x12,0x12,0x1E,0x00])
devet = bytearray([0x1E,0x12,0x12,0x1E,0x02,0x02,0x1E,0x00])
lcd.custom_char(0, nula)
lcd.custom_char(1, jedna)
lcd.custom_char(2, dve)
lcd.custom_char(3, tri)
lcd.custom_char(4, ctyri)
lcd.custom_char(5, pet)
lcd.custom_char(6, sest)
lcd.custom_char(7, sedm)
lcd.custom_char(8, nula)
# lcd.custom_char(9, nula)
lcd.putstr(chr(0) + chr(1) + chr(2) + chr(3) + chr(4) + chr(5) + chr(6) + chr(7) + chr(8))