diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f88854a --- /dev/null +++ b/Makefile @@ -0,0 +1,46 @@ +# Set QMK_HOME in your environment variables to adjust the path of the firmware +QMK_HOME ?= ${HOME}/qmk_firmware + +# Directories for QMK keyboard files (author, keyboard, revision) +QMK_KEYBOARD_AUTHOR_DIR := binarydiv +QMK_KEYBOARD_BASE_DIR := ${QMK_KEYBOARD_AUTHOR_DIR}/eepypad +QMK_KEYBOARD_REV_DIR := ${QMK_KEYBOARD_BASE_DIR}/v1 + +# Keymap to use when compiling QMK firmware +QMK_KEYMAP := default + + +# -- QMK commands + +# Prerequisite: Check if QMK is installed +.PHONY: _qmk-check-firmware-installed +_qmk-check-firmware-installed: + @test -d "${QMK_HOME}" || { \ + echo "QMK firmware not found! (QMK_HOME=${QMK_HOME})"; \ + echo "Please install QMK using 'qmk setup' first or set QMK_HOME in environment."; \ + exit 1; \ + } + +# Create symlink in QMK firmware directory to the keyboard files in qmk_keyboards/ +.PHONY: _qmk-create-symlink +_qmk-create-symlink: _qmk-check-firmware-installed ${QMK_HOME}/keyboards/${QMK_KEYBOARD_BASE_DIR} + +# Only create symlink if it doesn't exist already +${QMK_HOME}/keyboards/${QMK_KEYBOARD_BASE_DIR}: + mkdir -p "${QMK_HOME}/keyboards/${QMK_KEYBOARD_AUTHOR_DIR}" + ln -s "$$(realpath qmk_keyboards/${QMK_KEYBOARD_BASE_DIR})" "${QMK_HOME}/keyboards/${QMK_KEYBOARD_BASE_DIR}" + +# Compile QMK firmware +.PHONY: qmk-compile +qmk-compile: _qmk-create-symlink + qmk compile -kb ${QMK_KEYBOARD_REV_DIR} -km ${QMK_KEYMAP} + +# Compile and flash QMK firmware to keyboard +.PHONY: qmk-flash +qmk-flash: _qmk-create-symlink + qmk flash -kb ${QMK_KEYBOARD_REV_DIR} -km ${QMK_KEYMAP} + +# Run "qmk config" to set this keyboard as the default (to simplify running qmk commands manually) +.PHONY: qmk-activate +qmk-activate: _qmk-create-symlink + qmk config user.keyboard=${QMK_KEYBOARD_REV_DIR} user.keymap=${QMK_KEYMAP} diff --git a/README.md b/README.md index 9aad828..5b7e707 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Custom macro key pad with mechanical low-profile (Choc) switches. - `/layouts`: Keyboard layouts created with the [Keyboard Layout Editor](http://www.keyboard-layout-editor.com) - `/ergogen`: [Ergogen](https://docs.ergogen.xyz/) files to generate outlines, cases and PCBs +- `/qmk_keyboards`: [QMK](https://qmk.fm/) keyboard files to compile and flash the QMK firmware ## How-to @@ -75,6 +76,26 @@ Now you can generate the gerber, drill and map files. 4. Upload zip file to manufacturer and make sure everything is correct. 5. Add all generated files to version control (the zip should be on gitignore). +### Compile and flash QMK firmware + +To compile the QMK firmware, you first need the `qmk` CLI and a local copy of the QMK firmware. + +1. [Install](https://docs.qmk.fm/#/cli) the `qmk` CLI using your favorite package manager. +2. Run `qmk setup` to clone a local copy of the QMK firmware. (By default in `~/qmk_firmware`, feel free to adjust.) + +The firmware for this keyboard is compiled using the local copy of QMK and the keyboard definitions in `qmk_keyboards` +which are automatically symlinked to your installed QMK firmware directory (defaults to `~/qmk_firmware`, can be +overridden by setting `QMK_HOME` in your environment). A Makefile is provided to simplify compiling and flashing. + +To compile and flash the firmware, run `make qmk-flash`. + +After compiling the firmware, you will be asked to put your keyboard into bootloader mode. This can be done either by +pressing the reset button on the backside of the keyboard, or by using the `QK_BOOTLOADER` keycode which is mapped to +the key combination `0,4 (hold) + 0,0` (these are the matrix coordinates). + +You can also run `make qmk-activate` which will run `qmk config` to set `user.keyboard` and `user.keymap` to this +keyboard. This allows you to use the `qmk` CLI directly without specifying the keyboard and keymap everytime. + ## Used software - [Keyboard Layout Editor](http://www.keyboard-layout-editor.com) @@ -82,7 +103,9 @@ Now you can generate the gerber, drill and map files. - [KiCad](https://www.kicad.org/) - [FreeCAD](https://www.freecad.org/) - [UltiMaker Cura](https://ultimaker.com/software/ultimaker-cura/) +- [QMK](https://qmk.fm/) ## Resources - [FlatFootFox's Ergogen tutorial](https://flatfootfox.com/ergogen-introduction/) +- [QMK documentation](https://docs.qmk.fm/) diff --git a/qmk_keyboards/binarydiv/eepypad/v1/config.h b/qmk_keyboards/binarydiv/eepypad/v1/config.h new file mode 100644 index 0000000..428a0c4 --- /dev/null +++ b/qmk_keyboards/binarydiv/eepypad/v1/config.h @@ -0,0 +1,20 @@ +// Copyright 2024 binaryDiv (@binaryDiv) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT diff --git a/qmk_keyboards/binarydiv/eepypad/v1/info.json b/qmk_keyboards/binarydiv/eepypad/v1/info.json new file mode 100644 index 0000000..7652fbd --- /dev/null +++ b/qmk_keyboards/binarydiv/eepypad/v1/info.json @@ -0,0 +1,99 @@ +{ + "keyboard_name": "eepyPad v1.0", + "maintainer": "binaryDiv", + "manufacturer": "binaryDiv", + "url": "https://git.0xbd.space/binaryDiv/eepyPad/", + "processor": "atmega32u4", + "bootloader": "caterina", + "usb": { + "device_version": "1.0.0", + "vid": "0x1337", + "pid": "0xBD30" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true + }, + "diode_direction": "ROW2COL", + "matrix_pins": { + "cols": ["F7", "B1", "B3", "B2", "B6"], + "rows": ["B5", "B4", "E6", "D7", "C6"] + }, + "layouts": { + "LAYOUT_ortho_5x5": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 1], "x": 1, "y": 0}, + {"matrix": [0, 2], "x": 2, "y": 0}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [0, 4], "x": 4, "y": 0}, + {"matrix": [1, 0], "x": 0, "y": 1}, + {"matrix": [1, 1], "x": 1, "y": 1}, + {"matrix": [1, 2], "x": 2, "y": 1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [1, 4], "x": 4, "y": 1}, + {"matrix": [2, 0], "x": 0, "y": 2}, + {"matrix": [2, 1], "x": 1, "y": 2}, + {"matrix": [2, 2], "x": 2, "y": 2}, + {"matrix": [2, 3], "x": 3, "y": 2}, + {"matrix": [2, 4], "x": 4, "y": 2}, + {"matrix": [3, 0], "x": 0, "y": 3}, + {"matrix": [3, 1], "x": 1, "y": 3}, + {"matrix": [3, 2], "x": 2, "y": 3}, + {"matrix": [3, 3], "x": 3, "y": 3}, + {"matrix": [3, 4], "x": 4, "y": 3}, + {"matrix": [4, 0], "x": 0, "y": 4}, + {"matrix": [4, 1], "x": 1, "y": 4}, + {"matrix": [4, 2], "x": 2, "y": 4}, + {"matrix": [4, 3], "x": 3, "y": 4}, + {"matrix": [4, 4], "x": 4, "y": 4} + ] + } + }, + "rgb_matrix": { + "driver": "ws2812", + "default": { + "animation": "trans_pride", + "speed": 32 + }, + "center_point": [2, 2], + "animations": { + "cycle_pinwheel": true, + "trans_pride": true + }, + "layout": [ + {"matrix": [0, 3], "x": 3, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 2, "y": 0, "flags": 4}, + {"matrix": [0, 1], "x": 1, "y": 0, "flags": 4}, + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4}, + {"matrix": [1, 0], "x": 0, "y": 1, "flags": 4}, + {"matrix": [1, 1], "x": 1, "y": 1, "flags": 4}, + {"matrix": [1, 2], "x": 2, "y": 1, "flags": 4}, + {"matrix": [1, 3], "x": 3, "y": 1, "flags": 4}, + {"matrix": [1, 4], "x": 4, "y": 1, "flags": 4}, + {"matrix": [2, 4], "x": 4, "y": 2, "flags": 4}, + {"matrix": [2, 3], "x": 3, "y": 2, "flags": 4}, + {"matrix": [2, 2], "x": 2, "y": 2, "flags": 4}, + {"matrix": [2, 1], "x": 1, "y": 2, "flags": 4}, + {"matrix": [2, 0], "x": 0, "y": 2, "flags": 4}, + {"matrix": [3, 0], "x": 0, "y": 3, "flags": 4}, + {"matrix": [3, 1], "x": 1, "y": 3, "flags": 4}, + {"matrix": [3, 2], "x": 2, "y": 3, "flags": 4}, + {"matrix": [3, 3], "x": 3, "y": 3, "flags": 4}, + {"matrix": [3, 4], "x": 4, "y": 3, "flags": 4}, + {"matrix": [4, 4], "x": 4, "y": 4, "flags": 4}, + {"matrix": [4, 3], "x": 3, "y": 4, "flags": 4}, + {"matrix": [4, 2], "x": 2, "y": 4, "flags": 4}, + {"matrix": [4, 1], "x": 1, "y": 4, "flags": 4}, + {"matrix": [4, 0], "x": 0, "y": 4, "flags": 4} + ] + }, + "ws2812": { + "pin": "F6" + } +} diff --git a/qmk_keyboards/binarydiv/eepypad/v1/keymaps/default/keymap.c b/qmk_keyboards/binarydiv/eepypad/v1/keymaps/default/keymap.c new file mode 100644 index 0000000..30d95c5 --- /dev/null +++ b/qmk_keyboards/binarydiv/eepypad/v1/keymaps/default/keymap.c @@ -0,0 +1,37 @@ +// Copyright 2024 binaryDiv (@binaryDiv) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ┌────────┬────────┬────────┬────────┬────────┐ + * │ │ │ │ Kbd-Fn │ │ + * ├────────┼────────┼────────┼────────┼────────┤ + * │ Alt+6 │ Alt+7 │ Alt+8 │ Alt+9 │ Alt+0 │ + * ├────────┼────────┼────────┼────────┼────────┤ + * │ Alt+1 │ Alt+2 │ Alt+3 │ Alt+4 │ Alt+5 │ + * ├────────┼────────┼────────┼────────┼────────┤ + * │ Ctrl+6 │ Ctrl+7 │ Ctrl+8 │ Ctrl+9 │ Ctrl+0 │ + * ├────────┼────────┼────────┼────────┼────────┤ + * │ Ctrl+1 │ Ctrl+2 │ Ctrl+3 │ Ctrl+4 │ Ctrl+5 │ + * └────────┴────────┴────────┴────────┴────────┘ + */ + // Default layer for Factorio tertiary/quarternary quick bars + [0] = LAYOUT_ortho_5x5( + _______, _______, _______, MO(1), _______, + LALT(KC_6), LALT(KC_7), LALT(KC_8), LALT(KC_9), LALT(KC_0), + LALT(KC_1), LALT(KC_2), LALT(KC_3), LALT(KC_4), LALT(KC_5), + LCTL(KC_6), LCTL(KC_7), LCTL(KC_8), LCTL(KC_9), LCTL(KC_0), + LCTL(KC_1), LCTL(KC_2), LCTL(KC_3), LCTL(KC_4), LCTL(KC_5) + ), + + // Keyboard control layer for entering bootloader and controlling the RGB light (hold 0,4) + [1] = LAYOUT_ortho_5x5( + QK_BOOTLOADER, QK_REBOOT, _______, _______, QK_CLEAR_EEPROM, + RGB_TOG, RGB_MODE_REVERSE, RGB_MODE_FORWARD, _______, _______, + RGB_VAI, RGB_SAI, RGB_HUI, RGB_SPI, _______, + RGB_VAD, RGB_SAD, RGB_HUD, RGB_SPD, _______, + RGB_MODE_PLAIN, RGB_MODE_BREATHE, RGB_MODE_RAINBOW, RGB_MODE_SWIRL, _______ + ), +}; diff --git a/qmk_keyboards/binarydiv/eepypad/v1/rgb_matrix_user.inc b/qmk_keyboards/binarydiv/eepypad/v1/rgb_matrix_user.inc new file mode 100644 index 0000000..465abe8 --- /dev/null +++ b/qmk_keyboards/binarydiv/eepypad/v1/rgb_matrix_user.inc @@ -0,0 +1,32 @@ +RGB_MATRIX_EFFECT(trans_pride) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +bool trans_pride(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t total_rows = 5; + uint8_t total_cols = 5; + + uint8_t rgb_rows[][3] = { + {RGB_CYAN}, + {RGB_MAGENTA}, + {RGB_WHITE}, + {RGB_MAGENTA}, + {RGB_CYAN} + }; + + for (uint8_t row = 0; row < total_rows; row++) { + for (uint8_t col = 0; col < total_cols; col++) { + rgb_matrix_set_color( + g_led_config.matrix_co[row][col], + (uint8_t) scale8(rgb_rows[row][0], rgb_matrix_config.hsv.v), + (uint8_t) scale8(rgb_rows[row][1], rgb_matrix_config.hsv.v), + (uint8_t) scale8(rgb_rows[row][2], rgb_matrix_config.hsv.v) + ); + } + } + return rgb_matrix_check_finished_leds(led_max); +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/qmk_keyboards/binarydiv/eepypad/v1/rules.mk b/qmk_keyboards/binarydiv/eepypad/v1/rules.mk new file mode 100644 index 0000000..2f730fb --- /dev/null +++ b/qmk_keyboards/binarydiv/eepypad/v1/rules.mk @@ -0,0 +1,2 @@ +# Add custom RGB LED effects +RGB_MATRIX_CUSTOM_USER = yes