vemu.

interface

UseVemuResult

Everything useVemu returns: emulator status, board selection, program/run controls, video + UART wiring callbacks, and the peripheral inspector surface.

interface UseVemuResult

Fields

NameTypeDescription
statusVemuStatusCurrent emulator lifecycle state.
boardsBoardInfo[]Boards compiled into the loaded runtime.
selectedBoardstringId of the currently selected board (empty string until boards are listed).
setSelectedBoardDispatch<SetStateAction<string>>Select a board by id; instantiates a fresh (non-running) machine for it.
selectedHasDisplaybooleanStatic display capability of the selected board (false when unknown).
hasVideobooleanTrue once the running machine has produced at least one video frame.
ipsstringHuman-readable simulated clock speed (e.g. "4.2 MHz"); empty while not running.
loadProgram(data: Uint8Array, kind: ProgramKind, boardOverride?: string) => voidLoad a program (ROM/ELF/binary) and start running, optionally switching board first.
loadLinux(kernel: Uint8Array, initrd: Uint8Array, boardOverride?: string) => voidBoot a Linux kernel + initramfs (arm64) and start running, optionally switching board first. Uses the wasm `newLinux` factory: the board builder generates the DTB and bootargs, so only the raw kernel `Image` and `initrd` bytes are passed. UART wiring is identical to loadProgram.
loadUicr(data: Uint8Array) => booleanLoad a raw UICR image (uicr.bin) into the running machine's UICR region. Returns false when no machine is built or the board has no UICR. Not persisted - re-apply after loading a new program image.
stop() => voidPause the run loop (status returns to "ready").
reset() => voidReset the machine and restart with the last loaded program.
eraseAll() => voidDiscard the current machine and rebuild the selected board with empty flash.
setDraw(cb: (f: VemuFrame) => void) => voidRegister the callback that renders video frames (wired up by `VemuCanvas`).
setUartSink(cb: (b: Uint8Array) => void) => voidRegister the sink for UART output bytes (wired up by `VemuTerminal`).
sendUart(bytes: Uint8Array) => voidSend UART input bytes to the running machine.
peripheralListstring[]Names of inspectable peripherals exposed by the current machine.
peripheralEventsPeripheralEvent[]Rolling buffer (last 100) of peripheral events emitted by the machine.
peripheralErrorstring | nullBuild/exposure error to surface in the peripheral panel, or null.
snapshotVersionnumberMonotonic counter that bumps when inspector snapshots should be re-pulled.
getPeripheralSnapshot(name: string) => PeripheralSnapshot | nullPull the current snapshot for a peripheral by name (null if unavailable).
sendPeripheralCommand(name: string, cmd: { name: string; params: Record<string, string> }) => voidSend a command to a peripheral's inspector.