🛠 Build a USB HID Macro Pad with the Romu Board

Bitmerse Romu Compact USB Development Board (RP2354A) · avance · Transformez la carte Romu en un périphérique d'entrée personnalisé pour automatiser des tâches complexes via des macros.

Objectifs

This advanced tutorial aims to configure the Romu board as a USB HID (Human Interface Device) peripheral. You will learn to utilize the physical buttons on the board to send complex key combinations to the host computer, creating a compact macro pad. We will cover input event handling and keyboard simulation via the USB protocol.

Matériel nécessaire

Étapes

Install the programming tool suitable for the RP2354A microcontroller. Ensure BOOTSEL mode is accessible if the board needs resetting. Connect the Romu to your PC via its integrated USB Type-A connector.

  1. Environment Preparation

In your IDE, create a new project based on the USB HID library. Define the device descriptor so it is recognized as a standard keyboard. This ensures plug-and-play compatibility with most operating systems without specific driver installation.

  1. HID Project Configuration

Identify the internal GPIOs associated with the Romu board's buttons. Write a function to read the state of these buttons. For example, map Button 1 to the Ctrl+Shift+T macro and Button 2 to Ctrl+C. Use timers to avoid hardware debouncing issues.

  1. Physical Button Mapping

Code the key code sending sequence. For each press, the board must send the modifier key presses (Ctrl, Shift), then the main key, followed by releasing the keys in reverse order. Here is a logical structure example: ``c if (button_pressed(BTN_1)) { send_key_mod(KC_MOD_CTRL, KC_MOD_SHIFT); send_key(KC_T); release_keys(); } ``

  1. Macro Logic Implementation

Compile the code for the RP2354A target. Transfer the binary to the Romu board. Once flashing is complete, the board will automatically reconnect to the USB bus.

  1. Compilation and Flashing

Vérification

Open a text editor or browser. Press the configured macro button. If text is inserted or the corresponding action triggers (like closing a tab with Ctrl+Shift+T), the HID configuration is successful. Also verify that no additional drivers are required in the device manager.

Pour aller plus loin

Integrate the RGB LED to indicate macro states or active modes. You can also explore using Arm Trustzone security to protect sensitive macros from unauthorized reading, turning the Romu into a physical authentication key.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials