Skip to main content
Version: Matrix OS 4.0 🚧

System API

MatrixOS::SYS provides app-facing system helpers for time, delays, reboot/bootloader actions, settings, app switching, app exit, and error handling.

The public declarations are in OS/MatrixOS.h and the implementation is in OS/System/System.cpp.

Time​

MatrixOS::SYS::Millis​

uint64_t Millis(void);

Returns milliseconds since Matrix OS started.

MatrixOS::SYS::Micros​

uint64_t Micros(void);

Returns microseconds since Matrix OS started.

MatrixOS::SYS::DelayMs​

void DelayMs(uint32_t ms);

Delays the current task for ms milliseconds. Prefer cooperative app loops for normal app timing; use delays sparingly.

System Actions​

MatrixOS::SYS::Reboot​

void Reboot(void);

Reboots the device.

MatrixOS::SYS::Bootloader​

void Bootloader(void);

Reboots the device into bootloader mode.

MatrixOS::SYS::OpenSetting​

void OpenSetting(void);

Opens Matrix OS settings.

App Switching​

MatrixOS::SYS::ExecuteAPP​

void ExecuteAPP(uint32_t appId, const vector<string>& args = {});
void ExecuteAPP(string author, string appName, const vector<string>& args = {});

Launches another app by app ID, or by author and app name.

Parameters:

  • appId: target application ID.
  • author: target application author.
  • appName: target application name.
  • args: optional arguments passed to the launched app.

MatrixOS::SYS::ExitAPP​

void ExitAPP(void);

Exits the current app and returns to Matrix OS app flow.

Error Handling​

MatrixOS::SYS::ErrorHandler​

void ErrorHandler(string error = string());

Reports a system error. Use this for unrecoverable app or system states where Matrix OS should show or record the failure.

Device Rotation​

Device rotation is exposed by the device layer, not MatrixOS::SYS:

Device::Rotate(Direction rotation, bool absolute = false);
Direction Device::GetRotation();

Use this only when your app intentionally changes the device orientation.

Comments