Installing the Code

The code described here is what makes the Adafruit Macropad RP2040 a Typewright and XPath tool. By modifying the pre-set definitions for each key on the macropad, each key becomes a shortcut to insert a line of markup from the Typewright optional guidelines, TEI XML tags for works of drama, or basic XPath commands.

Modifying the Keymap

My instructions here take advantage of Phillip Burgess’ excellent “Macropad Hotkeys Project” on the Adafruit site, which tells the macropad to work as a small keyboard with shortcut keys for a variety of applications. You will first install Burgess’ software and then download a few other files that will provide your macropad shortcuts specific to Typewright and XPath.

If you have not already, visit the Assembling the Adafruit Macropad and Setting It Up page and properly put your macropad together.

  1. To update what are known as the “bindings” or functions for each key on the macropad, you will need to download the “project bundle” (a collection of files) that Burgess has put together and add them to your Macropad. You can find these files and the directions for installing them here. (You do not need to follow the links about the Mu editor or custom configurations unless you want to personalize your macropad with your own modifications.)

Once this software is installed, your macropad will light up and will have been been transformed into a tool providing shortcuts for a range of applications. You can see each of these keymaps by turning the potentiometer (dial) at the top–a different list of key options, or keymap, will appear in the tiny OLED display. If you want to remove any of these (such as an application for Mac when you only use Windows or vice versa) simply delete the associated .py file from the macros folder on the macropad.

  1. In this next step, we will gather the files to make this a Typewright macropad by downloading the keymap files and saving them in the “macros” folder on the macropad. Visit Typewright Adafruit Macropad RP2040 site to download the following files. Once you have downloaded them, save these into the “macros” folder on the macropad and Burgess’ program will automatically find them and make them an option when you turn the potentiometer.

    • typewright.py

    • stage_tags.py

    • xpath.py

Once you have added these files, reset your macropad by pressing down on the potentiometer and pressing the reset button on the top-left side of the macropad. Wait for the pretty lights and then open a text editor or Typewright, click inside with your cursor, and try it out!

Further Possibilities

The code provided for the Typewright Macropad is just one way of making the Adafruit Macropad useful for Typewright markup or XPath commands. You may have your own most-frequently-used keys, or you might be able to imagine a better layout. You may even have project-specific markup that you want to include. These changes can be made by reviewing the entire “Macropad Hotkeys Project” by Phillip Burgess on the Adafruit site here.