From 61a2169ff9dea52136139ec156995efdc7929851 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sat, 31 Mar 2018 19:38:06 -0700 Subject: 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 --- users/drashna/readme.md | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'users/drashna/readme.md') diff --git a/users/drashna/readme.md b/users/drashna/readme.md index 2229a3fe09..e3e5d399d8 100644 --- a/users/drashna/readme.md +++ b/users/drashna/readme.md @@ -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 `.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 `.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//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 `.c` file, rather than reading from your file. -- cgit v1.2.3