LVGL on the T-Watch 2020
Introduction
Since the t-watch 2020 has a rather high resolution screen in combination with a touch panel, it is possible to run
Graphical
User
Interfaces (GUIs) right on the watch. A popular GUI library is
lvgl (
Light and
Versatile
Graphics
Library). This library is written in C but MicroPython
language bindings are available.
In order to bind lvgl into MicroPython, modifications to the MicroPython code are needed. Drivers for the t-watch devices must also be integrated into Micropython. I therefore created the
twatch-2020-micropython github repository integrating all these bits and pieces. This repository is based on
There is also a big collection of
example programs available for both languages.
Software available for the T-Watch
The factory firmware is
https://github.com/sharandac/My-TTGO-Watch. This is a rather complex C++ program using LVGL and the Arduino IDE for platformio. It uses the
TTGO_TWatch_Library providing drivers for the T-Watch devices as well as icons and background wallpapers.
Running lv_micropython of the t-watch
MicroPython compiles for the t-watch "out of the box". In order to get a version with lvgl and all drivers and their MicroPython language binding to work is another story. Therefore the repository mentioned above.
The MicroPython language binding contains lvgl initialization code in the module
display_driver.py, which makes it very easy to create and run simple lvgl programs on the t-watch.
display_driver.py checks on which hardware it is running
- SDL driver for the uniy port simulating a display
- ili9341, used e.g. on the LoLin TFT-2.4" display
- or the t-watch
and performs the necessary actions like registration of the display and touch screen drivers with lvgl.
The code of a very basic example is given below together with a screen dump of what you will see on the t-watch screen.
--
Uli Raich - 2021-01-08
Comments