Skip to content

knxhelden/Buttonbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎮 Buttonbox Firmware

A modular USB-HID firmware for a custom Sim-Racing Buttonbox (Arduino Leonardo)

This repository contains the firmware for a custom Sim-Racing Buttonbox, built on an Arduino Leonardo (ATmega32u4).
The device presents itself to the PC as a USB keyboard (HID) and maps physical buttons and rotary encoders to configurable keyboard actions for different racing games.

The firmware includes:

  • ➡️ 24 physical buttons (matrix-based)
  • 🔄 4 rotary encoders
  • 🖥️ 128×64 SSD1306 OLED display
  • 🎮 Multiple game profiles (e.g., ACC, F1 23)
  • 💾 Persistent profile storage via EEPROM
  • ⌨️ Keyboard emulation via USB (Keyboard.h)

🚀 Features

🎮 Multi-Game Profile Support

  • Each supported game has its own configuration header (e.g., acc.h, f1_23.h)
  • Every profile defines:
    • 24 button functions
    • 4 encoder functions
  • Switching games updates both the functional mappings and the OLED display.

🔄 Rotary Encoder Support

Each of the four rotary encoders can trigger different actions depending on direction:

  • Increase/Decrease in-game settings
  • Navigate menus
  • Operate MFD elements

⌨️ USB-HID Keyboard Output

Using the native USB capabilities of the Leonardo:

  • Sends standard keys (KEY_LEFT_ARROW, KEY_RIGHT_CTRL, …)
  • Supports key combinations
  • Supports press/release logic and toggles

🖥️ OLED Display Integration (SSD1306)

  • Shows startup information
  • Displays the currently selected game profile
  • Acts as visual feedback layer for interactions (optional extension)

💾 EEPROM Configuration

  • Remembers last selected profile across reboots

🧩 Modular Architecture

Adding a new game only requires:

  1. New <game>.h in game_configs/
  2. Adding it to the registration tables in ButtonFunctions.h
  3. Optional OLED naming update

🧪 Adding a New Game Profile

Create a file in src/game_configs/<your_game>.h

Define:

namespace YourGame { void Button_1(); ... void Button_24(); void Encoder_1(Direction dir); ... void Encoder_4(Direction dir); }

Register your functions in ButtonFunctions.h

GAMES[] = { "Assetto Corsa Competizione", "F1 23", "Your Game" };

Add your mapping to:

buttonNamespaces[]

encoderNamespaces[]

Done. No other code changes required.


Licence

CC BY-NC-ND 4.0 DEED Attribution-NonCommercial-NoDerivs 4.0 International

About

Firmware for the Next Generation Sim Racing Buttonbox

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors