interface
UseVemuResult
Everything useVemu returns: emulator status, board selection, program/run controls, video + UART wiring callbacks, and the peripheral inspector surface.
interface UseVemuResultFields
| Name | Type | Description |
|---|---|---|
status | VemuStatus | Current emulator lifecycle state. |
boards | BoardInfo[] | Boards compiled into the loaded runtime. |
selectedBoard | string | Id of the currently selected board (empty string until boards are listed). |
setSelectedBoard | Dispatch<SetStateAction<string>> | Select a board by id; instantiates a fresh (non-running) machine for it. |
selectedHasDisplay | boolean | Static display capability of the selected board (false when unknown). |
hasVideo | boolean | True once the running machine has produced at least one video frame. |
ips | string | Human-readable simulated clock speed (e.g. "4.2 MHz"); empty while not running. |
loadProgram | (data: Uint8Array, kind: ProgramKind, boardOverride?: string) => void | Load a program (ROM/ELF/binary) and start running, optionally switching board first. |
loadLinux | (kernel: Uint8Array, initrd: Uint8Array, boardOverride?: string) => void | Boot 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) => boolean | Load 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 | () => void | Pause the run loop (status returns to "ready"). |
reset | () => void | Reset the machine and restart with the last loaded program. |
eraseAll | () => void | Discard the current machine and rebuild the selected board with empty flash. |
setDraw | (cb: (f: VemuFrame) => void) => void | Register the callback that renders video frames (wired up by `VemuCanvas`). |
setUartSink | (cb: (b: Uint8Array) => void) => void | Register the sink for UART output bytes (wired up by `VemuTerminal`). |
sendUart | (bytes: Uint8Array) => void | Send UART input bytes to the running machine. |
peripheralList | string[] | Names of inspectable peripherals exposed by the current machine. |
peripheralEvents | PeripheralEvent[] | Rolling buffer (last 100) of peripheral events emitted by the machine. |
peripheralError | string | null | Build/exposure error to surface in the peripheral panel, or null. |
snapshotVersion | number | Monotonic counter that bumps when inspector snapshots should be re-pulled. |
getPeripheralSnapshot | (name: string) => PeripheralSnapshot | null | Pull the current snapshot for a peripheral by name (null if unavailable). |
sendPeripheralCommand | (name: string, cmd: { name: string; params: Record<string, string> }) => void | Send a command to a peripheral's inspector. |