System API
Preview notice
The MatrixOS Python API is in preview and is subject to change; it may contain errors.
Overview
The System API in MatrixOS provides core system functions including timing, application management, device control, and system utilities. The System API is available as MatrixOS.SYS and is imported by default.
The Python System API is implemented in Applications/Python/PikaPython/MatrixOS_SYS.py with type hints in Applications/Python/PikaPython/_MatrixOS_SYS.pyi.
Version Information
MatrixOS.SYS.GetVersion
def GetVersion() -> tuple
Returns the current MatrixOS version as a tuple of major, minor, and patch version numbers.
Returns:
tuple: A tuple containing (major, minor, patch) version numbers
Device Control
MatrixOS.SYS.Reboot
def Reboot() -> None
Reboots the MatrixOS device. The device will restart and boot normally.
MatrixOS.SYS.Bootloader
def Bootloader() -> None
Reboots the device into bootloader mode for firmware updates.
Timing Functions
MatrixOS.SYS.DelayMs
def DelayMs(ms: int) -> None
Delays execution for the specified number of milliseconds.
Parameters:
ms(int): Delay duration in milliseconds
MatrixOS.SYS.Millis
def Millis() -> int
Returns the number of milliseconds since the device started.
Returns:
int: Milliseconds since boot
MatrixOS.SYS.Micros
def Micros() -> int
Returns the number of microseconds since the device started.
Returns:
int: Microseconds since boot
Application Management
MatrixOS.SYS.OpenSetting
def OpenSetting() -> None
Opens the system settings application.
MatrixOS.SYS.ExecuteAPP
def ExecuteAPP(author: str, app_name: str, args: list = []) -> None
Launches an application by author and name with optional arguments.
Parameters:
author(str): Application author nameapp_name(str): Application nameargs(list, optional): Arguments to pass to the application (defaults to empty list)
MatrixOS.SYS.ExecuteAPPByID
def ExecuteAPPByID(app_id: int, args: list = []) -> None
Launches an application by its ID with optional arguments.
Parameters:
app_id(int): Application ID numberargs(list, optional): Arguments to pass to the application (defaults to empty list)
Comments