Xinyuan-LilyGO / TTGO_TWatch_Library

MIT License
874 stars 282 forks source link

Can I program the T-watch 2021 with Python only? #195

Open Angelo904 opened 1 year ago

Angelo904 commented 1 year ago

I have recently purchased a T-watch 2021 and, since Circuit Python is the only language I am familiar with, I would like to find out if I can program it just using python, and what "kind" of python I would beed to use (can I use Circuitpython or it has to be Micropython?).

I looked around on this GitHub page and it seems that all the software available for the T-watch 2021 is in Arduino / C++

However I have read in several different places (including the Lilygo open smartwatch product page) that it can be programmed with pyhton.

Can anybody clarify whether it can actually be done and what I would need to do? Where can I find the appropriate python libraries/modules? Can I just write any python code on Platform IO and upload it to the board?

Also, I found the circuitpython SW for the t-watch 2020 here https://circuitpython.org/board/lilygo_twatch_2020_v3/ but I can’t tell whether it’s compatible also with t-watch 2021.

Thanks in advance! Angelo

VynDragon commented 1 year ago

Yes, you just need to get or make drivers.

For example, you can use LewisHe's libraries that were sponsored by lilygo:

Any other library or driver you need could be found using peripheral name + circuitpython.

Circuitpython will work as well as micropython, but you might need to adapt the code if it is not made for circuitpython

I have written a firmware for the 2020 version of the watch, in micropython, but i invite you to look at it (in Hardware.py) as there are a lot of subtelties that come with some of the hardware, like the BMA423 (that is also present on T-WATCH 2021): https://github.com/VynDragon/WPOS2/blob/master/system/Hardware.py

Angelo904 commented 1 year ago

Yes, you just need to get or make drivers.

For example, you can use LewisHe's libraries that were sponsored by lilygo:

Any other library or driver you need could be found using peripheral name + circuitpython.

Circuitpython will work as well as micropython, but you might need to adapt the code if it is not made for circuitpython

I have written a firmware for the 2020 version of the watch, in micropython, but i invite you to look at it (in Hardware.py) as there are a lot of subtelties that come with some of the hardware, like the BMA423 (that is also present on T-WATCH 2021): https://github.com/VynDragon/WPOS2/blob/master/system/Hardware.py

@VynDragon, many thanks for your very useful answer. In the meantime, I have started working on some Arduino code. I guess I’ll keep going this way for now, but it is reassuring to know that if it gets too difficult for me I have the option to switch to python. I’ll keep you posted. Angelo