uPyLibs/main.py

52 lines
1.1 KiB
Python

import uPyConfig
hw = uPyConfig.esp32()
import webrepl
webrepl.start()
#print family, variant and IP address (using oled, if available on-board)
import init_sample
init_sample.PrintHWInfo(hw)
# Main app
from machine import Pin, TouchPad, SPI
#from uPaper import epaper, fbuf
from ST7735 import TFT
from time import sleep_ms
tft_spibus=2
tft_mosi=Pin(23)
tft_sck=Pin(5)
tft_dc=17
tft_rst=12
tft_cs=16
spi=SPI(tft_spibus,baudrate=20000000,polarity=0,phase=0,mosi=tft_mosi,sck=tft_sck)
tft=TFT(spi,tft_dc,tft_rst,tft_cs)
tft.on()
tft.initg()
tft.initb()
tft.rgb(True)
tft.initr()
sleep_ms(200)
tft.fill(tft.RED)
sleep_ms(40)
tft.fill(tft.BLUE)
sleep_ms(40)
tft.fill(tft.GREEN)
sleep_ms(40)
tft.fill(tft.PURPLE)
sleep_ms(40)
tft.fill(tft.WHITE)
sleep_ms(800)
from fonts import terminal
from network import WLAN as wlan, STA_IF as staif
print(hw.family)
print(hw.variant)
print(wlan(staif).ifconfig()[0])
tft.text((4,4),hw.family,terminal.data)
tft.text((4,14),hw.variant,terminal.data)
tft.text((4,24),wlan(staif).ifconfig()[0],terminal.data)