This repository contains libraries for building a Hall-effect keyboard firmware.
- Analog Input: Customizable actuation point for each key and many other features.
- Rapid Trigger: Register a key press or release based on the change in key position and the direction of that change
- Continuous Rapid Trigger: Deactivate Rapid Trigger only when the key is fully released.
- Null Bind (SOCD + Rappy Snappy): Monitor 2 keys and select which one is active based on the chosen behavior.
- Dynamic Keystroke: Assign up to 4 keycodes to a single key. Each keycode can be assigned up to 4 actions for 4 different parts of the keystroke.
- Tap-Hold: Send a different keycode depending on whether the key is tapped or held.
- Toggle: Toggle between key press and key release. Hold the key for normal behavior.
- N-Key Rollover: Support for N-Key Rollover and automatically fall back to 6-Key Rollover in BIOS.
- Automatic Calibration: Automatically calibrate the analog input without requiring user intervention.
- EEPROM Emulation: No external EEPROM required. Emulate EEPROM using the internal flash memory.
- Web Configurator: Configure the firmware using hmkconf without needing to recompile the firmware.
- Tick Rate: Customizable tick rate for Tap-Hold and Dynamic Keystroke.
- 8kHz Polling Rate: Support for 8kHz polling rate on some microcontrollers (e.g., AT32F405xx).
- Gamepad: Support for XInput gamepad mode, allowing the keyboard to be used as a game controller.
- RGB Lighting: The firmware does not support RGB lighting.
-
Clone the repository:
git clone https://github.com/peppapighs/libhmk.git
-
Open the project in PlatformIO, such as through Visual Studio Code.
-
Run
python setup.py -k <YOUR_KEYBOARD>to generate theplatformio.inifile. -
Wait for PlatformIO to finish initializing the environment.
-
Build the firmware using either
pio runin the PlatformIO Core CLI or through the PlatformIO IDE's "Build" option. The firmware binaries will be generated in the.pio/build/<YOUR_KEYBOARD>/directory with the following files:firmware.bin: The binary firmware filefirmware.elf: The ELF firmware file
-
Flash the firmware to your keyboard using your preferred method (e.g., DFU, ISP). If your keyboard has a DFU bootloader, you can set
upload_protocol = dfuinplatformio.iniand use the commandpio run --target uploador the PlatformIO IDE's "Upload" option while the keyboard is in DFU mode.
The development branch is dev, which contains the latest features and bug fixes. The corresponding dev branch of hmkconf deployed at https://hmkdev.prasertsuk.com is required to configure the dev branch of the firmware. To contribute, please create a pull request against the dev branch.
To develop a new keyboard, create a new directory under keyboards/ with your keyboard's name. This directory should include the following files:
keyboard.json: A JSON file containing metadata about your keyboard, used for both firmware compilation and the web configurator. Refer toscripts/schema/keyboard.schema.jsonfor the schema.config.h(Optional): Additional configuration header for your keyboard to define custom configurations beyond what's specified inkeyboard.json.
You can use an existing keyboard implementation as a reference. If your keyboard hardware isn't currently supported by the firmware, you'll need to implement the necessary drivers and features. See the Porting section for more details.
In addition to the debugging options provided by PlatformIO, you can use the log_printf function to log messages to the console. The function is available when you run the setup.py with the flag --log to enable logging. The function uses eyalroz/printf as a backend for text formatting.
The log messages will be sent to the HID interface, which can be viewed in hid_listen, QMK CLI, or QMK Toolbox (buggy, not recommended).
Hardware drivers follow this directory structure:
hardware/: Contains hardware-specific header files. Each subdirectory should also contain aninfo.jsonfile that describes the PlatformIO configuration, TinyUSB configuration, and additional metadata. Refer toscripts/schema/driver.schema.jsonfor the schema.include/hardware/: Contains hardware driver interface headers that declare functions to be implementedsrc/hardware/: Contains hardware driver implementations of the functions declared in the header fileslinker/: Contains linker scripts for supported microcontrollers
You can refer to existing hardware drivers as examples when implementing support for new hardware.
- hathach/tinyusb for the USB stack.
- qmk/qmk_firmware for inspiration, including EEPROM emulation and matrix scanning.
- @riskable for pioneering custom Hall-effect keyboard firmware development.
- @heiso for his macrolev and his helpfulness throughout the development process.
- Wooting for pioneering Hall-effect gaming keyboards and introducing many advanced features based on analog input.
- GEONWORKS for the Venom 60HE PCB and inspiring the web configurator.
- @eyalroz for his work on the printf library and its integration into the firmware.