def display_driver_twatch(self): import ttgo from axp_constants import AXP202_VBUS_VOL_ADC1, AXP202_VBUS_CUR_ADC1, AXP202_BATT_CUR_ADC1, AXP202_BATT_VOL_ADC1 watch = ttgo.Watch() tft = watch.tft power = watch.pmu power.adc1Enable( AXP202_VBUS_VOL_ADC1 | AXP202_VBUS_CUR_ADC1 | AXP202_BATT_CUR_ADC1 | AXP202_BATT_VOL_ADC1, True) watch.lvgl_begin() watch.tft.backlight_fade(100) self.type = "t-watch" print("Running lvgl on the LilyGo t-watch 2020")
from machine import I2C, Pin from wifi_connect import * import lvgl as lv import ttgo from axp_constants import * watch = ttgo.Watch() tft = watch.tft power = watch.pmu def init(): connect() # connect to wifi power.adc1Enable( AXP202_VBUS_VOL_ADC1 | AXP202_VBUS_CUR_ADC1 | AXP202_BATT_CUR_ADC1 | AXP202_BATT_VOL_ADC1, True) watch.lvgl_begin() def interface(): def event_handler(source, evt): if evt == lv.EVENT.VALUE_CHANGED: date = lv.calendar.get_pressed_date(source) if date: print("Clicked date: %02d.%02d.%02d" % (date.day, date.month, date.year)) # Create a screen and load it scr = lv.obj() lv.scr_load(scr)
import ttgo as _ttgo watch = _ttgo.Watch() def get_watch(): return watch