FlexPad

FlexPad is a freely configurable macro pad based on the ESP32-S3. The board acts as a USB keyboard and media controller and runs key sequences when a button is pressed, a toggle switch is flipped or an encoder is turned. A cross-platform desktop app written in Rust (iced) lets you place buttons, toggle switches and rotary encoders on a canvas, assign GPIO pins and macros, and transfers the configuration to the device over USB serial; the firmware is written in Rust as well (esp-hal, Embassy).

Feedback and bug reports are welcome as issues. Not affiliated with or endorsed by Espressif Systems.

FlexPad configurator with five tiles and the Tile Inspector (light mode) FlexPad configurator with five tiles and the Tile Inspector (dark mode)

Features

Hardware

PartNotes
ESP32-S3 board with native USBDeveloped with an ESP32-S3 dev module with 16 MB flash and 8 MB octal PSRAM (N16R8)
Push buttonsOne side to a GPIO pin, the other side to GND. Internal pull-ups are used, no resistors needed.
EC11 rotary encoder (optional)Pins A and B to two GPIO pins, the middle pin C to GND. The push button of the encoder like a normal button.
Toggle switch (optional)Like a push button: one side to a GPIO pin, the other side to GND. Closed is on, open is off.

Usable pins: 1, 2, 4–18, 21, 38–42, 47, 48 (25 inputs). Left out on purpose: GPIO 0, 3, 45 and 46 (strapping pins), 19/20 (USB) and 33–37, which modules with octal PSRAM or octal flash (such as N16R8) use internally.

Installation

Download the app from Releases (releases named FlexPad <version>, tag v<version>). The app contains the matching firmware and installs or updates it on the board (see Firmware). The firmware is also published on its own as FlexPad firmware <version> (tag firmware-v<version>). Changes are listed in the changelogs of the app and the firmware.

App

Windows: run FlexPad-<version>-windows-x64-setup.exe. It installs for the current user without administrator rights (to %LOCALAPPDATA%\Programs\FlexPad); "Install for all users" installs to C:\Program Files\FlexPad and asks for administrator rights. Options: Start menu entry (on), desktop shortcut (off). Instead of the installer you can use the portable archive …-windows-x64-portable.zip.

macOS: open …-macos-arm64.dmg (Apple silicon) and drag FlexPad into the Applications folder.

Linux: on Debian, Ubuntu, Linux Mint and similar, install flexpad_<version>_amd64.deb (e.g. sudo apt install ./flexpad_1.2.0_amd64.deb); on Fedora, openSUSE and similar, install flexpad-<version>-1.x86_64.rpm (e.g. sudo dnf install ./flexpad-1.2.0-1.x86_64.rpm). Both add FlexPad to the application menu. For other distributions, extract …-linux-x64.tar.gz and start flexpad; it needs libudev. To access the USB serial port, your user must be in the group dialout (Debian, Ubuntu, Fedora) or uucp (Arch): sudo usermod -aG dialout $USER, then log in again.

The app is not signed, so the system may warn on the first start:

Each download has a .sha256 file to verify it.

Installer parameters

ParameterEffect
/CURRENTUSERInstall for the current user only (default)
/ALLUSERSInstall for all users (asks for administrator rights)
/DIR="C:\Path"Installation folder
/SILENT, /VERYSILENTWithout wizard (with or without progress window)
/SUPPRESSMSGBOXESNo message boxes in silent mode
/TASKS="desktopicon"Add a desktop shortcut; without the parameter there is none
/NOICONSNo Start menu entry
/LOG="C:\Path\setup.log"Write a log file

Example: FlexPad-1.2.0-windows-x64-setup.exe /VERYSILENT /SUPPRESSMSGBOXES /TASKS="desktopicon"

Profiles and settings are stored per user and are not set by the installer. Uninstalling removes the program and its shortcuts but keeps your profiles and settings (see Privacy for the folders).

Firmware

The app contains the firmware of its own version and writes it itself, no extra tool needed:

Do not unplug the board while the progress bar is shown. If the board does not restart by itself afterwards, press RESET or unplug it briefly. The profile stored on the device is kept: only bootloader, partition table and app are written, and the image ends before the profile partition.

