2023-11-02 17:01:51 +00:00
|
|
|
from lcd_driver import I2C_LCD
|
|
|
|
from machine import I2C, Pin
|
|
|
|
from welcome import WelcomeScreen
|
|
|
|
from counter import CounterArray
|
|
|
|
from lcd_screen import CounterScreen
|
|
|
|
|
|
|
|
|
|
|
|
I2C_ADDR = 0x27
|
|
|
|
I2C_NUM_ROWS = 2
|
|
|
|
I2C_NUM_COLS = 16
|
2023-11-02 17:15:49 +00:00
|
|
|
WELCOME_CYCLES = 1
|
|
|
|
COUNTER_NUMBER = 2
|
|
|
|
COUNTER_NAMES = ["Counter 1", "Counter 2"]
|
|
|
|
COUNTER_PINS = {0:2,1:3}
|
|
|
|
|
2023-11-02 17:01:51 +00:00
|
|
|
|
|
|
|
_i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
|
|
|
|
lcd = I2C_LCD(_i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
|
2023-11-02 17:15:49 +00:00
|
|
|
counterArray = CounterArray(COUNTER_NUMBER, COUNTER_NAMES)
|
2023-11-02 17:01:51 +00:00
|
|
|
ws = WelcomeScreen(lcd)
|
|
|
|
cs = CounterScreen(lcd, counterArray)
|
|
|
|
|
|
|
|
# Real program
|
2023-11-02 17:15:49 +00:00
|
|
|
ws.show_welcome(WELCOME_CYCLES)
|
2023-11-02 17:01:51 +00:00
|
|
|
cs.show_screen()
|
2023-11-02 17:15:49 +00:00
|
|
|
counterArray.register_listener(COUNTER_PINS, cs.show_screen)
|
|
|
|
|