You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
Works on waveshare-esp32-s3-touch-lcd-2
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
# This file is the only one that can't be overridden (without rebuilding) for development, so keep it minimal.
|
||||
|
||||
# Make sure the storage partition's /lib is first in the path, so whatever is placed there overrides frozen libraries
|
||||
# This allows a "prod[uction]" build to be used for development as well, just by overriding the libraries in /lib
|
||||
import sys
|
||||
sys.path.insert(0, '/lib')
|
||||
|
||||
print("Passing execution over to MicroPythonOS's main.py")
|
||||
import mpos.main
|
||||
|
||||
-2
@@ -13,11 +13,9 @@ import gc
|
||||
import lvgl as lv
|
||||
import task_handler
|
||||
|
||||
import mpos.info
|
||||
import mpos.ui
|
||||
import mpos.ui.focus_direction
|
||||
|
||||
mpos.info.set_hardware_id("fri3d-2024")
|
||||
|
||||
# Pin configuration
|
||||
SPI_BUS = 2
|
||||
@@ -3,18 +3,11 @@ import lcd_bus
|
||||
import lvgl as lv
|
||||
import sdl_display
|
||||
|
||||
# Add lib/ to the path for modules, otherwise it will only search in ~/.micropython/lib and /usr/lib/micropython
|
||||
import sys
|
||||
sys.path.append('lib/')
|
||||
|
||||
import mpos.clipboard
|
||||
import mpos.indev.mpos_sdl_keyboard
|
||||
import mpos.info
|
||||
import mpos.ui
|
||||
import mpos.ui.focus_direction
|
||||
|
||||
mpos.info.set_hardware_id("linux-desktop")
|
||||
|
||||
# Same as Waveshare ESP32-S3-Touch-LCD-2 and Fri3d Camp 2026 Badge
|
||||
TFT_HOR_RES=320
|
||||
TFT_VER_RES=240
|
||||
|
||||
+1
-6
@@ -11,9 +11,6 @@ import lvgl as lv
|
||||
import task_handler
|
||||
|
||||
import mpos.ui
|
||||
import mpos.info
|
||||
|
||||
mpos.info.set_hardware_id("waveshare-esp32-s3-touch-lcd-2")
|
||||
|
||||
# Pin configuration
|
||||
SPI_BUS = 2
|
||||
@@ -92,9 +89,7 @@ mpos.battery_voltage.init_adc(5, 262 / 100000)
|
||||
try:
|
||||
from machine import Pin, I2C
|
||||
i2c = I2C(1, scl=Pin(16), sda=Pin(21)) # Adjust pins and frequency
|
||||
devices = i2c.scan()
|
||||
print("Scan of I2C bus on scl=16, sda=21:")
|
||||
print([hex(addr) for addr in devices]) # finds it on 60 = 0x3C after init
|
||||
# Warning: don't do an i2c scan because it confuses the camera!
|
||||
camera_addr = 0x3C # for OV5640
|
||||
reg_addr = 0x3008
|
||||
reg_high = (reg_addr >> 8) & 0xFF # 0x30
|
||||
@@ -11,9 +11,19 @@ from mpos.content.package_manager import PackageManager
|
||||
# Auto-detect and initialize hardware
|
||||
import sys
|
||||
if sys.platform == "linux" or sys.platform == "darwin": # linux and macOS
|
||||
import mpos.board.linux
|
||||
board = "linux"
|
||||
elif sys.platform == "esp32":
|
||||
print("TODO: detect which esp32 this is and then load the appropriate board")
|
||||
board = "fri3d-2024" # default fallback
|
||||
import machine
|
||||
from machine import Pin, I2C
|
||||
i2c0 = I2C(0, sda=machine.Pin(48), scl=machine.Pin(47))
|
||||
if i2c0.scan() == [21, 107]: # touch screen and IMU
|
||||
board = "waveshare-esp32-s3-touch-lcd-2"
|
||||
|
||||
print(f"Detected hardware {board}, initializing...")
|
||||
import mpos.info
|
||||
mpos.info.set_hardware_id(board)
|
||||
__import__(f"mpos.board.{board}")
|
||||
|
||||
# Allow LVGL M:/path/to/file or M:relative/path/to/file to work for image set_src etc
|
||||
import mpos.fs_driver
|
||||
|
||||
Reference in New Issue
Block a user