React API
Public API of @swedishembedded/vemu-react v0.10.0- generated from the package's TypeScript source.
Hooks
Own the emulator lifecycle: loading, the frame loop, I/O wiring, and peripheral state.
Components
Drop-in UI: display canvas, serial terminal, and peripheral inspector panels.
GenericInspectorDefault inspector view used for any peripheral that has no domain-specific view registered in `PERIPHERAL_VIEWS`. Renders the raw snapshot field map, pretty-printing any JSON-string fields. This is what makes "implement the inspector, see it in the UI" work before a custom view exists. Accepts the uniform PeripheralViewProps shape, so it can stand in for any registered view.
PeripheralPanelGeneric peripheral inspector panel. A permanent section (like Display and Console): it always renders, lists whatever inspectable peripherals the live machine exposes, and shows a domain-specific view when registered, otherwise the generic fallback. Empty/error states keep it visible and diagnosable.
PeripheralSelectorVertical list of inspectable peripherals (the left pane of PeripheralPanel). Renders human-friendly labels via `peripheralLabel` and highlights the current selection.
VemuCanvasPixel-perfect display surface for the emulator's video output. Registers a draw callback that blits each RGBA frame into a 2D canvas, resizing the backing store whenever the frame dimensions change, and shows a "NO SIGNAL" overlay until the first frame arrives.
VemuConsoleThe whole vemu embed in one component: boots `firmware` on `board` and renders a terminal bound to its UART. No board picker, no file loader, no controls - point it at a board id and a firmware URL.
VemuTerminalxterm.js console bound to the emulator's UART. Machine output is written to the terminal; keystrokes are passed through raw (picocom-style) as UART input. Auto-fits to its container and re-fits on resize.
Registry & Helpers
The peripheral-view registry and helpers for extending the inspector with your own views.
PERIPHERAL_LABELSOptional human-friendly labels for the selector. Unknown peripherals fall back to an upper-cased name.
PERIPHERAL_VIEWSRegistry mapping a peripheral name (as reported by the machine) to a domain-specific inspector view. A peripheral without an entry here still appears in the list and is rendered with the generic fallback view. To add a richer view for a peripheral: write a component that accepts `PeripheralViewProps`, then add one line here.
peripheralLabelDisplay label for a peripheral name: registered label or upper-cased name.
VemuTitleBarBranded title bar for the VEMU emulator window. Renders the `vemu.` wordmark as a link back to https://vemulator.com - every embedding carries attribution.
Types
Contracts you implement or consume - view props, hook results, loader injection.
CaptureKeysModeHow useVemu captures keyboard input for the guest (joypad + USB-HID keyboard): - `"focus"` (default) - keystrokes are forwarded only while an element registered via UseVemuResult.registerKeyCapture (the terminal or canvas rendered by `VemuTerminal` / `VemuCanvas` / `VemuConsole`) contains the document focus. Page-level typing outside the emulator is untouched. - `"window"` - every keystroke on the page is forwarded while the emulator runs (the pre-0.10 behaviour). Use for full-page emulator apps only. - `"off"` - no keyboard capture at all (UART input via the terminal still works; it goes through xterm's own focused textarea, not these listeners).
PeripheralViewPropsUniform props every peripheral inspector view receives. Domain-specific views (KMU, UICR) and the generic fallback all implement this interface, so adding a new view is: write a component matching these props + register it in peripheralViews.tsx.
UseVemuResultEverything useVemu returns: emulator status, board selection, program/run controls, video + UART wiring callbacks, and the peripheral inspector surface.
VemuLoaderOptional override for testing / stub mode. Returned by the `loadModule` factory passed to useVemu to replace the default wasm loading.