Update to Drashna Keymaps and Userspace (#2650)
* Change global config.h settings * Make Shift LED brighter * Compatibility Tweaks * Update ASCII art and layer comments * Add comments about MOD layer * Change ASCII art for reset, since it was out of date * Use Overwatch theme for Workman layer * Fix RGB define comments * Make sure RGB set list matches * Stop all notes for custom Faux Click * Switch to OSM for everything, and remove RGB Sleep * Never use KEYMAP now * Only enable RGB Sleep on Non-Ergodox boards * Cleanup do to new rgblight_list.h file * Add redirect message for RGB codes * Update userspace documentation * Cleanup of Userspace Add unicode support, and cleaned up comments for ifdef statements * Remove unneeded slashes * Unicode handling * Force NKRO
This commit is contained in:
		
							parent
							
								
									adae37f19f
								
							
						
					
					
						commit
						61a2169ff9
					
				
					 8 changed files with 152 additions and 148 deletions
				
			
		| 
						 | 
				
			
			@ -3,17 +3,19 @@
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
#ifdef AUDIO_ENABLE
 | 
			
		||||
#define STARTUP_SONG SONG(IMPERIAL_MARCH)
 | 
			
		||||
#define STARTUP_SONG SONG(E1M1_DOOM)
 | 
			
		||||
#define GOODBYE_SONG  SONG(SONIC_RING)
 | 
			
		||||
#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
 | 
			
		||||
                                  SONG(COLEMAK_SOUND), \
 | 
			
		||||
                                  SONG(DVORAK_SOUND), \
 | 
			
		||||
                                  SONG(PLOVER_SOUND) \
 | 
			
		||||
                                  SONG(OVERWATCH_THEME) \
 | 
			
		||||
                                }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef RGBLIGHT_ENABLE
 | 
			
		||||
#define RGBLIGHT_SLEEP
 | 
			
		||||
  #ifndef KEYBOARD_ergodox_ez
 | 
			
		||||
    #define RGBLIGHT_SLEEP
 | 
			
		||||
  #endif
 | 
			
		||||
#endif // RGBLIGHT_ENABLE
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -40,6 +42,8 @@
 | 
			
		|||
#undef PERMISSIVE_HOLD
 | 
			
		||||
#undef PREVENT_STUCK_MODIFIERS
 | 
			
		||||
 | 
			
		||||
#define FORCE_NKRO
 | 
			
		||||
 | 
			
		||||
#ifndef TAPPING_TOGGLE
 | 
			
		||||
#define TAPPING_TOGGLE  1
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +51,7 @@
 | 
			
		|||
#ifdef TAPPING_TERM
 | 
			
		||||
#undef TAPPING_TERM
 | 
			
		||||
#endif
 | 
			
		||||
#define TAPPING_TERM 150
 | 
			
		||||
#define TAPPING_TERM 160
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Disable action_get_macro and fn_actions, since we don't use these
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#include "drashna.h"
 | 
			
		||||
#include "version.h"
 | 
			
		||||
 | 
			
		||||
#if (__has_include("secrets.h"))
 | 
			
		||||
#if (__has_include("secrets.h") && !defined(NO_SECRETS))
 | 
			
		||||
#include "secrets.h"
 | 
			
		||||
#else
 | 
			
		||||
// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware
 | 
			
		||||
| 
						 | 
				
			
			@ -36,10 +36,10 @@ PROGMEM const char secret[][64] = {
 | 
			
		|||
#ifdef FAUXCLICKY_ENABLE
 | 
			
		||||
float fauxclicky_pressed_note[2]  = MUSICAL_NOTE(_A6, 2);  // (_D4, 0.25);
 | 
			
		||||
float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125);
 | 
			
		||||
#else
 | 
			
		||||
#else // FAUXCLICKY_ENABLE
 | 
			
		||||
float fauxclicky_pressed[][2]             = SONG(S__NOTE(_A6)); // change to your tastes
 | 
			
		||||