Alternatively, FlexPad-firmware-<version>-esp32s3.bin from the firmware release contains bootloader, partition table and firmware in one image for an ESP32-S3 with at least 8 MB flash. It is written with espflash (prebuilt downloads on its releases page, or cargo install espflash):

  1. Put the board into download mode: hold BOOT, press RESET, release BOOT. If the FlexPad firmware is already running, sending REBOOT_BOOTLOADER over its serial port does the same.
  2. espflash write-bin --chip esp32s3 --no-stub --before no-reset --after no-reset --port <port> 0x0 FlexPad-firmware-<version>-esp32s3.bin
  3. Press RESET (or unplug the board briefly). The board then shows up as "FlexPad".

A profile already stored on the device is kept: the image ends before the profile partition.

Usage

  1. Connect the FlexPad via USB and start the app.
  2. Scan, select the device and Connect.
  3. Choose the Keyboard layout of the computer the pad is used with; the key names in the macro editor follow it.
  4. Load Config reads the configuration stored on the device.
  5. Add tiles with Add Tile (button, EC11 encoder, toggle switch or your own components), drag them into place and select one to edit it in the Tile Inspector:
    • Pins: choose the GPIO pin for each connection of the component (only free, usable pins are offered),
    • Parameters: debounce time, and for encoders the steps per detent and the direction. For buttons and the push button of an encoder: Repeat while held with the time until the first repeat and the time between repeats, or, once the long press has a macro, the time after which a press counts as long (default 500 ms),
    • Functions (e.g. press, long press, turn right, turn left; for a toggle switch turn on and turn off): open one to edit its macro. Without a long-press macro, a button runs its macro right when it is pressed; with one, a short press runs on release and a long press as soon as the time is reached. Long press and repeat exclude each other,
    • in a function, build the macro from Presets or add actions (Press, Release, Delay, Media, Text) one by one. Advanced View shows the macro as raw JSON for editing.
    • Test next to a function runs its macro once on the connected device without saving anything; the answer (queued, busy or the reason for an error) is shown at the function. The macro types into the window that has the focus; text uses the keyboard layout of the profile stored on the device.
  6. The Profile menu at the end of the profile row holds the profile actions: Save Profile stores the profile on your computer, New Profile saves a copy under a new name. Set Config sends the profile to the device.
  7. To pass a profile on or keep a backup, Export... in the same menu saves the current profile as a JSON file wherever you choose. Import... reads such a file (older formats are converted), adds it to the profile list and opens it; if a profile with that name already exists, the import gets a new name such as Desk_2 instead of replacing it. Open profile folder opens the profile folder in your file manager. On Linux the file dialogs need zenity or kdialog.

Wiring test: while the app is connected, pressing a button, flipping a toggle switch or turning an encoder briefly highlights its tile on the canvas, and the status bar names the pin (e.g. "GPIO 12 pressed – not assigned" for a pin no tile uses, or "Switch on GPIO 5 turned off – Light").

Updates

At start and then every 24 hours, the app checks whether a newer release exists and then shows "Version x.y.z available" in the status bar; a click opens the release page. Nothing is downloaded or installed automatically. Check for updates in the status bar switches the check off (see Privacy).

Languages

The app comes in 51 languages, including German dialects and a few fun languages; LANGUAGES.md lists all codes. With Automatic in the Language list of the status bar, it follows the system language (on Linux LANGUAGE, LC_ALL, LC_MESSAGES and LANG) and falls back to English; dialects and fun languages are only used when chosen there. The choice is saved in the settings. This README names the buttons with their English labels.

The translations were generated by Claude (AI). Most of them have not been checked by a native speaker yet; LANGUAGES.md and the header of each file show which ones have. If you notice a mistake or know a better wording, please open an issue or a pull request. Reviewers are credited with their GitHub name in the language file and in LANGUAGES.md, if they agree.

