feat(simulator): add GUI runner, stubs, and workspace assets
Add host simulator scaffolding, examples, and docs so led-driver main can run end-to-end with MicroPython module stubs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
22
stubs/utime.py
Normal file
22
stubs/utime.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""CPython stub for MicroPython `utime` (led-simulator)."""
|
||||
|
||||
import time
|
||||
|
||||
_MS_MASK = (1 << 30) - 1
|
||||
|
||||
|
||||
def sleep_ms(ms):
|
||||
time.sleep(max(0, ms) / 1000.0)
|
||||
|
||||
|
||||
def sleep(s):
|
||||
time.sleep(s)
|
||||
|
||||
|
||||
def ticks_ms():
|
||||
return int(time.monotonic() * 1000) & _MS_MASK
|
||||
|
||||
|
||||
def ticks_diff(t1, t0):
|
||||
"""Approximate MicroPython ticks_diff for host monotonic ms."""
|
||||
return ((t1 - t0 + (1 << 29)) & _MS_MASK) - (1 << 29)
|
||||
Reference in New Issue
Block a user