# Playground development guide [简体中文](playground-guide.md) | English On compatible firmware, an app is Python source on the TF card. Edit, validate, copy, and run it without compiling or flashing the main firmware. This release pairs SDK v2.4.0 with firmware v1.10.45; the SDK's minimum firmware contract remains v1.10.33. ## Choose an application form | Form | Entry point and installation | | --- | --- | | Finite task | Run once, submit results, and return; TF card `playground/` directory | | Interactive app | First line: `# pwks2: appui`; draw and wait for events in an `appui` session | | Custom clock face | `API_VERSION = 1` and `update(ctx)`; upload one Python file through the web interface | [Hello World](../sdk/examples/hello_world.py) is a minimal interactive app; press the lower-right F1 key to exit. [More examples](../examples/README.en.md) cover drawing, diagnostics, results, and external-bus clock-face templates. ## Develop with AI assistance Give the AI your requirements, this guide, the [API reference](api-reference.en.md), and the relevant SDK contracts. Include the firmware version, application form, display size, physical keys, peripheral model, GPIO/bus assignments, timeouts, and exit behavior. Keep real credentials, PINs, keys, and backups out of prompts. Example prompt: ```text Write a MicroPython interactive app using the PWKS2 SDK. The first line must be # pwks2: appui. Use a 128x64 monochrome canvas. The encoder changes a value; F3 increments it, F2 resets it, and F1 exits. Handle CLOSED/F1 before other events. Use with appui.open and wait_event(50). Call present only when the display changes. Avoid busy loops, background threads, and undeclared hardware operations. Use action labels only in the bottom bar at y=53..63: left F3, center F2, right F1. Use actual public APIs; identify missing interfaces instead of inventing them. Deliver complete source, installation path, dependencies, bounded timeouts, exit cleanup, and verification steps. ``` ## Validate and deploy From the repository root: ```sh cp sdk/examples/hello_world.py sdk/sdcard/playground/hello_world.py python3 sdk/tools/verify.py python3 sdk/tools/deploy.py /run/media/USER/CARD --dry-run python3 sdk/tools/deploy.py /run/media/USER/CARD ``` Use the root of the mounted raw TF card. After USB SD transfer, safely eject it and wait for local mounting to resume. By default, deployment does not overwrite different contents or delete existing files. Back up files before requesting an overwrite. Store application data under `playground_data//`. Type hints and API topic indexes are for development and are not deployed. ## Lifecycle Use `with` for UI sessions and `finally` to release your own GPIO, SPI, UART, and file resources. Do not reinitialize system OLED/RTC I²C, TF SPI, or battery ADC. Each clock-face update, including sensor operations, must finish within one second; choose bounded transactions appropriate to your sensor protocol. Interactive apps pause background FIDO2. Apps share the system VM and storage. The [SDK](../sdk/README.en.md) includes detailed contracts, type hints, and host tools and can be copied and packaged independently. Host syntax and mock checks need on-device testing for repeated runs, exits, exceptions, low memory, and peripheral failures. ## Publish your work You may distribute your apps free of charge or sell them, with your choice of open-source or closed-source licensing. Using the SDK does not require publishing your application source. Preserve the license when distributing necessary SDK portions with an app; third-party code retains its own terms. See the [SDK license](../LICENSE.en.md).