float fauxclicky_released[][2]             = SONG(S__NOTE(_A6)); // change to your tastes
 | 
			
		||||
#endif
 | 
			
		||||
#endif // FAUXCLICKY_ENABLE
 | 
			
		||||
 | 
			
		||||
bool faux_click_enabled = false;
 | 
			
		||||
bool is_overwatch = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +127,7 @@ void run_diablo_macro_check(void) {
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
#endif // TAP_DANCE_ENABLE
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Add reconfigurable functions here, for keymap customization
 | 
			
		||||
| 
						 | 
				
			
			@ -178,10 +178,15 @@ void matrix_init_user(void) {
 | 
			
		|||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    rgblight_set_red;
 | 
			
		||||
    rgblight_setrgb_red();
 | 
			
		||||
    rgblight_mode(5);
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
#endif // RGBLIGHT_ENABLE
 | 
			
		||||
 | 
			
		||||
#if ( defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) )
 | 
			
		||||
	set_unicode_input_mode(UC_WINC);
 | 
			
		||||
#endif //UNICODE_ENABLE
 | 
			
		||||
 | 
			
		||||
  matrix_init_keymap();
 | 
			
		||||
}
 | 
			
		||||
// No global matrix scan code, so just run keymap's matrix
 | 
			
		||||
| 
						 | 
				
			
			@ -189,7 +194,7 @@ void matrix_init_user(void) {
 | 
			
		|||
void matrix_scan_user(void) {
 | 
			
		||||
#ifdef TAP_DANCE_ENABLE  // Run Diablo 3 macro checking code.
 | 
			
		||||
  run_diablo_macro_check();
 | 
			
		||||
#endif
 | 
			
		||||
#endif // TAP_DANCE_ENABLE
 | 
			
		||||
  matrix_scan_keymap();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -209,29 +214,24 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
 | 
			
		|||
  return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Sent the default layer
 | 
			
		||||
void persistent_default_layer_set(uint16_t default_layer) {
 | 
			
		||||
  eeconfig_update_default_layer(default_layer);
 | 
			
		||||
  default_layer_set(default_layer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Defines actions tor my global custom keycodes. Defined in drashna.h file
 | 
			
		||||
// Then runs the _keymap's record handier if not processed here
 | 
			
		||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
 | 
			
		||||
// If console is enabled, it will print the matrix position and status of each key pressed
 | 
			
		||||
  // If console is enabled, it will print the matrix position and status of each key pressed
 | 
			
		||||
#ifdef CONSOLE_ENABLE
 | 
			
		||||
  xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed);
 | 
			
		||||
#endif //CONSOLE_ENABLE
 | 
			
		||||
 | 
			
		||||
// Run custom faux click code, but only if faux clicky is enabled
 | 
			
		||||
  // Run custom faux click code, but only if faux clicky is enabled
 | 
			
		||||
#ifdef AUDIO_ENABLE
 | 
			
		||||
  if ( (faux_click_enabled && keycode != KC_FXCL) || (!faux_click_enabled && keycode == KC_FXCL) ) {
 | 
			
		||||
    if (record->event.pressed) {
 | 
			
		||||
      stop_all_notes();
 | 
			
		||||
      PLAY_SONG(fauxclicky_pressed);
 | 
			
		||||
    } else {
 | 
			
		||||
      stop_note(NOTE_A6);
 | 
			
		||||
      stop_all_notes();
 | 
			
		||||
      PLAY_SONG(fauxclicky_released);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -307,7 +307,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
                   ":teensy"
 | 
			
		||||
#elif defined(BOOTLOADER_CATERINA)
 | 
			
		||||
                   ":avrdude"
 | 
			
		||||
#endif
 | 
			
		||||
#endif // bootloader options
 | 
			
		||||
                   SS_TAP(X_ENTER));
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
| 
						 | 
				
			
			@ -320,7 +320,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
      rgblight_enable();
 | 
			
		||||
      rgblight_mode(1);
 | 
			
		||||
      rgblight_setrgb_red();
 | 
			
		||||
#endif
 | 
			
		||||
#endif // RGBLIGHT_ENABLE
 | 
			
		||||
      reset_keyboard();
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
| 
						 | 
				
			
			@ -498,7 +498,7 @@ uint32_t layer_state_set_user(uint32_t state) {
 | 
			
		|||
      break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
#endif // RGBLIGHT_ENABLE
 | 
			
		||||
  return layer_state_set_keymap (state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,47 +46,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#define MODS_ALT_MASK  (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
 | 
			
		||||
#define MODS_GUI_MASK  (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
 | 
			
		||||
 | 
			
		||||
#ifndef RGBLIGHT_ANIMATIONS // add "EXTRA_FLADS=-DDRASHNA_SETRGB" to enable this ... but don't
 | 
			
		||||
#define rgblight_set_white       rgblight_setrgb (0xFF, 0xFF, 0xFF);
 | 
			
		||||
#define rgblight_set_red         rgblight_setrgb (0xFF, 0x00, 0x00);
 | 
			
		||||
#define rgblight_set_coral       rgblight_setrgb (0xFF, 0x7C, 0x4D);
 | 
			
		||||
#define rgblight_set_orange      rgblight_setrgb (0xFF, 0x80, 0x00);
 | 
			
		||||
#define rgblight_set_goldenrod   rgblight_setrgb (0xD9, 0xA5, 0x21);
 | 
			
		||||
#define rgblight_set_gold        rgblight_setrgb (0xFF, 0xD9, 0x00);
 | 
			
		||||
#define rgblight_set_yellow      rgblight_setrgb (0xFF, 0xFF, 0x00);
 | 
			
		||||
#define rgblight_set_chartreuse  rgblight_setrgb (0x80, 0xFF, 0x00);
 | 
			
		||||
#define rgblight_set_green       rgblight_setrgb (0x00, 0xFF, 0x00);
 | 
			
		||||
#define rgblight_set_springgreen rgblight_setrgb (0x00, 0xFF, 0x80);
 | 
			
		||||
#define rgblight_set_turquoise   rgblight_setrgb (0x47, 0x6E, 0x6A);
 | 
			
		||||
#define rgblight_set_teal        rgblight_setrgb (0x00, 0x80, 0x80);
 | 
			
		||||
#define rgblight_set_cyan        rgblight_setrgb (0x00, 0xFF, 0xFF);
 | 
			
		||||
#define rgblight_set_azure       rgblight_setrgb (0x99, 0xf5, 0xFF);
 | 
			
		||||
#define rgblight_set_blue        rgblight_setrgb (0x00, 0x00, 0xFF);
 | 
			
		||||
#define rgblight_set_purple      rgblight_setrgb (0x7A, 0x00, 0xFF);
 | 
			
		||||
#define rgblight_set_magenta     rgblight_setrgb (0xFF, 0x00, 0xFF);
 | 
			
		||||
#define rgblight_set_pink        rgblight_setrgb (0xFF, 0x80, 0xBF);
 | 
			
		||||
#else
 | 
			
		||||
#define rgblight_set_white       rgblight_sethsv (0,  0x00, 255);
 | 
			
		||||
#define rgblight_set_red         rgblight_sethsv (0,  255, 255);
 | 
			
		||||
#define rgblight_set_coral       rgblight_sethsv (16, 176, 255);
 | 
			
		||||
#define rgblight_set_orange      rgblight_sethsv (39,  255, 255);
 | 
			
		||||
#define rgblight_set_goldenrod   rgblight_sethsv (43,  218, 218);
 | 
			
		||||
#define rgblight_set_gold        rgblight_sethsv (51,  255, 255);
 | 
			
		||||
#define rgblight_set_yellow      rgblight_sethsv (60,  255, 255);
 | 
			
		||||
#define rgblight_set_chartreuse  rgblight_sethsv (90, 255, 255);
 | 
			
		||||
#define rgblight_set_green       rgblight_sethsv (120,  255, 255);
 | 
			
		||||
#define rgblight_set_springgreen rgblight_sethsv (150,  255, 255);
 | 
			
		||||
#define rgblight_set_turquoise   rgblight_sethsv (174,  90, 112);
 | 
			
		||||
#define rgblight_set_teal        rgblight_sethsv (180,  255, 128);
 | 
			
		||||
#define rgblight_set_cyan        rgblight_sethsv (180,  255, 255);
 | 
			
		||||
#define rgblight_set_azure       rgblight_sethsv (186,  102, 255);
 | 
			
		||||
#define rgblight_set_blue        rgblight_sethsv (240,  255, 255);
 | 
			
		||||
#define rgblight_set_purple      rgblight_sethsv (270, 255, 255);
 | 
			
		||||
#define rgblight_set_magenta     rgblight_sethsv (300, 255, 255);
 | 
			
		||||
#define rgblight_set_pink        rgblight_sethsv (330, 128, 255);
 | 
			
		||||
 | 
			
		||||
//#define rgblight_set_        rgblight_sethsv (0, 255, 255);
 | 
			
		||||
#endif // DRASHNA_SETRGB
 | 
			
		||||
// RGB color codes are no longer located here anymore.  Instead, you will want to
 | 
			
		||||
// head to https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h
 | 
			
		||||
 | 
			
		||||
extern bool is_overwatch;
 | 
			
		||||
extern bool rgb_layer_change;
 | 
			
		||||
| 
						 | 
				
			
			@ -132,6 +93,12 @@ enum userspace_custom_keycodes {
 | 
			
		|||
#define KC_SEC4 KC_SECRET_4
 | 
			
		||||
#define KC_SEC5 KC_SECRET_5
 | 
			
		||||
 | 
			
		||||
#define QWERTY KC_QWERTY
 | 
			
		||||
#define DVORAK KC_DVORAK
 | 
			
		||||
#define COLEMAK KC_COLEMAK
 | 
			
		||||
#define WORKMAN KC_WORKMAN
 | 
			
		||||
#define KC_RST KC_RESET
 | 
			
		||||
 | 
			
		||||
#ifdef TAP_DANCE_ENABLE
 | 
			
		||||
enum {
 | 
			
		||||
  TD_D3_1 = 0,
 | 
			
		||||
| 
						 | 
				
			
			@ -185,6 +152,7 @@ enum {
 | 
			
		|||
#define LAYOUT_ergodox_wrapper(...)   LAYOUT_ergodox(__VA_ARGS__)
 | 
			
		||||
#define LAYOUT_ergodox_pretty_wrapper(...)   LAYOUT_ergodox_pretty(__VA_ARGS__)
 | 
			
		||||
#define KEYMAP_wrapper(...)           LAYOUT(__VA_ARGS__)
 | 
			
		||||
#define LAYOUT_wrapper(...)           LAYOUT(__VA_ARGS__)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Blocks for each of the four major keyboard layouts
 | 
			
		||||
| 
						 | 
				
			
			@ -255,7 +223,7 @@ enum {
 | 
			
		|||
// this allows us to quickly modify the bottom row for all of the layouts
 | 
			
		||||
// so we don't have to alter it 4 times and hope that we haven't missed
 | 
			
		||||
// anything
 | 
			
		||||
#define ___________ERGODOX_BOTTOM_LEFT_____________       KC_MEH,  KC_LGUI, KC_LBRC, KC_RBRC
 | 
			
		||||
#define ___________ERGODOX_BOTTOM_LEFT_____________       OSM(MOD_MEH), OSM(MOD_LGUI), KC_LBRC, KC_RBRC
 | 
			
		||||
#define ___________ERGODOX_BOTTOM_RIGHT____________       KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@ The reason for using seperate files here is that the `drashna.h` file doesn't ge
 | 
			
		|||
 | 
			
		||||
However, the `rules.mk` file is included when building the firmware.  So we can hijack that process to "manually" add a `config.h`. To do so, you would need to add the following to the `rules.mk` in your userspace:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
```c
 | 
			
		||||
ifneq ("$(wildcard users/$(KEYMAP)/config.h)","")
 | 
			
		||||
    CONFIG_H += users/$(KEYMAP)/config.h
 | 
			
		||||
endif
 | 
			
		||||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ You can replace `$(KEYMAP)` with your name, but it's not necessary. This checks
 | 
			
		|||
 | 
			
		||||
As for the `config.h` file, you want to make sure that it has an "ifdef" in it to make sure it's only used once.  So you want something like this: 
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
```c
 | 
			
		||||
#ifndef USERSPACE_CONFIG_H
 | 
			
		||||
#define USERSPACE_CONFIG_H
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -122,7 +122,7 @@ If you would *also* like to take advantage of this feature, you'll first want to
 | 
			
		|||
Then you can create this file and add your macro strings to it:
 | 
			
		||||
 | 
			
		||||
###### secrets.h
 | 
			
		||||
```
 | 
			
		||||
```c
 | 
			
		||||
PROGMEM const char secret[][64] = {
 | 
			
		||||
  "secret1",
 | 
			
		||||
  "secret2",
 | 
			
		||||
| 
						 | 
				
			
			@ -132,11 +132,29 @@ PROGMEM const char secret[][64] = {
 | 
			
		|||
};
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Replacing the strings with the codes that you need. 
 | 
			
		||||
Replacing the strings with the codes that you need.
 | 
			
		||||
 | 
			
		||||
In the `<name>.c` file, you will want to add this to the top: 
 | 
			
		||||
 | 
			
		||||
These are called in the `process_record_user` function, using this block:
 | 
			
		||||
```c
 | 
			
		||||
 | 
			
		||||
#if (__has_include("secrets.h") && !defined(NO_SECRETS))
 | 
			
		||||
#include "secrets.h"
 | 
			
		||||
#else
 | 
			
		||||
// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware
 | 
			
		||||
// And I'm not familiar enough to know which is better or why...
 | 
			
		||||
PROGMEM const char secret[][64] = {
 | 
			
		||||
  "test1",
 | 
			
		||||
  "test2",
 | 
			
		||||
  "test3",
 | 
			
		||||
  "test4",
 | 
			
		||||
  "test5"
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
And then, in the `process_record_user` function, you'll want to add this block:
 | 
			
		||||
```c
 | 
			
		||||
  case KC_SECRET_1 ... KC_SECRET_5:
 | 
			
		||||
    if (!record->event.pressed) {
 | 
			
		||||
      send_string_P(secret[keycode - KC_SECRET_1]);
 | 
			
		||||
| 
						 | 
				
			
			@ -145,4 +163,13 @@ These are called in the `process_record_user` function, using this block:
 | 
			
		|||
    break;
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
And this requires `KC_SECRET_1` through `KC_SECRET_5` to be defined, as well. 
 | 
			
		||||
And this requires `KC_SECRET_1` through `KC_SECRET_5` to be defined in your `<name>.h` file fo the new macros, as well.
 | 
			
		||||
 | 
			
		||||
Additionally, if you want to make sure that you can disable the function without messing with the file, you need to add this to your `/users/<name>/rules.mk`, so that it catches the flag:
 | 
			
		||||
```c
 | 
			
		||||
ifeq ($(strip $(NO_SECRETS)), yes)
 | 
			
		||||
    OPT_DEFS += -DNO_SECRETS
 | 
			
		||||
endif
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Then, if you run `make keyboard:name NO_SECRETS=yes`, it will default to the test strings in your `<name>.c` file, rather than reading from your file. 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,3 +5,7 @@ EXTRAFLAGS        += -flto
 | 
			
		|||
ifneq ("$(wildcard users/$(KEYMAP)/config.h)","")
 | 
			
		||||
    CONFIG_H += users/$(KEYMAP)/config.h
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(NO_SECRETS)), yes)
 | 
			
		||||
    OPT_DEFS += -DNO_SECRETS
 | 
			
		||||
endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue