PRK is a keyboard firmware platform in PicoRuby

Overview

PRK Firmware (public beta)

PRK is a keyboard firmware written and configured in PicoRuby which is an alternative mruby implementation targeting on one-chip microcontroller.

Features

  • A "keymap" can be configured in Ruby which is a concise, readable and happy language
  • RP2040 is the target platform microcontroller
  • You can write your own "action" which will be invoked when you tap or hold a key (example(TBD))

Boards

  • Raspberry Pi Pico
  • Sparkfun Pro Micro RP2040 (DEV-17177)

(left: Raspberry Pi Pico / right: DEV-17717)

Roadmap

  • Unsplit keyboard
  • Split keyboard
    • Symmetrical type. eg) Crkbd
    • Asymmetrical type. eg) ???
    • UART communication between left and right
    • I2C communication between left and right
  • Macros
  • Media keys
  • RGBLED
  • OLED display

Getting started

Contributing

Fork, clone, patch and send a pull request.

For those who are willing to contribute to PRK or write your own keymaps:

  • It's possible that your Ruby code can't be compiled as you wish
    • Remember that "Ruby" in PRK is neither CRuby nor even mruby
    • PicoRuby doesn't support some Ruby syntax and may have bugs. It would be great if you send a patch, too!
  • Unlike QMK Firmware, prk_firmware repository doesn't include individual keymaps

Keymaps for example

  • Raspberrypi Pi Pico

    • PiPi Gherkin (coming soon)
  • Sparkfun Pro Micro RP2040 (DEV-17717)

To keyboard creators:

Feel free to reach out to me if you want me to link your keymap on this README.

FAQ

  • Q: Can I use Sparkfun Pro Micro RP2040 as a drop-in replacement instead of a Pro Micro without having to modify the CRKBD PCB?

    A: Yes you can! However, note that RGBLED feature is still not implemented on PRK. And don't expect your existing CRKBS's LEDs will blink even if the feature is ready because the logic voltage of RP2040 is 3.3V while 5V on "normal Pro Micro".

    In terms of 3.3V, you should be careful of the same thing which is warned on Proton-C: https://qmk.fm/proton-c/

    Some of the PCBs compatible with Pro Micro have VCC (3.3V) and RAW (5V) pins connected (shorted) on the pcb. Using the Proton C will short 5V power from USB and regulated 3.3V which is connected directly to the MCU. Shorting those pins may damage the MCU on the Proton C.

    So far, it appears that this is only an issue on the Gherkin PCBs, but other PCBs may be affected in this way.

    In this case, you may want to not hook up the RAW pin at all.

License

Copyright © 2021 HASUMI Hitoshi. See MIT-LICENSE for further details.

Comments
  • Matrix to Layout Conversion

    Matrix to Layout Conversion

    Because the key matrix and the actual keyboard layout may be different, it would be nice to be able to write a keymap with a different layout from the key matrix, like the QMK Firmware layout macro. https://beta.docs.qmk.fm/developing-qmk/c-development/hardware_keyboard_guidelines#less-than-keyboard_name.h-greater-than

    If the Ruby syntax can handle this, I hope you can provide a sample of how to write it.

    opened by e3w2q 20
  • Builds via Docker will not load onto the microcontroller

    Builds via Docker will not load onto the microcontroller

    When I download the most recent tagged release, 0.9.14 it works perfectly on my two Seeed XIAO RP2040 boards.

    I am quite excited by PRK and interested in poking at the source (and hopefully sending in some pull requests!). I can successfully run the tests and build the latest few commits to master with the Docker image. Unfortunately, when I load the built uf2 file onto either of my boards, the board will not mount the PRKFirmware volume. Unfortunately it seems something is corrupted in the uf2? (Thankfully I can reboot the board back into bootsel mode and load the 0.9.14 firmware again.)

    I am running a Mac with Intel Core i5 processor. Here's what I'm doing:

    git checkout master
    git pull master
    rake deep_clean
    docker compose build
    docker compose run --rm prk rake setup
    docker compose run --rm prk rake
    # steep checks pass
    # tests pass
    # binaries are successfully built
    # ...
    # [100%] Linking CXX executable prk_firmware-0.9.14-20220629-d921fc5.elf
    #   adding: prk_firmware-0.9.14-20220629-d921fc5.uf2 (deflated 73%)
    # [100%] Built target prk_firmware-0.9.14-20220629-d921fc5
    
    ls build
    # ... lots of things ...
    # prk_firmware-0.9.14-20220629-d921fc5.uf2
    
    # 👉🔘 Reboot Seed XIAO RP2040 into bootsel mode
    # Drag-and-drop flash_nuke.uf2 to /Volumes/RPI-RP2
    # volume unmounts, then mounts again
    
    # Drag-and-drop prk_firmware-0.9.14-20220629-d921fc5.uf2 onto the RPI-RP2 volume
    # The volume unmounts and then nothing happens.
    

    Please let me know if I can provide any other details. Thank you!

    help wanted 
    opened by rschenk 15
  • Only during the breath effect, the LED flickers for a moment periodically.

    Only during the breath effect, the LED flickers for a moment periodically.

    Only during the breath effect, the LED flickers for a moment periodically. It does not depend on the value of Hue or Speed, and may occur when Value is changed, but the reproducibility is not good. This phenomenon does not occur with other effects.

    https://user-images.githubusercontent.com/88352328/181024985-96310a65-fb6c-46dd-9b2e-84b3a0a4f976.MOV

    opened by techmech-keeb 11
  • <<Request>> Macro keys

    <> Macro keys

    I would like to have a key where pressing it automatically writes ```, or some other list of characters. Composite keys seem close to what I want, but those press them at the same time instead of one after another. Is this possible?

    opened by SekoiaTree 11
  • Cannot build on M1 Mac

    Cannot build on M1 Mac

    I get the following error. https://gist.github.com/Taro-Hayashi/cb3bf5fcbdd13c5e02cc76c89f3c2959

    According to the error in Docker, the lemon (The Lemon Parser Generator) executable is not supported? I need someone else to try, as likely to be my shallow understanding or environmentally dependent. I have confirmed Hello World in Ruby and Blink in PICO SDK.

    opened by Taro-Hayashi 10
  • Problem with keymap not being recognized properly when connecting to Remap.

    Problem with keymap not being recognized properly when connecting to Remap.

    I used PRKFirmware 0.9.14 and created the Firmware using the following document. https://github.com/picoruby/prk_firmware/wiki/VIA-and-Remap

    If I fill in the keymap directly in via_map.txt, it works fine. On the other hand, when I connect to Remap, the keyboard is detected by the information in prk-conf.txt, but the following anomaly occurs and I cannot change the keymap properly.

    • The keymap displayed in Remap is different from what I set.
    • When I edit the keymap in Remap and flash it, the changes are reflected in only some keys.
    • When I flash a keymap in Remap, the file is corrupted.
    • The key tester in Remap is not working.

    #Windows10 #Chrome (103.0.5060.114) #PRK Firmware (0.9.14) #keyboard:OLSK60 (Adafruit KB2040) https://github.com/techmech-keeb/OLSK60/tree/main/PRK_Firmware

    opened by techmech-keeb 8
  • Implement Tone (formerly called PWM)

    Implement Tone (formerly called PWM)

    Tone

    API

    tone.new(pin)

    Set pin to use Tone.

    tone.set_tones( [ [tone1,tone_ms1], [tone2, tone_ms2], ... ] )

    Set tone sequence. (overwrites current sequence)

    tone.start()

    Start sequence.

    kbd.keys_press?

    true if any key in keyboard report, else false.

    Limitation

    tone_ms*tone < 1,000,000

    tone: 0 or >25

    Example

    require "tone"
    
    tone = Tone.new(14)
    
    tone.set_tones( [[349,250],[466,375],[440,375],[349,250],[0,125],[349,375],[392,1000], [0,125],[392,250],[523,375],[440,375],[392,250],[0,125],[392,375],[349,1000] ] )
    tone.start
    
    press = false
    
    kbd.before_report do
        if kbd.keys_press? 
            unless press
                press = true
                tone.set_tones( [ [440,50],[880,50] ] )
                tone.start
            end
        elsif press
            press = false
        end
    end
    
    kbd.start!
    

    UF2

    https://github.com/yswallow/prk_firmware/releases/tag/0.9.17-pio-tone

    #32 #138

    opened by yswallow 7
  • Dockerfile fails

    Dockerfile fails

    Hello

    Thanks for sharing your very interesting project!

    I m interested in building a binary but, I guess the instructions in the wiki will only work in linux right? for me reading about it for the first time it was not obvious I tried and fail miserable in Macos catalina (suggestion add some pointers for the environment and requisites).

    Then I tried and fail building the Dockerfile

    last messages:

    => => transferring context: 2B 0.0s => [build 2/16] RUN apt-get update && apt-get install --no-install-recommends -y 207.0s => [build 3/16] WORKDIR /prk_firmware 0.5s => [build 4/16] COPY . . 0.3s => [build 5/16] WORKDIR /prk_firmware/src/ruby 0.4s => ERROR [build 6/16] RUN bundle install 1.2s

    [build 6/16] RUN bundle install: #10 1.161 Could not locate Gemfile


    executor failed running [/bin/sh -c bundle install]: exit code: 10

    opened by pbrena 7
  • Wrong layer and modifier states

    Wrong layer and modifier states

    Environment

    version: v0.9.12

    keymap.rb:

    # Initialize a Keyboard
    kbd = Keyboard.new
    
    # Initialize GPIO assign
    kbd.init_pins(
      [ 27 ], # row0, row1,... respectively
      [ 6,7,8,9 ]  # col0, col1,... respectively
    )
    
    kbd.add_layer :default, %i(
      KC_LSFT KC_A KC_B LAYER_C
    )
    kbd.add_layer :raise, %i(
      ________ KC_1 KC_2 ________
    )
    
    kbd.define_mode_key :LAYER_C, [ :KC_C, :raise, 200, nil ]
    
    kbd.start!
    

    hardware: image

    How to reproduce

    1. press & hold KC_LSFT and...
    2. tap KC_A => A 🙆‍♂️
    3. tap KC_B => B 🙆‍♂️
    4. tap LAYER_C =>
      • expected: C
      • actual: reported nothing 🤔
    5. tap KC_A =>
      • expected: A
      • actual: 1 🤔
    opened by arai-ta 7
  • Users can change VID/PID/ProductName by `via-conf.txt`

    Users can change VID/PID/ProductName by `via-conf.txt`

    Background

    • In order to take advantage of the VIA feature (#57), VID and PID should be configurable
    • According to @yoichiro, Remap uses the "product name" in addition to the above

    Solution

    • Dragging and dropping via-conf.txt file (then reboot the board) changes the values
      image

    • The format of the content: [VID]:[PID]:[Product name]

    Example

    If via-conf.txt includes this content,

    0xbc42:0x0003:MyKeyboardName
    

    these values are going to be applied as the image shows:

    image

    enhancement 
    opened by hasumikin 5
  • Support?

    Support?

    I could not find any official/proper support channels, so I am opening an issue here. If this is not the right place, I am sorry. Let me know where the right place is, and I will take my request there.

    I have a hand-wired matrix with an inconsistent number of keys on each row, and column. The keyboard itself is/will be just a TKL.

    Layout: Screen Shot 2022-02-27 at 3 38 38 PM

    Matrix: Screen Shot 2022-02-27 at 3 51 27 PM

    keycap.rb: https://gist.github.com/igreulich/66b6f1168c312e3c95f6d82c332d86db

    When I put the keymap.rb file on my Pico, the board does not work. I can connect to it via serial port, but it looks like it never fully loads. However the board does send input to the computer, at present it sends this input with out me pressing a key, and it is constant. (Currently the input seems to be ~ and [TAB].

    I did put KC_NO in place where there is no key in the matrix, but I don't know if the fact that there is no coordinates (from the perspective of the matrix) at those locations is breaking something?

    I am concerned I have put the diodes on backwards, and that the fact that all of my rows don't have the same number of keys are my sticking points. However, I don't know enough to even know what all I don't know.

    Thanks in advanced for any help!

    opened by igreulich 5
  • Mode keys will run a proc placed in

    Mode keys will run a proc placed in "hold" no matter what the hold time is set to

    I wanted to make a key that presses backspace if tapped, and keypad enter if held for a while. This is what I ended up writing:

    kbd.define_mode_key :ENTER_DEL, [ :KC_BSPACE, Proc.new { kbd.send_key(:KC_KP_ENTER); puts "Enter" }, 10000, nil]

    (the long time and the puts is just for testing) However, if I keep it pressed, "Enter" appears in the console several times.

    Now that I think about it, this might be intended behavior. If it is, I would like to request some way of doing what I want here; a key which does one key if tapped, and another if pressed for a while.

    opened by SekoiaTree 0
  • Request: Combos

    Request: Combos

    Combos are a popular feature in other keyboard firmwares like QMK and KMK which let you chord two keypresses together to perform an action. For example: press A and B together within a 50ms period and you will send C. If the timer times out, the user releases a combo key within its timeout, or the user presses another key that would not match with a chord, the original keypress will be sent instead. The timeout should be user-configurable to account for differences in dexterity, preferably defined individually for each combo.

    QMK page on combos KMK page on combos

    enhancement 
    opened by Jawfish 0
  • Mouse keys

    Mouse keys

    Keys that work on PRK:

    | Symbol | Alias | | |---------|-------|---| | :KC_MS_UP | :KC_MS_U | Move cursor up | | :KC_MS_DOWN | :KC_MS_D | Move cursor down | | :KC_MS_LEFT | :KC_MS_L | Move cursor left | | :KC_MS_RIGHT | :KC_MS_R | Move cursor right | | :KC_MS_BTN1 | :KC_BTN1 | Press button 1 | | :KC_MS_BTN2 | :KC_BTN2 | Press button 2 | | :KC_MS_BTN3 | :KC_BTN3 | Press button 3 | | :KC_MS_BTN4 | :KC_BTN4 | Press button 4 | | :KC_MS_BTN5 | :KC_BTN5 | Press button 5 | | :KC_MS_WH_UP | :KC_WH_U | Move wheel up | | :KC_MS_WH_DOWN | :KC_WH_D | Move wheel down | | :KC_MS_WH_LEFT | :KC_WH_L | Move wheel left | | :KC_MS_WH_RIGHT | :KC_WH_R | Move wheel right |

    referenced from https://github.com/qmk/qmk_firmware/blob/master/docs/feature_mouse_keys.md

    report descriptor: https://github.com/hathach/tinyusb/blob/master/src/class/hid/hid_device.h#L221-L267

    enhancement 
    opened by hasumikin 0
  • Different pin-assign between each half of split-type

    Different pin-assign between each half of split-type

    Actual

    • Different keymap.rb should be put in the other half

    Expected for example

    kbd.split = true
    
    if kbd.anchor?
      kbd.init_pins(
        [ 4, 5, 6, 7 ],
        [ 29, 28, 27, 26, 22, 20 ]
      )
    else
      kbd.init_pins(
        [ 29, 28, 27, 26 ],
        [ 9, 8, 7, 6, 5, 4 ]
      )
    end
    
    enhancement 
    opened by hasumikin 0
Releases(0.9.18)
Owner
PicoRuby
A Ruby interpreter implementation for one-chip microcontrollers
PicoRuby
A cross platform C99 library to get cpu features at runtime.

cpu_features A cross-platform C library to retrieve CPU features (such as available instructions) at runtime. Table of Contents Design Rationale Code

Google 2.1k Oct 6, 2022
A cross-platform protocol library to communicate with iOS devices

libimobiledevice A library to communicate with services on iOS devices using native protocols. Features libimobiledevice is a cross-platform software

libimobiledevice 5.2k Oct 6, 2022
Platform independent Near Field Communication (NFC) library

*- * Free/Libre Near Field Communication (NFC) library * * Libnfc historical contributors: * Copyright (C) 2009 Roel Verdult * Copyright (C) 2009

null 1.3k Sep 28, 2022
WAFer is a C language-based software platform for scalable server-side and networking applications. Think node.js for C programmers.

WAFer WAFer is a C language-based ultra-light scalable server-side web applications framework. Think node.js for C programmers. Because it's written i

Riolet Corporation 693 Aug 16, 2022
A cross-platform OpenXR capabilities explorer and runtime switcher with a CLI and GUI.

OpenXR Explorer OpenXR Explorer is a handy debug tool for OpenXR developers. It allows for easy switching between OpenXR runtimes, shows lists of the

Nick Klingensmith 138 Oct 2, 2022
LibOS is a modern C++17 library that makes OS-specific features cross-platform.

LibOS is a modern C++17 library that makes OS-specific features cross-platform. Ever tried to get Windows version after Windows 8? Or to send ke

Gavrilikhin Daniil 27 Sep 13, 2022
split89 keyboard - a 3d printed 89 key split TKL keyboard base powered by ATmega32U4 Pro Micro controllers with QMK Configurator support.

split89 keyboard - a 3d printed 89 key split TKL keyboard base powered by ATmega32U4 Pro Micro controllers with QMK Configurator support. This keyboar

null 43 Aug 7, 2022
Raw HID keyboard forwarder to turn the Pi 400 into a USB keyboard

Raspberry Pi 400 as a USB HID Keyboard Hook your Pi 400 up to your PC somehow, using a USB Type-C cable into the power port. Anker make good ones- I u

Philip Howard 168 Sep 28, 2022
Use Atari keyboard as USB keyboard with a Teensy 3.6

Atari Keyboard Convert an Atari 600/800/1200 XL into a USB keyboard. I bricked my Atari mainboard. My goal is to use the keyboard of the Atari on a Ra

Jos Koenis 2 Dec 3, 2021
Gesture-Detecting-Macro-Keyboard - Glorified Bluetooth macro keyboard with machine learning (TensorFlow Lite for Microcontrollers) running on an ESP32.

Gesture detection tldr; Glorified Bluetooth macro keyboard with machine learning (TensorFlow Lite for Microcontrollers) running on an ESP32. Main feat

Jakob Krantz 67 Sep 4, 2022
Simple ATTiny85 based PS/2 to Amiga keyboard protocol converter that fits inside the keyboard.

Simple ATTiny85 based PS/2 to Amiga keyboard protocol converter that fits inside the keyboard.

Jari Tulilahti 8 May 6, 2022
nrf52832 nrf52810 ble keyboard firmware

BLEKeyboard nrf52832 nrf52810 ble keyboard firmware WHY Learm more about hardware design and engineering. WHAT Implement a full featured powerful and

Jason Zhou 周正昌 41 Sep 25, 2022
YUIOP60Pi DIY Keyboard Firmware

YUIOP60Pi - DIY keyboard with PGA2040 firmware Requirements PICO SDK (v1.2.0) cmake compiler or so How to build $ make Output: build\yuiop60pi.uf2 Har

MURAOKA Taro 5 Aug 19, 2022
Devterm keyboard & trackball firmware

DevTerm Keyboard Firmware How to install Install Arduino STM32 hardware package on your Arduino IDE https://github.com/rogerclarkmelbourne/Arduino_STM

SeongChan Lee 21 Apr 17, 2022
Cross-platform C++ input library supporting gamepads, keyboard, mouse, touch

This project is archived. It's neither maintained nor developed anymore. Gainput Gainput is the awesome C++ input library for your game: handles your

Johannes Kuhlmann 754 Sep 28, 2022
Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform.

Marlin 3D Printer Firmware Additional documentation can be found at the Marlin Home Page. Please test this firmware and let us know if it misbehaves i

Marlin 13.8k Oct 1, 2022
Three split ergo keyboard with macropad running QMK

IIICC Three piece split keyboard with macropad running QMK Features Split ergo Additional optional macropad with OLED and rotary encoder Central Hub d

null 30 Jul 30, 2022
ESP32 software USB host through general IO pins. We can connect up to 4 USB-LS HID (keyboard mouse joystick) devices simultaneously.

esp32_usb_soft_host esp32 USB-LS pure software host thru general IO pins. Up to 4 HID devices simultaneously. board ~$3 :https://www.aliexpress.com/pr

Samsonov Dima 285 Oct 3, 2022
Play GTA San Andreas Multiplayer with mouse only and no keyboard

Play GTA SAMP with your mouse and no keyboard! For some reason some people think it's a troll or an inside joke, IT IS NOT! This is a legit mod for th

iAmir 21 Aug 31, 2022
stacked acrylic gasket mounted ergonomic keyboard

Splay46 Build guide This keyboard requires soldering of really small smd components like USB Type C Receptacle(0.3mm pitch), Atmega32U4(0.8mm pitch),

kobakos 39 May 25, 2022