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.
Features
- Up to 25 inputs on one ESP32-S3: push buttons, toggle switches and EC11 rotary encoders
- Macros made of key presses and releases, delays, media keys and text
- Visual editor: place tiles on a canvas, assign pins and build macros from presets or step by step
- Debounce time, encoder resolution and direction adjustable per tile
- Buttons with a second macro on a long press, or repeating their macro while held (e.g. for volume or arrow keys)
- Profiles stored locally and on the device; the device works without the app once configured
- Text typed for five keyboard layouts: English (US and UK), German, German (Switzerland) and French
- App in 51 languages, including German dialects and a few fun languages
- No driver, no account, no network access except an optional update check (see Privacy)
Hardware
| Part | Notes |
|---|---|
| ESP32-S3 board with native USB | Developed with an ESP32-S3 dev module with 16 MB flash and 8 MB octal PSRAM (N16R8) |
| Push buttons | One 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:
- Windows: SmartScreen → "More info" → "Run anyway"
- macOS: the app is not notarized by Apple. On the first start macOS refuses to open it; then choose System Settings → Privacy & Security → "Open Anyway" (on older versions: right-click the app → "Open"). This is needed only once.
Each download has a .sha256 file to verify it.
Installer parameters
| Parameter | Effect |
|---|---|
/CURRENTUSER | Install for the current user only (default) |
/ALLUSERS | Install for all users (asks for administrator rights) |
/DIR="C:\Path" | Installation folder |
/SILENT, /VERYSILENT | Without wizard (with or without progress window) |
/SUPPRESSMSGBOXES | No message boxes in silent mode |
/TASKS="desktopicon" | Add a desktop shortcut; without the parameter there is none |
/NOICONS | No 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:
- Update: if the connected FlexPad runs an older firmware, a bar above the canvas shows "Update firmware". The app restarts the FlexPad into its bootloader, writes the firmware and restarts it.
- First installation or recovery: hold BOOT, press RESET, release BOOT (or hold BOOT while plugging in the board), then click Scan. A bar above the canvas shows "Install firmware" for the board in bootloader mode.
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):
- Put the board into download mode: hold BOOT, press RESET, release BOOT. If the FlexPad firmware is already running, sending
REBOOT_BOOTLOADERover its serial port does the same. espflash write-bin --chip esp32s3 --no-stub --before no-reset --after no-reset --port <port> 0x0 FlexPad-firmware-<version>-esp32s3.bin- 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
- Connect the FlexPad via USB and start the app.
- Scan, select the device and Connect.
- Choose the Keyboard layout of the computer the pad is used with; the key names in the macro editor follow it.
- Load Config reads the configuration stored on the device.
- 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.
- 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.
- 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_2instead of replacing it. Open profile folder opens the profile folder in your file manager. On Linux the file dialogs needzenityorkdialog.
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:
| Command | Response |
|---|---|
GET_DEVICE_INFO | DEVICE_INFO:FlexPad,<serial number>,<firmware version> |
GET_CONFIG | CONFIG_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_BOOTLOADER | REBOOTING: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
- The firmware never connects to the internet. The app makes one optional request, the update check: at start and then every 24 hours while it runs, it sends an HTTPS GET request to
https://api.github.com/repos/TripleT3005/FlexPad/releases/latestand receives the information about the latest release (version number and link), which is compared with the installed version; if it is newer, "Version x.y.z available" appears in the status bar at the bottom and opens the release page in your browser when clicked. Nothing is downloaded or installed. GitHub sees your IP address and theUser-AgentFlexPad/<version>; nothing else is sent. Switch it off with Check for updates in the status bar (saved in the settings); then the app makes no request at all. - The app only talks to serial ports on your computer. To find FlexPad devices it only opens USB serial ports whose USB serial number starts with
FlexPad-(Espressif vendor ID303A) and asks them withGET_DEVICE_INFO; other devices are not touched. A scan also looks in the port list for an ESP32-S3 in bootloader mode (303A:0009) without opening it; that port is only opened when you click "Install firmware" or "Update firmware". - Profiles and settings are stored per user: on Windows in
%APPDATA%\FlexPad, on macOS in~/Library/Application Support/FlexPad, on Linux settings in~/.config/flexpadand profiles in~/.local/share/flexpad(or the folders set inXDG_CONFIG_HOMEandXDG_DATA_HOME). Files from the folderFlexPadin the home directory used by earlier versions are moved there once on start. Position and size of the window belong to the computer and are kept inwindow.json: on Windows in%LOCALAPPDATA%\FlexPad, on macOS next to the settings, on Linux in~/.local/state/flexpad(orXDG_STATE_HOME). The device stores the complete profile you send to it, so Load Config shows the same profile on any computer. Older profiles are converted to the current format when loaded. - The language files are built into the app or read from the local
langfolder next to the settings; choosing a language makes no network request. - Component definitions are built into the app or read from the local
componentsfolder next to the settings; they cause no network requests. - Export... and Import... only write or read the file you choose in the file dialog, and Open profile folder only opens the local profile folder; none of them makes a network request. The dialogs are those of the system (on macOS via
osascript, on Linux viazenityorkdialog). - The device identifies itself with a serial number derived from the chip's MAC address.
License
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.