Skip to content

Repository files navigation

ModGadget Examples

This repository contains standalone TinyGo examples for the M5Stack Cardputer ADV using ModGadget.

ModGadget and ModGadget Fonts are obtained as ordinary Go module dependencies. A local clone of the ModGadget repository is not required.

Each example can be built independently and demonstrates a specific part of the ModGadget application model, ranging from static multilingual text to keyboard-driven applications.

Examples

Example Description
multilingual-text Static English, Japanese, Chinese, and Korean text
multilingual-ticker Looping horizontal scroll with four languages
multilingual-ticker2 Independent 24-dot multilingual tickers with different positions and speeds, plus an elapsed-time display
multilingual-document Application-level vertical document scrolling with a four-language ModGadget introduction
multilingual-showcase One-shot 24-dot ticker with nine multilingual greetings, alternating white and cyan
audio-beep Standalone example of the public Cardputer ADV audio API, playing three built-in patterns
keyboard-typing Keyboard-driven text entry with Backspace and Cardputer ADV volume shortcuts
mgz-text Static multilingual text using the compressed 24-dot MGZ font package

Complete application

For a complete application built with the same public ModGadget APIs, see:

Rdon Type 100 combines multilingual fonts, text layout, Viewports, scrolling, keyboard input, audio, and application state into a complete Cardputer ADV typing game.

A prebuilt firmware image is also available from the Rdon Type 100 Releases page.

Clone

Clone this repository:

git clone https://github.com/rdon-key/modgadget-examples.git
cd modgadget-examples

Download the Go module dependencies:

go mod download

ModGadget and ModGadget Fonts are downloaded automatically through the Go module system.

TinyGo setup

The Cardputer ADV examples cannot currently be built with a released version of TinyGo. They require TinyGo 0.42.0-dev built from the TinyGo dev branch, which includes support for the M5Stamp-S3A.

The multilingual examples and keyboard-typing, which embed multilingual MGZ font data, also require the ESP32-S3 large-flash fix provided by PR #5567. The font-free audio-beep example does not require this fix.

Without this fix, the ESP32-S3 ROM bootloader may reject a large firmware image before TinyGo startup code begins executing.

For complete TinyGo source-build and patch instructions, see the Rdon Type 100 TinyGo setup.

Build

Each example can be built independently.

For example:

tinygo build -target=m5stamp-s3a ./multilingual-text

Other examples can be built by replacing the final directory name:

tinygo build -target=m5stamp-s3a ./multilingual-ticker
tinygo build -target=m5stamp-s3a ./multilingual-ticker2
tinygo build -target=m5stamp-s3a ./multilingual-document
tinygo build -target=m5stamp-s3a ./multilingual-showcase
tinygo build -target=m5stamp-s3a ./audio-beep
tinygo build -target=m5stamp-s3a ./keyboard-typing
tinygo build -target=m5stamp-s3a ./mgz-text

Flashing instructions and example-specific controls are documented in each example's README.

Test

Logic that can run on the host is tested with the standard Go toolchain:

go test ./...

Hardware-specific main.go files use TinyGo build constraints.

Host-side tests do not access the Cardputer ADV hardware. Before flashing an example, also build it with the required TinyGo development version.

Related projects

Repository Purpose
modgadget TinyGo UI/device toolkit and core API-focused or diagnostic examples
modgadget-examples Standalone practical examples that consume ModGadget as a module dependency
modgadget-fonts Importable multilingual MGZ bitmap-font packages
rdon-type100 Complete multilingual Cardputer ADV application
modgadget-font-assets Canonical font sources, provenance, generation, and validation

License

BSD 3-Clause.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages