Keyboard Builders' Digest
5% off Invokeys' tasty switches!
Keyboard Builders' Digest / Advent Calendar

PRK Firmware's 2022

Developer hasumikin introduces the PRK firmware and sums up this year's achievements.

hasumikin
Published December 12, 2022
This post is part of the KBD.NEWS Advent Calendar 2022. The previous article was: Keyboard Case Design by Sadek Baroudi. Stay tuned and check back for more articles tomorrow!

My name is Hitoshi Hasumi. I'm the author of PRK Firmware, and it's the reason that I'm writing this article. When looking at the KBD.NEWS Advent Calendar 2022, I saw that my entry would be one of two describing a keyboard firmware framework (the other being ZMK). I want to take this opportunity to write about how and why I made PRK, what PRK can do, what my future plans are, and what you can do for it.

PicoRuby

I live in Matsue, Japan, which is famous for being the place where Matz lives. He is the creator of the Ruby programming language, which is used by huge web services such as Airbnb, Shopify and GitHub.

While Ruby has contributed to the development of web services around the world, its presence in the embedded programming field is not very dominant.

Pic: Matz and Hasumikin

Matz and Hasumikin

Matz wasn't leaving the situation that way. He has started writing another Ruby implementation named mruby 10 years ago. But from my point of view, mruby, especially the compiler, had a shortcoming regarding footprint. It was difficult to run it on a one-chip microcontroller that is typically used for DIY keyboards. This was the reason I wrote PicoRuby with an even smaller footprint. It's the language of the PRK Firmware.

My case is possibly unique as I'm writing both a programming language and a keyboard firmware using that language.

Unexpected reputation

To be honest, I never thought people who are not knowledgeable of Ruby would use PRK for their keyboards. When I started to write PRK Firmware in March 2021, I meant for it to showcase what PicoRuby is capable of. I wanted to develop PicoRuby into an integrated microcontroller programming framework.

However, after publishing my presentations about PRK Firmware (RubyKaigi 2021 in Japanese and RubyConf 2021 in English), a lot of people reached out to me to ask how to write a keymap.rb for their keyboard. Surprisingly, not all of them knew Ruby and many of them weren't even familiar with programming.

According to the people who actually use PRK, it turns out to be helpful to design prototypes of their new keyboards.

Features

Let me summarize the PRK Firmware in a technical aspect here:

  • Target MCU is RP2040
  • Easy to configure. You don't need to build your firmware. Just drag and drop your keymap.rb into the mass storage
  • Working features
    • Keyscan: Direct/Duplex/Round-robin
    • RGB LED
    • Split type
    • Consumer (Media) key
    • Composite key
    • Rotary encoder
    • Joystick
    • VIA (through Remap)
    • Piezoelectric sounder
    • Num/Caps/Scroll lock indicator
    • Debouncing
  • Features that do not work (yet)
    • Combos
    • Mouse keycode from keyscan
    • Mouse/Trackball to move the pointer cursor
    • OLED display
    • Modulo (I/O expander)
    • Wireless

This year's notable implementations

VIA and Remap

Documantation

You can configure your keyboard's behavior by just dragging and dropping the keymap.rb file. It is what I wanted to include in the early stages of development. I am personally satisfied with that feature because writing a Ruby script is not bothersome for me. On the other hand, I naturally understand many others will not feel the same.

That's why PRK introduces VIA feature. You can configure your keymap on Remap.

By the way, QMK Firmware has made some breaking changes including VIA-related keycodes: Link. This means 3rd party products like Remap and PRK Firmware have to decide whether to catch up or not.

The PRK community, if I can call it so, is currently discussing having PRK's own GUI system. I'm dreaming of an exclusive browser-based UI which will include PRK-specific functions such as Ruby syntax checker.

Joystick

Documentation

I am not a gamer and don't need a gamepad. However, I think DIY keyboards equipped with a joystick will possibly be helpful to make a prototype of consumer electronics and professional consoles. It may also be a good input device for those who have some physical handicap.

Piezoelectric sounder and MML

Documentation

Do you know Music Macro Language? If so, you are a 20th century technologist.

Coming up next

As I mentioned, my ultimate goal is to make PicoRuby a microcontroller framework. To do so, I'm involved in a team which includes Matz, formulating a low-level API documentation that is common between the embedded Ruby family. Actually, this is the a reason that I still haven't implemented features like Mouse/Trackball and OLED. You may need a little bit more explanation.

Mouse and OLED will be implemented with low-level interface of I2C and SPI. If I create a high-level API of, for example, mouse, without designing a robust low-level API of SPI, there is a risk that incompatibilities will occur later due to changes in the low-level API. And it's more of a certainty than a risk, I believe so from my experience of a web developer.

Here is the good news. Our team has recently formulated the low-level API document version 1.0. It will definitely accelerate the development of those features.

Questions you may want to ask

Is PRK supporting wireless?

Currently, no. When the Raspi Pico supports bluetooth, we will probably implement bluetooth HID. But I don't think the battery would last for a long time.

Will PRK support MCUs other than RP2040?

Hmm, it's improbable, I think. But I'm personally interested in nRF52 series. Now I'm working on converting the Ruby code of PRK Firmware into a Ruby library which means it will be independent from RP2040 hardware. You will likely be able to make another PRK Firmware for another MCU.

There is an idea behind this work: I don't think it's a good way that a firmware framework packs "everything" into one repository in terms of maintainability. A concept of a library management system called "mrbgems" may help us make another PRK for another MCU in a little bit more concise workflow.

PRK is an Open Source Software

PRK Firmware is an OSS product which is published under MIT license. You can use it without any cost. There are now two active contributors, @ysni_pub and me. The development speed of PRK Firmware is not very fast because we develop it in our spare time.

Pic:

Nevertheless, we will never stop. So, we really encourage you to join the development initiative. Please reach out to me if you are interested in developing and maintaining PRK itself or even writing its documentation!!!

This article was written with a "Willow" layout GPK60-W + SparkFun Pro Micro RP2040 driven by PRK Firmware + Drop MT3 Skiidata keycap set + Zomo Silicone Kitty Paw Keycaps. I forgot the name of the switches :(

Hitoshi Hasumi (48)

hasumikin
LocationMatsue, Japan
DescriptionThe author of PRK Firmware and PicoRuby
OccupationProgrammer
Joined2020
NicheSymmetrical layout like willow and column staggered
Fav. switchLinear switches
Fav. profileMT3
Other hobbiesSwimming, Bathing in hot springs (Onsen♨)
Linkshttps://twitter.com/hasumikin, https://github.com/picoruby
Do you like this post? Share, donate, subscribe, tip me off!

Published on Mon 12th Dec 2022. Featured in KBD #107.


Related

Unicode in QMK

Dealing with Unicode in QMK revealed by mikefettis.

Why on earth should a keyboard do that?

Nick Brassel (@tzarc), one of QMK’s Directors, wasn’t satisfied with keyboards only having switches and an indicator LED or three.

PRK firmware

PRK is a PicoRuby-based keyboard firmware running on RP2040 chips.

Cyberpunk OLED glitch

A cool OLED glitch animation by Aleks with open-source firmware and bitmap frames.

ZMK: A History

Pete Johanson sums up the early days of ZMK, everyone's favorite wireless first firmware, and looks into the future.

Luna - a QMK keyboard pet

Luna is a QMK keyboard pet by HellSingCoder reacting to your typing speed and same layer states (video, git).

×
top