Documentation
¶
Overview ¶
┌──────────────────────────────────────────────────────────────────────┐ │ layout.go — Main Layout, Navigation & Theme Switching │ │ │ │ Demonstrates: │ │ • ui.VStack / ui.HStack — vertical and horizontal stacking │ │ • ui.AppBar — top application bar with action buttons │ │ • ui.Expanded — fills remaining space in a stack │ │ • ui.Scroll — vertical scroll wrapper │ │ • ui.Style(view).Padding() — modifier chaining │ │ • ui.ViewFunc — bridging a lower-level Gio widget into a View │ │ • Theme switching via ThemeRefValue.Set() │ │ • Page routing with a plain Go switch statement │ └──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐ │ Pingo — RPi Pico / Pico 2 Pin Selector │ │ A demo application showcasing the ImmyGo UI framework. │ │ │ │ This project is structured as a learning guide for building │ │ desktop apps with ImmyGo. Each file covers a specific concept: │ │ │ │ main.go → App entry point, ui.Run, theme, options │ │ state.go → Reactive state, AI engine, persistent widgets │ │ layout.go → Main layout: AppBar, SideNav, page routing │ │ page_pinout.go → Pinout + pin selector + AI assist │ │ page_mypins.go → Selected pins summary, conflict detection │ │ page_settings.go → AI provider & app settings │ │ svg.go → Embedding & rasterising SVG assets │ │ pindata/ → Domain model (no UI dependency) │ └──────────────────────────────────────────────────────────────────────┘
How ImmyGo Apps Work ¶
- Call ui.Run() with a title, a build function, and options.
- The build function returns a ui.View tree every frame.
- ImmyGo handles Gio's layout.Context/Dimensions internally.
- Use State[T] for reactive values that trigger re-renders.
- Stateful widgets (SideNav, Toggle, etc.) must persist across frames — store them in package-level variables.
Running ¶
go run .
Requires Gio system deps on Linux:
apt install libwayland-dev libxkbcommon-x11-dev libgles2-mesa-dev \ libegl1-mesa-dev libx11-xcb-dev libvulkan-dev libxcursor-dev libxfixes-dev
┌──────────────────────────────────────────────────────────────────────┐ │ page_mypins.go — Selected Pins Summary Page │ └──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐ │ page_pinout.go — Interactive Pinout & Pin Selector (CubeMX-style) │ │ │ │ The pinout page is the primary pin selection interface: │ │ 1. Select a peripheral category (SPI, I2C, UART, etc.) │ │ 2. Pick a specific function (e.g., SPI0 RX) │ │ 3. Click an eligible pin on the diagram to assign it │ │ 4. Click an assigned pin to deassign it │ │ │ │ Eligible pins highlight in cyan, assigned pins show their │ │ function in the peripheral's category color. │ └──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐ │ page_settings.go — AI & App Settings Page │ │ │ │ Non-secret settings (provider, model, host, temperature, tokens) │ │ are persisted to ~/.config/pingo/settings.json. │ │ API keys are NEVER written to disk — use the ANTHROPIC_API_KEY │ │ environment variable or enter the key in the masked input │ │ (held in memory only for the current session). │ └──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐ │ state.go — Reactive State Management │ │ │ │ ImmyGo provides State[T], a generic thread-safe reactive value. │ │ When you call state.Set(v), the UI automatically re-renders on │ │ the next frame. Use state.Get() in your build function to read. │ │ │ │ Key rules: │ │ • State is goroutine-safe (uses sync.RWMutex internally). │ │ • Calling Set() bumps an internal version counter that ImmyGo │ │ uses to detect changes. │ │ • Update(fn) applies a transformation atomically. │ │ │ │ For stateful Gio widgets (SideNav, Toggle, Clickable, Editor), │ │ you MUST store the widget in a package-level var so it persists │ │ across frames. Creating a new widget every frame destroys the │ │ click/press state and breaks interactivity. │ └──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐ │ svg.go — Embedding & Rendering SVG Assets │ │ │ │ Demonstrates: │ │ • Go 1.16+ embed directive for bundling assets into the binary │ │ • Using oksvg + rasterx to rasterise SVG → image.NRGBA │ │ • Displaying raster images via ui.Image(img).Size(w, h) │ │ │ │ ImmyGo's ui.Image takes any image.Image and renders it via Gio's │ │ GPU pipeline. Since Gio doesn't have native SVG support, we │ │ rasterise the SVG once at startup and cache the result. │ │ │ │ The Pico board SVG comes from: │ │ https://github.com/tinygo-org/playground/tree/main/parts │ └──────────────────────────────────────────────────────────────────────┘
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
imgtest
command
|
|
|
Package pindata provides comprehensive pin mapping data for Raspberry Pi Pico boards and bare RP-series microcontroller chips.
|
Package pindata provides comprehensive pin mapping data for Raspberry Pi Pico boards and bare RP-series microcontroller chips. |

