aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/feature_userspace.md54
1 files changed, 39 insertions, 15 deletions
diff --git a/docs/feature_userspace.md b/docs/feature_userspace.md
index 5a9fc287b..d82d43138 100644
--- a/docs/feature_userspace.md
+++ b/docs/feature_userspace.md
@@ -201,27 +201,51 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
201 201
202bool process_record_user(uint16_t keycode, keyrecord_t *record) { 202bool process_record_user(uint16_t keycode, keyrecord_t *record) {
203 switch (keycode) { 203 switch (keycode) {
204 case KC_MAKE: 204 case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
205 if (!record->event.pressed) { 205 if (!record->event.pressed) {
206 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP 206 uint8_t temp_mod = get_mods();
207#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) 207 uint8_t temp_osm = get_oneshot_mods();
208 ":dfu " 208 clear_mods(); clear_oneshot_mods();
209#elif defined(BOOTLOADER_HALFKAY) 209 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP);
210 ":teensy " 210 #ifndef FLASH_BOOTLOADER
211#elif defined(BOOTLOADER_CATERINA) 211 if ( (temp_mod | temp_osm) & MOD_MASK_SHIFT )
212 ":avrdude " 212 #endif
213#endif 213 { //
214 SS_TAP(X_ENTER)); 214 #if defined(__arm__) // only run for ARM boards
215 } 215 SEND_STRING(":dfu-util");
216 return false; 216 #elif defined(BOOTLOADER_DFU) // only run for DFU boards
217 break; 217 SEND_STRING(":dfu");
218 #elif defined(BOOTLOADER_HALFKAY) // only run for teensy boards
219 SEND_STRING(":teensy");
220 #elif defined(BOOTLOADER_CATERINA) // only run for Pro Micros
221 SEND_STRING(":avrdude");
222 #endif // bootloader options
223 }
224 if ( (temp_mod | temp_osm) & MOD_MASK_CTRL) {
225 SEND_STRING(" -j8 --output-sync");
226 }
227 SEND_STRING(SS_TAP(X_ENTER));
228 set_mods(temp_mod);
229 }
230 break;
231
218 } 232 }
219 return process_record_keymap(keycode, record); 233 return process_record_keymap(keycode, record);
220} 234}
221``` 235```
222 236
237For boards that may not have a shift button (such as on a macro pad), we need a way to always include the bootloader option. To do that, add the following to the `rules.mk` in your userspace folder:
238
239```make
240ifeq ($(strip $(FLASH_BOOTLOADER)), yes)
241 OPT_DEFS += -DFLASH_BOOTLOADER
242endif
243```
244
223This will add a new `KC_MAKE` keycode that can be used in any of your keymaps. And this keycode will output `make <keyboard>:<keymap>`, making frequent compiling easier. And this will work with any keyboard and any keymap as it will output the current boards info, so that you don't have to type this out every time. 245This will add a new `KC_MAKE` keycode that can be used in any of your keymaps. And this keycode will output `make <keyboard>:<keymap>`, making frequent compiling easier. And this will work with any keyboard and any keymap as it will output the current boards info, so that you don't have to type this out every time.
224 246
225Additionally, this should flash the newly compiled firmware automatically, using the correct utility, based on the bootloader settings (or default to just generating the HEX file). However, it should be noted that this may not work on all systems. AVRDUDE doesn't work on WSL, namely (and will dump the HEX in the ".build" folder instead). 247Also, holding `shift` will add the appropriate flashing command (`:dfu`, `:teensy`, `:avrdude`, `:dfu-util`) for a majority of keyboards. Holding `control` will add some commands that will speed up compiling time by processing multiple files at once.
226 248
249And for the boards that lack a shift key, or that you want to always attempt the flashing part, you can add `FLASH_BOOTLOADER = yes` to the `rules.mk` of that keymap.
227 250
251?> This should flash the newly compiled firmware automatically, using the correct utility, based on the bootloader settings (or default to just generating the HEX file). However, it should be noted that this may not work on all systems. AVRDUDE doesn't work on WSL, namely. And this doesn't support BootloadHID or mdloader.