]> git.donarmstrong.com Git - qmk_firmware.git/blob - docs/config_options.md
RETRO_TAPPING (#1922)
[qmk_firmware.git] / docs / config_options.md
1 # Configuring QMK
2
3 QMK is nearly infinitely configurable. Wherever possible we err on the side of allowing users to customize their keyboard, even at the expense of code size. That level of flexibility makes for a daunting configuration experience, however.
4
5 There are two main types of configuration files in QMK- `config.h` and `rules.mk`. These files exist at various levels in QMK and all files of the same type are combined to build the final configuration. The levels, from lowest priority to highest priority, are:
6
7 * QMK Default
8 * Keyboard
9 * Folders (Up to 5 levels deep)
10 * Keymap
11
12 ## QMK Default
13
14 Every available setting in QMK has a default. If that setting is not set at the Keyboard, Folder, or Keymap level this is the setting that will be used.
15
16 ## Keyboard
17
18 This level contains config options that should apply to the whole keyboard. Some settings won't change in revisions, or most keymaps. Other settings are merely defaults for this keyboard and can be overridden by folders and/or keymaps.
19
20 ## Folders
21
22 Some keyboards have folders and sub-folders to allow for different hardware configurations. Most keyboards only go 1 folder deep, but QMK supports structures up to 5 folders deep. Each folder can have its own `config.h` and `rules.mk` files that are incorporated into the final configuration.
23
24 ## Keymap
25
26 This level contains all of the options for that particular keymap. If you wish to override a previous declaration, you can use `#undef <variable>` to undefine it, where you can then redefine it without an error.
27
28 # The `config.h` file
29
30 This is a C header file that is one of the first things included, and will persist over the whole project (if included). Lots of variables can be set here and accessed elsewhere.
31
32 ## `config.h` Options
33
34 ### Hardware Options
35 * `#define VENDOR_ID 0x1234`
36   * defines your VID, and for most DIY projects, can be whatever you want
37 * `#define PRODUCT_ID 0x5678`
38   * defines your PID, and for most DIY projects, can be whatever you want
39 * `#define DEVICE_VER 0`
40   * defines the device version (often used for revisions)
41 * `#define MANUFACTURER Me`
42   * generally who/whatever brand produced the board
43 * `#define PRODUCT Board`
44   * the name of the keyboard
45 * `#define DESCRIPTION a keyboard`
46   * a short description of what the keyboard is
47 * `#define MATRIX_ROWS 5`
48   * the number of rows in your keyboard's matrix
49 * `#define MATRIX_COLS 15`
50   * the number of columns in your keyboard's matrix
51 * `#define MATRIX_ROW_PINS { D0, D5, B5, B6 }`
52   * pins of the rows, from top to bottom
53 * `#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }`
54   * pins of the columns, from left to right
55 * `#define UNUSED_PINS { D1, D2, D3, B1, B2, B3 }`
56   * pins unused by the keyboard for reference
57 * `#define MATRIX_HAS_GHOST`
58   * define is matrix has ghost (unlikely)
59 * `#define DIODE_DIRECTION COL2ROW`
60   * COL2ROW or ROW2COL - how your matrix is configured. COL2ROW means the black mark on your diode is facing to the rows, and between the switch and the rows.
61 * `#define AUDIO_VOICES`
62   * turns on the alternate audio voices (to cycle through)
63 * `#define C6_AUDIO`
64   * enables audio on pin C6
65 * `#define B5_AUDIO`
66   * enables audio on pin B5 (duophony is enable if both are enabled)
67 * `#define BACKLIGHT_PIN B7`
68   * pin of the backlight - B5, B6, B7 use PWM, others use softPWM
69 * `#define BACKLIGHT_LEVELS 3`
70   * number of levels your backlight will have (not including off)
71 * `#define DEBOUNCING_DELAY 5`
72   * the delay when reading the value of the pin (5 is default)
73 * `#define LOCKING_SUPPORT_ENABLE`
74   * mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
75 * `#define LOCKING_RESYNC_ENABLE`
76   * tries to keep switch state consistent with keyboard LED state
77 * `#define IS_COMMAND() ( keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) )`
78   * key combination that allows the use of magic commands (useful for debugging)
79
80 ### Features That Can Be Disabled
81
82 If you define these options you will disable the associated feature, which can save on code size.
83
84 * `#define NO_DEBUG`
85   * disable debuging
86 * `#define NO_PRINT`
87   * disable printing/debugging using hid_listen
88 * `#define NO_ACTION_LAYER`
89   * disable layers
90 * `#define NO_ACTION_TAPPING`
91   * disable tap dance and other tapping features
92 * `#define NO_ACTION_ONESHOT`
93   * disable one-shot modifiers
94 * `#define NO_ACTION_MACRO`
95   * disable all macro handling
96 * `#define NO_ACTION_FUNCTION`
97   * disable the action function (deprecated)
98
99 ### Features That Can Be Enabled
100
101 If you define these options you will enable the associated feature, which may increase your code size.
102
103 * `#define FORCE_NKRO`
104   * NKRO by default requires to be turned on, this forces it on during keyboard startup regardless of eeprom setting. NKRO can still be turned off but will be turned on again if the keyboard reboots.
105 * `#define PREVENT_STUCK_MODIFIERS`
106   * when switching layers, this will release all mods
107
108 ### Behaviors That Can Be Configured
109
110 * `#define TAPPING_TERM 200`
111   * how long before a tap becomes a hold
112 * `#define RETRO_TAPPING`
113   * tap anyway, even after TAPPING_TERM, if there was no other key interruption between press and release
114 * `#define TAPPING_TOGGLE 2`
115   * how many taps before triggering the toggle
116 * `#define PERMISSIVE_HOLD`
117   * makes tap and hold keys work better for fast typers who don't want tapping term set above 500
118 * `#define LEADER_TIMEOUT 300`
119   * how long before the leader key times out
120 * `#define ONESHOT_TIMEOUT 300`
121   * how long before oneshot times out
122 * `#define ONESHOT_TAP_TOGGLE 2`
123   * how many taps before oneshot toggle is triggered
124 * `#define IGNORE_MOD_TAP_INTERRUPT`
125   * makes it possible to do rolling combos (zx) with keys that convert to other keys on hold
126
127 ### RGB Light Configuration
128
129 * `#define RGB_DI_PIN D7`
130   * pin the DI on the ws2812 is hooked-up to
131 * `#define RGBLIGHT_ANIMATIONS`
132   * run RGB animations
133 * `#define RGBLED_NUM 15`
134   * number of LEDs
135 * `#define RGBLIGHT_HUE_STEP 12`
136   * units to step when in/decreasing hue
137 * `#define RGBLIGHT_SAT_STEP 25`
138   * units to step when in/decresing saturation
139 * `#define RGBLIGHT_VAL_STEP 12`
140   * units to step when in/decreasing value (brightness)
141 * `#define RGBW_BB_TWI`
142   * bit-bangs twi to EZ RGBW LEDs (only required for Ergodox EZ)
143
144 ### Mouse Key Options
145
146 * `#define MOUSEKEY_INTERVAL 20`
147 * `#define MOUSEKEY_DELAY 0`
148 * `#define MOUSEKEY_TIME_TO_MAX 60`
149 * `#define MOUSEKEY_MAX_SPEED 7`
150 * `#define MOUSEKEY_WHEEL_DELAY 0`
151
152 # The `rules.mk` File
153
154 This is a [make](https://www.gnu.org/software/make/manual/make.html) file that is included by the top-level `Makefile`. It is used to set some information about the MCU that we will be compiling for as well as enabling and disabling certain features.
155
156 ## `rules.mk` options
157
158 ### Build Options
159
160 * `DEFAULT_FOLDER`
161   * Used to specify a default folder when a keyboard has more than one sub-folder.
162 * `SRC`
163   * Used to add files to the compilation/linking list.
164 * `LAYOUTS`
165   * A list of [layouts](feature_layouts.md) this keyboard supports.
166
167 ### AVR MCU Options
168 * `MCU = atmega32u4`
169 * `F_CPU = 16000000`
170 * `ARCH = AVR8`
171 * `F_USB = $(F_CPU)`
172 * `OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT`
173 * `OPT_DEFS += -DBOOTLOADER_SIZE=4096`
174
175 ### Feature Options
176
177 Use these to enable or disable building certain features. The more you have enabled the bigger your firmware will be, and you run the risk of building a firmware too large for your MCU.
178
179 * `BOOTMAGIC_ENABLE`
180   * Virtual DIP switch configuration(+1000)
181 * `MOUSEKEY_ENABLE`
182   * Mouse keys(+4700)
183 * `EXTRAKEY_ENABLE`
184   * Audio control and System control(+450)
185 * `CONSOLE_ENABLE`
186   * Console for debug(+400)
187 * `COMMAND_ENABLE`
188   * Commands for debug and configuration
189 * `NKRO_ENABLE`
190   * USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
191 * `AUDIO_ENABLE`
192   * Enable the audio subsystem.
193 * `RGBLIGHT_ENABLE`
194   * Enable keyboard underlight functionality
195 * `MIDI_ENABLE`
196   * MIDI controls
197 * `UNICODE_ENABLE`
198   * Unicode
199 * `BLUETOOTH_ENABLE`
200   * Enable Bluetooth with the Adafruit EZ-Key HID