The texts are plain text files named after the language code, e.g. de.lang or pt-BR.lang, with one key = text per line, in flexpad-desktop/lang. They are built into the app. To add a language or change single texts, put a file with the same format into the folder lang next to the settings (on Windows %APPDATA%\FlexPad\lang, on macOS ~/Library/Application Support/FlexPad/lang, on Linux ~/.config/flexpad/lang); its texts take priority. To start a new language, copy en.lang, translate the texts after the = and keep the keys and placeholders such as {name}. Missing texts are taken from the fallback language (language.fallback), otherwise from English.

Components

The components offered by Add Tile are described in JSON files: name, pins, functions with their default macros, and parameters. Button, EC11 encoder and toggle switch are built in. To add your own, e.g. another encoder model with different defaults or an encoder without a push button, put a definition into the folder components next to the settings (on Windows %APPDATA%\FlexPad\components, on macOS ~/Library/Application Support/FlexPad/components, on Linux ~/.config/flexpad/components) and restart the app. Each definition uses one of the kinds the firmware knows (button, encoder, switch), so no new firmware is needed. docs/components.md describes the format.

Keyboard layouts

Text actions are typed for the keyboard layout chosen in the profile: English (US), English (UK), German, German (Switzerland) or French, as on Windows and Linux (macOS places some characters elsewhere). Characters the layout cannot type are skipped by the device; the macro editor names them. Each layout is a file <code>.layout in layouts with labels and characters per key position; the firmware and the app compile them in, so a new layout needs a new build of both, but no code. LAYOUTS.md describes the format and lists all layouts and whether they have been reviewed. The layout files were generated by Claude (AI); if a character is typed wrongly, please open an issue or a pull request.

How it works

The firmware polls the configured pins every millisecond, debounces buttons and switches, decodes encoders and runs the assigned macro as USB HID keyboard and consumer control (media keys) reports. The profile is stored as JSON in its own flash partition with two slots and a checksum, so it survives a restart and an interrupted save.

The app and the device talk over the USB serial port of the board (line-based text commands, each terminated with \n). The complete protocol and profile format are described in docs/protocol.md; overview:

CommandResponse
GET_DEVICE_INFODEVICE_INFO:FlexPad,<serial number>,<firmware version>
GET_CONFIGCONFIG_DATA:<profile JSON>
SET_CONFIG:<profile JSON>CONFIG_SAVED, or CONFIG_ERROR:<reason> (e.g. unusable_pin:35, duplicate_pin:4) without changing the stored profile
RUN_MACRO:<function JSON>Runs a macro for testing, e.g. RUN_MACRO:{"actions":[{"media":"mute"}]}: MACRO_QUEUED, or MACRO_ERROR:<reason>
REBOOT_BOOTLOADERREBOOTING:bootloader, then the board restarts in download mode for flashing
–Sent by the device: EVENT:PIN:<pin>:PRESSED/RELEASED and EVENT:ENCODER:<pin a>:RIGHT/LEFT

Each function of a tile holds a macro as a list of actions: {"press":"<key>"}, {"release":"<key>"}, {"delay":<ms>}, {"media":"<action>"} and {"text":"<text>"} (typed with the keyboard layout chosen in the profile, see Keyboard layouts). Example (copy): {"actions":[{"press":"ControlLeft"},{"press":"KeyC"},{"delay":50},{"release":"KeyC"},{"release":"ControlLeft"}]}. Older profiles with comma-separated macro strings (P:ControlLeft,P:KeyC,…) are converted when loaded.

Key names describe the physical key position on a US keyboard, using the names of KeyboardEvent.code (KeyA, Digit1, ControlLeft, Semicolon, IntlBackslash, NumpadAdd, F13 …). On a German layout, Semicolon therefore types ö and KeyZ types y. The app shows the keys with the labels of the keyboard layout chosen in the profile (e.g. KeyY as "Z" on a German layout); older names from earlier versions (lctrl, ael, kp_1 …) are converted when a profile is loaded. Macros run in the background: the device keeps answering serial commands, and all keys are released when a macro ends.

Privacy

License

MIT

Release packages, the installer and the Linux packages include THIRD-PARTY-LICENSES.txt with the licenses of all third-party components built into the app and its embedded firmware; each firmware release has its own FlexPad-firmware-<version>-third-party-licenses.txt. The CI fails if a dependency uses a license that is not on the allow list in .github/scripts/third_party_licenses.py.