OPHoperHPO / lilygo-ttgo-twatch-2020-micropython

:snake:MicroPython for LilyGO TTGO T-Watch-2020:snake:
MIT License
57 stars 12 forks source link

Driver access #1

Closed jhfoo closed 4 years ago

jhfoo commented 4 years ago

Thanks for building this firmware! I have a TTgo watch too and am excited by your build!

One thing I like to explore is direct use of the drivers packaged, like touch. Can you advise how I can go about this?

OPHoperHPO commented 4 years ago

Hello, @jhfoo. You can direct use the drivers from ttgo.Watch class. So you need to init this class, then you can call following device drivers as attributes of this class:

        pmu  - AXP202 driver
        tft  - ST7789V Display driver
        touch  - FT6x36 Touch screen driver
        motor -  Vibrate motor driver
        rtc  - PCF***** driver 
        bma  - BMA423 accelerometer  driver
        ticker - lvgl gui update module

BUT Some C drivers, like touch driver, don't gives public functions to read/write smt to device, because them were used only for lvgl and etc. To do this you need to write your own function in C for this driver or replace this driver by another driver for this device and change ttgo.py file. For example, you can replace touch driver in c by slow python driver from this old micropython port.