#rp2040 #graphics #cortex-m #games

kywy

Kywy is a simple and easy-to-use library for building games on the Kywy Device

8 releases

Uses new Rust 2024

new 0.3.7 May 4, 2025
0.3.6 May 4, 2025
0.3.2 Apr 30, 2025
0.2.0 Apr 19, 2025

#171 in Embedded development

Download history 139/week @ 2025-04-15 124/week @ 2025-04-22 687/week @ 2025-04-29

950 downloads per month

GPL-3.0-or-later

110KB
1K SLoC

Rust 1K SLoC // 0.0% comments Python 114 SLoC // 0.0% comments Shell 28 SLoC // 0.3% comments Bazel 16 SLoC // 0.2% comments Alex 7 SLoC

Kywy Rust Support

the tiny game device with big possibilities: education, game dev, diy electronics, and more

Linktree   Discord   Website   Store


What is Kywy?

Front and back render of a Kywy device

The hardware features:

  • a 144x168 LCD screen
  • two buttons plus a joystick
  • SD card slot
  • all day battery life
  • I/O: USB-C, GPIO headers, and I2C

The software is designed to give you easy and intuitive access to all of those with only a few lines of code.

Where to buy

Get a kywy on kywy.io

Rust library for Kywy devices

This is an rust library for building out rust programs on the Kywy device it is currently experimental. You can also find the C++/Arduino library on github or in the Ardiuno library manager.

For support, join our discord:

Discord

Rust docs

Link

Still in progress

This is a work in progress.

To do:

  • Implement display driver (LS013B7DH05)
  • Implement button interface
  • Implement battery interface
  • Implement USB serial and reboot
  • Sprites
  • Improve battery reading function with real data
  • Build game engine
  • Add more documentation
  • Add more examples/games
  • Implement SD-card interface (waiting on shared bus support from embedded-sdmmc)

Build examples

This repo supports vscode environments and code spaces

Open in GitHub Codespaces

To build this run: cargo build --release --target thumbv6m-none-eabi --example <example_name> replacing <example_name> with one of the .rs files in the examples directory.

To convert to a UF2 file run: elf2uf2-rs target/thumbv6m-none-eabi/release/examples/<example_name> you can install elf2uf2-rs by running: cargo install elf2uf2-rs (make sure your path is set properly to find the binary)

UF2 file will then be in the directory 'target/thumbv6m-none-eabi/release/examples/'

Uploading UF2 files

Note that your code must use the kywy_usb_from! macro to support automatic rebooting. To do this start a baud 1200 terminal on the device.

You can also put the device into programming mode manually:

  1. Turn off and unplug the device
  2. Use a paper clip to press and hold the reset button on the back to the right of the kywy logo
  3. while holding insert the USB
  4. wait a second and you should see a usb device. You can now release the button

You can now copy the UF2 to the USB storage device.

Including as a crate from crates.io Crates.io Version

use this to add kywy to a rust project:

cargo add kywy

You will need additional setup files, it may be easier to git clone this repo and make a new example file in it.

Editing your own

You can add an example to build directly from this repository by creating or modifying a file in the examples directory.

to start your own project with minimal configuration, download this repository with git clone https://github.com/KOINSLOT-INC/kywy-rust/ you can then add a new example in the examples directory. Build it with the command above in build examples.

Setup rust

Prerequisites:

  • Familiarity with using the terminal, installing programs, and using PATH variables
  • Familiarity with using development tools
  1. Install rust with rust according to the official documents: https://rustup.rs
  2. Make sure you set your paths for rust and cargo bin
  3. Install elf2uf2-rs: cargo install elf2uf2-rs
  4. Test that elf2uf2-rs is in your path by running elf2uf2-rs

Dependencies

~28–38MB
~506K SLoC