diff options
Diffstat (limited to 'users')
36 files changed, 2181 insertions, 320 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h index a0f92d8f38..6fafff8604 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -7,7 +7,7 @@ #define USB_POLLING_INTERVAL_MS 1 #ifdef AUDIO_ENABLE -# if __GNUC__ > 7 +# if __GNUC__ > 5 # if __has_include("drashna_song_list.h") # include "drashna_song_list.h" # endif // if file exists @@ -29,11 +29,15 @@ #endif // !AUDIO_ENABLE #ifdef RGBLIGHT_ENABLE -# define RGBLIGHT_SLEEP # undef RGBLIGHT_ANIMATIONS -# define RGBLIGHT_EFFECT_BREATHING -# define RGBLIGHT_EFFECT_SNAKE -# define RGBLIGHT_EFFECT_KNIGHT +# if defined(__AVR__) && !defined(__AVR_AT90USB1286__) +# define RGBLIGHT_SLEEP +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_SNAKE +# define RGBLIGHT_EFFECT_KNIGHT +# else +# define RGBLIGHT_ANIMATIONS +# endif #endif // RGBLIGHT_ENABLE #ifdef RGB_MATRIX_ENABLE diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index b48d837d00..71779a6215 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -25,8 +25,6 @@ userspace_config_t userspace_config; # define DRASHNA_UNICODE_MODE 2 #endif - - bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) { static uint16_t this_timer; if (pressed) { @@ -73,19 +71,22 @@ void bootmagic_lite(void) { } } +__attribute__((weak)) void keyboard_pre_init_keymap(void) {} + +void keyboard_pre_init_user(void) { + userspace_config.raw = eeconfig_read_user(); + keyboard_pre_init_keymap(); +} // Add reconfigurable functions here, for keymap customization // This allows for a global, userspace functions, and continued // customization of the keymap. Use _keymap instead of _user // functions in the keymaps -__attribute__((weak)) -void matrix_init_keymap(void) {} +__attribute__((weak)) void matrix_init_keymap(void) {} // Call user matrix init, set default RGB colors and then // call the keymap's init function void matrix_init_user(void) { - userspace_config.raw = eeconfig_read_user(); - -#ifdef BOOTLOADER_CATERINA +#if defined(BOOTLOADER_CATERINA) && defined(__AVR__) DDRD &= ~(1 << 5); PORTD &= ~(1 << 5); @@ -100,8 +101,7 @@ void matrix_init_user(void) { matrix_init_keymap(); } -__attribute__((weak)) -void keyboard_post_init_keymap(void) {} +__attribute__((weak)) void keyboard_post_init_keymap(void) {} void keyboard_post_init_user(void) { #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) @@ -110,10 +110,9 @@ void keyboard_post_init_user(void) { keyboard_post_init_keymap(); } -__attribute__((weak)) -void shutdown_keymap(void) {} +__attribute__((weak)) void shutdown_keymap(void) {} - void rgb_matrix_update_pwm_buffers(void); +void rgb_matrix_update_pwm_buffers(void); void shutdown_user(void) { #ifdef RGBLIGHT_ENABLE @@ -122,29 +121,22 @@ void shutdown_user(void) { rgblight_setrgb_red(); #endif // RGBLIGHT_ENABLE #ifdef RGB_MATRIX_ENABLE - rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 ); + rgb_matrix_set_color_all(0xFF, 0x00, 0x00); rgb_matrix_update_pwm_buffers(); #endif // RGB_MATRIX_ENABLE shutdown_keymap(); } -__attribute__((weak)) -void suspend_power_down_keymap(void) {} +__attribute__((weak)) void suspend_power_down_keymap(void) {} -void suspend_power_down_user(void) { - suspend_power_down_keymap(); -} +void suspend_power_down_user(void) { suspend_power_down_keymap(); } -__attribute__((weak)) -void suspend_wakeup_init_keymap(void) {} +__attribute__((weak)) void suspend_wakeup_init_keymap(void) {} -void suspend_wakeup_init_user(void) { - suspend_wakeup_init_keymap(); -} +void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); } -__attribute__((weak)) -void matrix_scan_keymap(void) {} +__attribute__((weak)) void matrix_scan_keymap(void) {} // No global matrix scan code, so just run keymap's matrix // scan function @@ -166,8 +158,7 @@ void matrix_scan_user(void) { matrix_scan_keymap(); } -__attribute__((weak)) -layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } +__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } // on layer change, no matter where the change was initiated // Then runs keymap's layer change check @@ -179,32 +170,27 @@ layer_state_t layer_state_set_user(layer_state_t state) { return layer_state_set_keymap(state); } -__attribute__((weak)) -layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; } +__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; } // Runs state check and changes underglow color and animation layer_state_t default_layer_state_set_user(layer_state_t state) { state = default_layer_state_set_keymap(state); #if 0 -#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) +# if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) state = default_layer_state_set_rgb(state); # endif // RGBLIGHT_ENABLE #endif return state; } -__attribute__((weak)) -void led_set_keymap(uint8_t usb_led) {} +__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {} // Any custom LED code goes here. // So far, I only have keyboard specific code, // So nothing goes here. -void led_set_user(uint8_t usb_led) { - led_set_keymap(usb_led); -} +void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); } -__attribute__((weak)) -void eeconfig_init_keymap(void) {} +__attribute__((weak)) void eeconfig_init_keymap(void) {} void eeconfig_init_user(void) { userspace_config.raw = 0; diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 0ccb7614fa..0ba1817604 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -16,7 +16,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once -#include "quantum.h" +#include QMK_KEYBOARD_H + #include "version.h" #include "eeprom.h" #include "wrappers.h" @@ -62,6 +63,7 @@ void led_set_keymap(uint8_t usb_led); void eeconfig_init_keymap(void); bool hasAllBitsInMask(uint8_t value, uint8_t mask); +// clang-format off typedef union { uint32_t raw; struct { @@ -73,6 +75,7 @@ typedef union { bool rgb_matrix_idle_anim :1; }; } userspace_config_t; +// clang-format on extern userspace_config_t userspace_config; diff --git a/users/drashna/font_gmk_bad.h b/users/drashna/font_gmk_bad.h new file mode 100644 index 0000000000..c1c5c390a9 --- /dev/null +++ b/users/drashna/font_gmk_bad.h @@ -0,0 +1,241 @@ +#pragma once + +#ifdef __AVR__ +# include <avr/io.h> +# include <avr/pgmspace.h> +#elif defined(ESP8266) +# include <pgmspace.h> +#else +# define PROGMEM +#endif + +// Corne 8x6 font with QMK Firmware Logo +// Online editor: https://helixfonteditor.netlify.com/ + +// clang-format off +const unsigned char font[] PROGMEM = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, + 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, + 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, + 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, + 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, + 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, + 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, + 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, + 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, + 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, + 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, + 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, + 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, + 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, + 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, + 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, + 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, + 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, + 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, + 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, + 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, + 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, + 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, + 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, + 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, + 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, + 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, + 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, + 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, + 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, + 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, + 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, + 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, + 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, + 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, + 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, + 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, + 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, + 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, + 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, + 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, + 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, + 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, + 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, + 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, + 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, + 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, + 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, + 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, + 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, + 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, + 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, + 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, + 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, + 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, + 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, + 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, + 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, + 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, + 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, + 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, + 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, + 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, + 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, + 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, + 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, + 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, + 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, + 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, + 0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, + 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, + 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, + 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, + 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, + 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, + 0x7C, 0x18, 0x24, 0x24, 0x18, 0x00, + 0x18, 0x24, 0x24, 0x18, 0x7C, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, + 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, + 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, + 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, + 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, + 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, + 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, + 0x4C, 0x90, 0x10, 0x90, 0x7C, 0x00, + 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, + 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, + 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, + 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0xC0, 0xE0, 0xF0, 0xF0, 0x70, + 0x38, 0x38, 0x38, 0x78, 0x70, 0xF0, + 0xE0, 0xE0, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0xF0, 0xF8, + 0xF8, 0xF8, 0xF8, 0x00, 0x00, 0x00, + 0x80, 0xE0, 0xF8, 0xF8, 0xF8, 0xF8, + 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0xF8, 0xF8, 0xF8, 0x38, 0x00, + 0x80, 0xE0, 0xF0, 0xF8, 0x78, 0x38, + 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0xF8, 0xF8, 0xF8, 0x38, 0x38, + 0x38, 0xF8, 0xF0, 0xF0, 0xE0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0xFC, 0xFC, + 0xFC, 0x1C, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, + 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, + 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, + 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, + 0xFF, 0xFF, 0xFF, 0xC1, 0x80, 0x00, + 0x00, 0x38, 0x38, 0xB8, 0xB8, 0xF9, + 0xF9, 0xF8, 0x38, 0x00, 0x00, 0x00, + 0x00, 0xC0, 0xF8, 0xFF, 0xFF, 0x1F, + 0x01, 0x3F, 0xFF, 0xFF, 0xF0, 0xFE, + 0x7F, 0x0F, 0x03, 0xFF, 0xFF, 0xFF, + 0xFF, 0x00, 0x00, 0x00, 0x00, 0x80, + 0xFF, 0xFF, 0xFF, 0x3F, 0x1E, 0x7F, + 0xFF, 0xFF, 0xF3, 0xC1, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0xFF, 0xFF, 0xFF, 0x3F, 0x1C, 0x1C, + 0x9C, 0xFF, 0xFF, 0xF3, 0xE1, 0x00, + 0x00, 0x00, 0x00, 0xF0, 0xFC, 0xFE, + 0xFF, 0x0F, 0x07, 0x07, 0x8E, 0xFF, + 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, + 0x00, 0xF0, 0xFC, 0xFE, 0xFF, 0x8F, + 0x07, 0x07, 0x8E, 0xFF, 0xFF, 0xFF, + 0x3F, 0x00, 0x00, 0x00, 0x00, 0x80, + 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, + 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, + 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x03, 0x03, 0x03, 0x07, + 0x07, 0x07, 0x07, 0x03, 0x03, 0x03, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x07, 0x07, 0x07, 0x01, 0x00, + 0x00, 0x00, 0x07, 0x07, 0x07, 0x01, + 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, + 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, + 0x07, 0x07, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x07, 0x07, 0x07, 0x06, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, + 0x07, 0x07, 0x07, 0x03, 0x07, 0x07, + 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x07, 0x07, 0x07, + 0x07, 0x03, 0x07, 0x07, 0x07, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, + 0x07, 0x07, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; diff --git a/users/drashna/hue_manitee_font.h b/users/drashna/hue_manitee_font.h new file mode 100644 index 0000000000..72d50f7a6a --- /dev/null +++ b/users/drashna/hue_manitee_font.h @@ -0,0 +1,241 @@ +#pragma once + +#ifdef __AVR__ +# include <avr/io.h> +# include <avr/pgmspace.h> +#elif defined(ESP8266) +# include <pgmspace.h> +#else +# define PROGMEM +#endif + +// Corne 8x6 font with QMK Firmware Logo +// Online editor: https://helixfonteditor.netlify.com/ + +// clang-format off +const unsigned char font[] PROGMEM = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, + 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, + 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, + 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, + 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, + 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, + 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, + 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, + 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, + 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, + 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, + 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, + 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, + 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, + 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, + 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, + 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, + 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, + 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, + 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, + 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, + 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, + 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, + 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, + 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, + 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, + 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, + 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, + 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, + 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, + 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, + 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, + 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, + 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, + 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, + 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, + 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, + 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, + 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, + 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, + 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, + 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, + 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, + 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, + 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, + 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, + 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, + 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, + 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, + 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, + 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, + 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, + 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, + 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, + 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, + 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, + 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, + 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, + 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, + 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, + 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, + 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, + 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, + 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, + 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, + 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, + 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, + 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, + 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, + 0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, + 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, + 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, + 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, + 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, + 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, + 0x7C, 0x18, 0x24, 0x24, 0x18, 0x00, + 0x18, 0x24, 0x24, 0x18, 0x7C, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, + 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, + 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, + 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, + 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, + 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, + 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, + 0x4C, 0x90, 0x10, 0x90, 0x7C, 0x00, + 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, + 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, + 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, + 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0xC0, 0xC0, + 0x90, 0x70, 0xE8, 0xA8, 0xE4, 0xC4, + 0xC4, 0xA0, 0xE4, 0xB0, 0xDC, 0xE4, + 0xFC, 0xFC, 0xFC, 0xFC, 0x3C, 0x3C, + 0xFC, 0xF8, 0xF0, 0xF0, 0xE0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xF8, 0xF8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, + 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, + 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, + 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, + 0xFC, 0xF6, 0xF7, 0xEF, 0xFF, 0x87, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, + 0xFF, 0x07, 0x1F, 0x1F, 0x19, 0x15, + 0xF7, 0x16, 0x1A, 0x1B, 0x16, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0C, 0x0C, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, 0xC0, 0xC0, + 0x00, 0x00, 0x03, 0x03, 0xFF, 0xFF, + 0x03, 0x03, 0x00, 0x00, 0xC0, 0xC0, + 0x00, 0x00, 0x00, 0xFC, 0xFC, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0xFC, + 0xFC, 0x00, 0x00, 0x00, 0xFC, 0xFC, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0x30, 0x30, 0xCC, 0xCC, + 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, + 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, + 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x03, 0x07, 0x07, 0x07, 0x07, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x07, 0x07, + 0x03, 0x00, 0x00, 0x02, 0x04, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c index 6eb21d2f27..2f79ad11cc 100644 --- a/users/drashna/process_records.c +++ b/users/drashna/process_records.c @@ -2,11 +2,9 @@ uint16_t copy_paste_timer; -__attribute__((weak)) -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } +__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } -__attribute__((weak)) -bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; } +__attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; } // Defines actions tor my global custom keycodes. Defined in drashna.h file // Then runs the _keymap's record handier if not processed here @@ -23,7 +21,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KC_QWERTY ... KC_WORKMAN: if (record->event.pressed) { - uint8_t mods = mod_config(get_mods()|get_oneshot_mods()); + uint8_t mods = mod_config(get_mods() | get_oneshot_mods()); if (!mods) { set_single_persistent_default_layer(keycode - KC_QWERTY); } else if (mods & MOD_MASK_SHIFT) { diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index a9af0566e3..52ec61c22d 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -12,9 +12,9 @@ void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight #if defined(RGB_MATRIX_ENABLE) static uint32_t hypno_timer; # if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_crkbd) -# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL # else -# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN +# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN # endif #endif @@ -23,68 +23,68 @@ static uint32_t hypno_timer; * This is especially useful for One Shot Mods, since it's not always obvious if they're still lit up. */ #ifdef RGBLIGHT_ENABLE -#ifdef INDICATOR_LIGHTS +# ifdef INDICATOR_LIGHTS void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { - if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) { + if (userspace_config.rgb_layer_change && get_highest_layer(layer_state) == 0) { if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) { -# ifdef SHFT_LED1 +# ifdef SHFT_LED1 rgblight_sethsv_at(120, 255, 255, SHFT_LED1); -# endif // SHFT_LED1 -# ifdef SHFT_LED2 +# endif // SHFT_LED1 +# ifdef SHFT_LED2 rgblight_sethsv_at(120, 255, 255, SHFT_LED2); -# endif // SHFT_LED2 +# endif // SHFT_LED2 } else { -# ifdef SHFT_LED1 +# ifdef SHFT_LED1 rgblight_sethsv_default_helper(SHFT_LED1); -# endif // SHFT_LED1 -# ifdef SHFT_LED2 +# endif // SHFT_LED1 +# ifdef SHFT_LED2 rgblight_sethsv_default_helper(SHFT_LED2); -# endif // SHFT_LED2 +# endif // SHFT_LED2 } if ((this_mod | this_osm) & MOD_MASK_CTRL) { -# ifdef CTRL_LED1 +# ifdef CTRL_LED1 rgblight_sethsv_at(0, 255, 255, CTRL_LED1); -# endif // CTRL_LED1 -# ifdef CTRL_LED2 +# endif // CTRL_LED1 +# ifdef CTRL_LED2 rgblight_sethsv_at(0, 255, 255, CTRL_LED2); -# endif // CTRL_LED2 +# endif // CTRL_LED2 } else { -# ifdef CTRL_LED1 +# ifdef CTRL_LED1 rgblight_sethsv_default_helper(CTRL_LED1); -# endif // CTRL_LED1 -# ifdef CTRL_LED2 +# endif // CTRL_LED1 +# ifdef CTRL_LED2 rgblight_sethsv_default_helper(CTRL_LED2); -# endif // CTRL_LED2 +# endif // CTRL_LED2 } if ((this_mod | this_osm) & MOD_MASK_GUI) { -# ifdef GUI_LED1 +# ifdef GUI_LED1 rgblight_sethsv_at(51, 255, 255, GUI_LED1); -# endif // GUI_LED1 -# ifdef GUI_LED2 +# endif // GUI_LED1 +# ifdef GUI_LED2 rgblight_sethsv_at(51, 255, 255, GUI_LED2); -# endif // GUI_LED2 +# endif // GUI_LED2 } else { -# ifdef GUI_LED1 +# ifdef GUI_LED1 rgblight_sethsv_default_helper(GUI_LED1); -# endif // GUI_LED1 -# ifdef GUI_LED2 +# endif // GUI_LED1 +# ifdef GUI_LED2 rgblight_sethsv_default_helper(GUI_LED2); -# endif // GUI_LED2 +# endif // GUI_LED2 } if ((this_mod | this_osm) & MOD_MASK_ALT) { -# ifdef ALT_LED1 +# ifdef ALT_LED1 rgblight_sethsv_at(240, 255, 255, ALT_LED1); -# endif // ALT_LED1 -# ifdef GUI_LED2 +# endif // ALT_LED1 +# ifdef GUI_LED2 rgblight_sethsv_at(240, 255, 255, ALT_LED2); -# endif // GUI_LED2 +# endif // GUI_LED2 } else { -# ifdef GUI_LED1 +# ifdef GUI_LED1 rgblight_sethsv_default_helper(ALT_LED1); -# endif // GUI_LED1 -# ifdef GUI_LED2 +# endif // GUI_LED1 +# ifdef GUI_LED2 rgblight_sethsv_default_helper(ALT_LED2); -# endif // GUI_LED2 +# endif // GUI_LED2 } } } @@ -95,9 +95,9 @@ void matrix_scan_indicator(void) { set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); } } -#endif // INDICATOR_LIGHTS +# endif // INDICATOR_LIGHTS -#ifdef RGBLIGHT_TWINKLE +# ifdef RGBLIGHT_TWINKLE static rgblight_fadeout lights[RGBLED_NUM]; __attribute__((weak)) bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { return false; } @@ -105,40 +105,40 @@ __attribute__((weak)) bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { /* This function checks for used LEDs. This way, collisions don't occur and cause weird rendering */ bool rgblight_twinkle_is_led_used(uint8_t index) { switch (index) { -# ifdef INDICATOR_LIGHTS -# ifdef SHFT_LED1 +# ifdef INDICATOR_LIGHTS +# ifdef SHFT_LED1 case SHFT_LED1: return true; -# endif // SHFT_LED1 -# ifdef SHFT_LED2 +# endif // SHFT_LED1 +# ifdef SHFT_LED2 case SHFT_LED2: return true; -# endif // SHFT_LED2 -# ifdef CTRL_LED1 +# endif // SHFT_LED2 +# ifdef CTRL_LED1 case CTRL_LED1: return true; -# endif // CTRL_LED1 -# ifdef CTRL_LED2 +# endif // CTRL_LED1 +# ifdef CTRL_LED2 case CTRL_LED2: return true; -# endif // CTRL_LED2 -# ifdef GUI_LED1 +# endif // CTRL_LED2 +# ifdef GUI_LED1 case GUI_LED1: return true; -# endif // GUI_LED1 -# ifdef GUI_LED2 +# endif // GUI_LED1 +# ifdef GUI_LED2 case GUI_LED2: return true; -# endif // GUI_LED2 -# ifdef ALT_LED1 +# endif // GUI_LED2 +# ifdef ALT_LED1 case ALT_LED1: return true; -# endif // ALT_LED1 -# ifdef ALT_LED2 +# endif // ALT_LED1 +# ifdef ALT_LED2 case ALT_LED2: return true; -# endif // ALT_LED2 -# endif // INDICATOR_LIGHTS +# endif // ALT_LED2 +# endif // INDICATOR_LIGHTS default: return rgblight_twinkle_is_led_used_keymap(index); } @@ -154,19 +154,19 @@ void scan_rgblight_fadeout(void) { // Don't effing change this function .... rg if (light->life) { light->life -= 1; - if (biton32(layer_state) == 0) { + if (get_highest_layer(layer_state) == 0) { sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]); } light->timer = timer_read(); } else { - if (light->enabled && biton32(layer_state) == 0) { + if (light->enabled && get_highest_layer(layer_state) == 0) { rgblight_sethsv_default_helper(light_index); } litup = light->enabled = false; } } } - if (litup && biton32(layer_state) == 0) { + if (litup && get_highest_layer(layer_state) == 0) { rgblight_set(); } } @@ -211,8 +211,8 @@ void start_rgb_light(void) { rgblight_sethsv_at(light->hue, 255, light->life, light_index); } -#endif -#endif // RGBLIGHT_ENABLE +# endif +#endif // RGBLIGHT_ENABLE bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { uint16_t temp_keycode = keycode; @@ -259,7 +259,9 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { userspace_config.rgb_matrix_idle_anim ^= 1; dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim); eeconfig_update_user(userspace_config.raw); - if (userspace_config.rgb_matrix_idle_anim) { rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); } + if (userspace_config.rgb_matrix_idle_anim) { + rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); + } } #endif break; @@ -281,7 +283,9 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { is_eeprom_updated = true; } #endif - if (is_eeprom_updated) { eeconfig_update_user(userspace_config.raw); } + if (is_eeprom_updated) { + eeconfig_update_user(userspace_config.raw); + } } break; } @@ -290,7 +294,7 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { void keyboard_post_init_rgb(void) { #if defined(RGBLIGHT_ENABLE) -# if defined(RGBLIGHT_STARTUP_ANIMATION) +# if defined(RGBLIGHT_STARTUP_ANIMATION) bool is_enabled = rgblight_config.enable; if (userspace_config.rgb_layer_change) { rgblight_enable_noeeprom(); @@ -309,13 +313,13 @@ void keyboard_post_init_rgb(void) { rgblight_disable_noeeprom(); } -# endif +# endif layer_state_set_user(layer_state); #endif #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) - if (userspace_config.rgb_matrix_idle_anim) { - rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); - } + if (userspace_config.rgb_matrix_idle_anim) { + rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); + } #endif } @@ -337,67 +341,70 @@ void matrix_scan_rgb(void) { #endif } +#ifdef RGBLIGHT_ENABLE +void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) { + rgblight_sethsv_noeeprom(hue, sat, val); + wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly + rgblight_mode_noeeprom(mode); +} +#endif + layer_state_t layer_state_set_rgb(layer_state_t state) { #ifdef RGBLIGHT_ENABLE if (userspace_config.rgb_layer_change) { - switch (biton32(state)) { + switch (get_highest_layer(state)) { case _MACROS: - rgblight_sethsv_noeeprom_orange(); - userspace_config.is_overwatch ? rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 2) : rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 3); + rgblight_set_hsv_and_mode(HSV_ORANGE, userspace_config.is_overwatch ? RGBLIGHT_MODE_SNAKE + 2 : RGBLIGHT_MODE_SNAKE + 3); break; case _MEDIA: - rgblight_sethsv_noeeprom_chartreuse(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 1); + rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_KNIGHT + 1); break; case _GAMEPAD: - rgblight_sethsv_noeeprom_orange(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 2); + rgblight_set_hsv_and_mode(HSV_ORANGE, RGBLIGHT_MODE_SNAKE + 2); break; case _DIABLO: - rgblight_sethsv_noeeprom_red(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); + rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_BREATHING + 3); break; case _RAISE: - rgblight_sethsv_noeeprom_yellow(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); + rgblight_set_hsv_and_mode(HSV_YELLOW, RGBLIGHT_MODE_BREATHING + 3); break; case _LOWER: - rgblight_sethsv_noeeprom_green(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); + rgblight_set_hsv_and_mode(HSV_GREEN, RGBLIGHT_MODE_BREATHING + 3); break; case _ADJUST: - rgblight_sethsv_noeeprom_red(); - rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2); + rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2); break; default: // for any other layers, or the default layer - switch (biton32(default_layer_state)) { + { + uint8_t mode = get_highest_layer(state) == _MODS ? RGBLIGHT_MODE_BREATHING : RGBLIGHT_MODE_STATIC_LIGHT; + switch (get_highest_layer(default_layer_state)) { case _COLEMAK: - rgblight_sethsv_noeeprom_magenta(); + rgblight_set_hsv_and_mode(HSV_MAGENTA, mode); break; case _DVORAK: - rgblight_sethsv_noeeprom_springgreen(); + rgblight_set_hsv_and_mode(HSV_SPRINGGREEN, mode); break; case _WORKMAN: - rgblight_sethsv_noeeprom_goldenrod(); + rgblight_set_hsv_and_mode(HSV_GOLDENROD, mode); break; case _NORMAN: - rgblight_sethsv_noeeprom_coral(); + rgblight_set_hsv_and_mode(HSV_CORAL, mode); break; case _MALTRON: - rgblight_sethsv_noeeprom_yellow(); + rgblight_set_hsv_and_mode(HSV_YELLOW, mode); break; case _EUCALYN: - rgblight_sethsv_noeeprom_pink(); + rgblight_set_hsv_and_mode(HSV_PINK, mode); break; case _CARPLAX: - rgblight_sethsv_noeeprom_blue(); + rgblight_set_hsv_and_mode(HSV_BLUE, mode); break; default: - rgblight_sethsv_noeeprom_cyan(); + rgblight_set_hsv_and_mode(HSV_CYAN, mode); break; } - biton32(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it break; + } } } #endif // RGBLIGHT_ENABLE @@ -408,6 +415,7 @@ layer_state_t layer_state_set_rgb(layer_state_t state) { #ifdef RGB_MATRIX_ENABLE # include "lib/lib8tion/lib8tion.h" extern led_config_t g_led_config; + void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type) { HSV hsv = {hue, sat, val}; if (hsv.v > rgb_matrix_config.hsv.v) { diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h index 7e34c93c11..50b73c1c3c 100644 --- a/users/drashna/rgb_stuff.h +++ b/users/drashna/rgb_stuff.h @@ -20,13 +20,13 @@ layer_state_t layer_state_set_rgb(layer_state_t state); layer_state_t default_layer_state_set_rgb(layer_state_t state); #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_TWINKLE) -void scan_rgblight_fadeout(void); +void scan_rgblight_fadeout(void); #endif #if defined(RGBLIGHT_ENABLE) -void rgblight_sethsv_default_helper(uint8_t index); +void rgblight_sethsv_default_helper(uint8_t index); #endif #ifdef RGB_MATRIX_ENABLE -void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue); +void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type); #endif diff --git a/users/drashna/rgblight_breathe_table.h b/users/drashna/rgblight_breathe_table.h index 05d347fcd3..4c6ae38faa 100644 --- a/users/drashna/rgblight_breathe_table.h +++ b/users/drashna/rgblight_breathe_table.h @@ -1,9 +1,10 @@ #ifndef RGBLIGHT_EFFECT_BREATHE_TABLE #define RGBLIGHT_EFFECT_BREATHE_TABLE +// clang-format off const uint8_t rgblight_effect_breathe_table[] PROGMEM = { - /* #define RGBLIGHT_EFFECT_BREATHE_CENTER 0.00 */ - /* #define RGBLIGHT_EFFECT_BREATHE_MAX 255 */ +/* #define RGBLIGHT_EFFECT_BREATHE_CENTER 0.00 */ +/* #define RGBLIGHT_EFFECT_BREATHE_MAX 255 */ #if RGBLIGHT_BREATHE_TABLE_SIZE == 256 0x44, 0x45, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x4e, @@ -110,7 +111,8 @@ const uint8_t rgblight_effect_breathe_table[] PROGMEM = { 0x4e, 0x48 #endif /* 64 bytes table */ }; +// clang-format on -static const int table_scale = 256/sizeof(rgblight_effect_breathe_table); +static const int table_scale = 256 / sizeof(rgblight_effect_breathe_table); #endif /* RGBLIGHT_EFFECT_BREATHE_TABLE */ diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index 1b5a863850..882857fc86 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -1,16 +1,16 @@ SRC += drashna.c \ process_records.c -LINK_TIME_OPTIMIZATION_ENABLE = yes -SPACE_CADET_ENABLE = no +LTO_ENABLE = yes +SPACE_CADET_ENABLE = no ifneq ($(strip $(NO_SECRETS)), yes) - ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") - SRC += secrets.c - endif - ifeq ($(strip $(NO_SECRETS)), lite) - OPT_DEFS += -DNO_SECRETS - endif + ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") + SRC += secrets.c + endif + ifeq ($(strip $(NO_SECRETS)), lite) + OPT_DEFS += -DNO_SECRETS + endif endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) @@ -52,3 +52,10 @@ endif ifeq ($(strip $(MAKE_BOOTLOADER)), yes) OPT_DEFS += -DMAKE_BOOTLOADER endif + +# At least until build.mk or the like drops, this is here to prevent +# VUSB boards from enabling NKRO, as they do not support it. Ideally +# this should be handled per keyboard, but until that happens ... +ifeq ($(strip $(PROTOCOL)), VUSB) + NKRO_ENABLE = no +endif
\ No newline at end of file diff --git a/users/drashna/template.c b/users/drashna/template.c index d90e6bdecf..833447daac 100644 --- a/users/drashna/template.c +++ b/users/drashna/template.c @@ -1,124 +1,82 @@ #include "template.h" - // Add reconfigurable functions here, for keymap customization // This allows for a global, userspace functions, and continued // customization of the keymap. Use _keymap instead of _user // functions in the keymaps -__attribute__ ((weak)) -void matrix_init_keymap(void) {} +__attribute__((weak)) void matrix_init_keymap(void) {} // Call user matrix init, then call the keymap's init function -void matrix_init_user(void) { - matrix_init_keymap(); -} +void matrix_init_user(void) { matrix_init_keymap(); } - -__attribute__ ((weak)) -void matrix_scan_keymap(void) {} +__attribute__((weak)) void matrix_scan_keymap(void) {} // No global matrix scan code, so just run keymap's matix // scan function -void matrix_scan_user(void) { - matrix_scan_keymap(); -} +void matrix_scan_user(void) { matrix_scan_keymap(); } - -__attribute__ ((weak)) -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - return true; -} +__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } // Defines actions tor my global custom keycodes. Defined in drashna.h file // Then runs the _keymap's recod handier if not processed here, // And use "NEWPLACEHOLDER" for new safe range bool process_record_user(uint16_t keycode, keyrecord_t *record) { - - switch (keycode) { - case KC_MAKE: - if (!record->event.pressed) { - SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP -#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) - ":dfu" + switch (keycode) { + case KC_MAKE: + if (!record->event.pressed) { + SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP +#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) + ":dfu" #elif defined(BOOTLOADER_HALFKAY) - ":teensy" + ":teensy" #elif defined(BOOTLOADER_CATERINA) - ":avrdude" + ":avrdude" #endif - SS_TAP(X_ENTER)); + SS_TAP(X_ENTER)); + } + return false; + break; + + case VRSN: + if (record->event.pressed) { + SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + break; } - return false; - break; - - case VRSN: - if (record->event.pressed) { - SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); - } - return false; - break; - } - return process_record_keymap(keycode, record); -} - - -__attribute__ ((weak)) -layer_state_t layer_state_set_keymap (layer_state_t state) { - return state; -} - -layer_state_t layer_state_set_user (layer_state_t state) { - return layer_state_set_keymap (state); + return process_record_keymap(keycode, record); } +__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } +layer_state_t layer_state_set_user(layer_state_t state) { return layer_state_set_keymap(state); } -__attribute__ ((weak)) -void led_set_keymap(uint8_t usb_led) {} - -void led_set_user(uint8_t usb_led) { - led_set_keymap(usb_led); -} - +__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {} +void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); } -__attribute__ ((weak)) -void suspend_power_down_keymap(void) {} - -void suspend_power_down_user(void) -{ - suspend_power_down_keymap(); -} - +__attribute__((weak)) void suspend_power_down_keymap(void) {} +void suspend_power_down_user(void) { suspend_power_down_keymap(); } -__attribute__ ((weak)) -void suspend_wakeup_init_keymap(void) {} +__attribute__((weak)) void suspend_wakeup_init_keymap(void) {} -void suspend_wakeup_init_user(void) -{ - suspend_wakeup_init_keymap(); - #ifdef KEYBOARD_ergodox_ez - wait_ms(10); - #endif +void suspend_wakeup_init_user(void) { + suspend_wakeup_init_keymap(); +#ifdef KEYBOARD_ergodox_ez + wait_ms(10); +#endif } +__attribute__((weak)) void startup_keymap(void) {} - -__attribute__ ((weak)) -void startup_keymap(void) {} - -void startup_user (void) { - #ifdef RGBLIGHT_ENABLE +void startup_user(void) { +#ifdef RGBLIGHT_ENABLE matrix_init_rgb(); - #endif //RGBLIGHT_ENABLE - startup_keymap(); +#endif // RGBLIGHT_ENABLE + startup_keymap(); } +__attribute__((weak)) void shutdown_keymap(void) {} - -__attribute__ ((weak)) -void shutdown_keymap(void) {} - -void shutdown_user (void) { - shutdown_keymap(); -} +void shutdown_user(void) { shutdown_keymap(); } diff --git a/users/drashna/template.h b/users/drashna/template.h index dd1c487604..178f96e220 100644 --- a/users/drashna/template.h +++ b/users/drashna/template.h @@ -1,7 +1,6 @@ -#ifndef USERSPACE -#define USERSPACE +#pragma once -#include "quantum.h" +#include QMK_KEYBOARD_H #include "version.h" #include "eeprom.h" @@ -9,10 +8,8 @@ #define BASE 0 enum custom_keycodes { - VRSN = SAFE_RANGE, // can always be here - KC_MAKE, - KC_RESET, - NEWPLACEHOLDER //use "NEWPLACEHOLDER for keymap specific codes + VRSN = SAFE_RANGE, // can always be here + KC_MAKE, + KC_RESET, + NEWPLACEHOLDER // use "NEWPLACEHOLDER for keymap specific codes }; - -#endif diff --git a/users/dshields/config.h b/users/dshields/config.h index d92f787e41..aa10814763 100644 --- a/users/dshields/config.h +++ b/users/dshields/config.h @@ -6,6 +6,7 @@ #define ONESHOT_TIMEOUT 3000 #define RETRO_TAPPING #define BACKLIGHT_BREATHING +#define DYNAMIC_MACRO_NO_NESTING #define MOUSEKEY_INTERVAL 20 #define MOUSEKEY_DELAY 0 diff --git a/users/dshields/dshields.c b/users/dshields/dshields.c index bc88cae561..8f432a317c 100644 --- a/users/dshields/dshields.c +++ b/users/dshields/dshields.c @@ -1,12 +1,7 @@ #include "quantum.h" #include "dshields.h" -extern bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record); - bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if (!process_record_dynamic_macro(keycode, record)) { - return false; - } if (keycode == KC_ESC && record->event.pressed) { bool rc = true; uint8_t mods = 0; diff --git a/users/dshields/dshields.h b/users/dshields/dshields.h index a65ccfea00..e1aa07a5db 100644 --- a/users/dshields/dshields.h +++ b/users/dshields/dshields.h @@ -1,10 +1,5 @@ #pragma once -// dynamic macro keys -#define DM_PLAY DYN_MACRO_PLAY1 -#define DM_STRT DYN_REC_START1 -#define DM_STOP DYN_REC_STOP - // one-shot layer keys #define OSL_RSE OSL(RSE) #define OSL_LWR OSL(LWR) @@ -21,21 +16,27 @@ // mod-tap keys #define MT_SPC SFT_T(KC_SPC) +// LED/RGB controls #ifdef KEYBOARD_planck_light #define LGT_TOG RGB_TOG #define LGT_MOD RGB_MOD #define LGT_BRT _______ + #define LGT_INC RGB_HUI + #define LGT_DEC RGB_HUD #endif #ifdef KEYBOARD_planck_rev3 #define LGT_TOG BL_TOGG #define LGT_MOD BL_STEP #define LGT_BRT BL_BRTG + #define LGT_INC BL_INC + #define LGT_DEC BL_DEC #endif #ifdef KEYBOARD_planck_rev6 #define LGT_TOG _______ #define LGT_MOD _______ #define LGT_BRT _______ + #define LGT_INC _______ + #define LGT_DEC _______ #endif enum layers { DEF, LWR, RSE, FUN }; -enum keycodes { DYNAMIC_MACRO_RANGE = SAFE_RANGE }; diff --git a/users/dshields/rules.mk b/users/dshields/rules.mk index 8a7c82cd44..abfbe5e40e 100644 --- a/users/dshields/rules.mk +++ b/users/dshields/rules.mk @@ -8,6 +8,7 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend API_SYSEX_ENABLE = no SPACE_CADET_ENABLE = no LEADER_ENABLE = no +DYNAMIC_MACRO_ENABLE = yes LINK_TIME_OPTIMIZATION_ENABLE = yes diff --git a/users/issmirnov/config.h b/users/issmirnov/config.h new file mode 100644 index 0000000000..664ebfe8a3 --- /dev/null +++ b/users/issmirnov/config.h @@ -0,0 +1,45 @@ +#pragma once + +// Allows sending more than one key per scan. Useful for chords. +#define QMK_KEYS_PER_SCAN 4 + +// how long before a tap becomes a hold +#undef TAPPING_TERM +#define TAPPING_TERM 100 + +// makes tap and hold keys work better for fast typers who don't want +// tapping term set above 500 +#define PERMISSIVE_HOLD + +// tap anyway, even after TAPPING_TERM, if there was no other key +// interruption between press and release +#define RETRO_TAPPING + +// how many taps before triggering the toggle +#undef ONESHOT_TAP_TOGGLE +#define ONESHOT_TAP_TOGGLE 2 + +// how long before oneshot modifier key times out (currently only shift) +#undef ONESHOT_TIMEOUT +#define ONESHOT_TIMEOUT 2000 + +// Enable combos for vim +#define COMBO_COUNT 5 // Specify the number of combos used. BE SURE TO INCREMENT AS NEEDED +#define COMBO_TERM 50 // window in milliseconds to trigger combo + +// Allow more than 4 keys to be sent to the system. Useful for gaming. +// #define FORCE_NKRO + +// Save 200 bytes on unused keycodes +#undef LOCKING_SUPPORT_ENABLE +#undef LOCKING_RESYNC_ENABLE + +// Enable HID_listen commands. +#define NO_DEBUG +#undef NO_PRINT +#define USER_PRINT + +// Note: Defining the following does not have any impact on space: +// - NO_ACTION_MACRO +// - NO_ACTION_FUNCTION +// - DISABLE_LEADER diff --git a/users/issmirnov/issmirnov.c b/users/issmirnov/issmirnov.c new file mode 100644 index 0000000000..665afbcfd7 --- /dev/null +++ b/users/issmirnov/issmirnov.c @@ -0,0 +1,43 @@ +#include "issmirnov.h" + +enum combo_events { + JK_ESC, + DF_CLN, + SD_SLASH, + XC_COPY, + XV_PASTE +}; + + +const uint16_t PROGMEM jk_combo[] = {KC_J, KC_K, COMBO_END}; +const uint16_t PROGMEM df_combo[] = {KC_D, KC_F, COMBO_END}; +const uint16_t PROGMEM sd_combo[] = {KC_S, KC_D, COMBO_END}; +const uint16_t PROGMEM copy_combo[] = {KC_X, KC_C, COMBO_END}; +const uint16_t PROGMEM paste_combo[] = {KC_X, KC_V, COMBO_END}; + + +// BE SURE TO UPDATE THE CONFIG.H "COMBO_COUNT" value when you add elements here! +combo_t key_combos[COMBO_COUNT] = { + COMBO(jk_combo, KC_ESC), + COMBO(df_combo, KC_COLON), + COMBO(sd_combo, KC_SLASH), + [XC_COPY] = COMBO_ACTION(copy_combo), + [XV_PASTE] = COMBO_ACTION(paste_combo), +}; + + +void process_combo_event(uint8_t combo_index, bool pressed) { + switch(combo_index) { + case XC_COPY: + if (pressed) { + tap_code16(LCTL(KC_C)); + } + break; + + case XV_PASTE: + if (pressed) { + tap_code16(LCTL(KC_V)); + } + break; + } +} diff --git a/users/issmirnov/issmirnov.h b/users/issmirnov/issmirnov.h new file mode 100644 index 0000000000..eef80dfc47 --- /dev/null +++ b/users/issmirnov/issmirnov.h @@ -0,0 +1,35 @@ +#pragma once + +#include QMK_KEYBOARD_H + +#include "rows.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers +enum { + _QWERTY = 0, + _SYMB, + _NUMP, + _OVERWATCH, + _NAVI +}; + +enum custom_keycodes { + PLACEHOLDER = SAFE_RANGE, + TAP_TOG_LAYER, + CLEAR_EEPROM, + WKSP_LEFT, // Smart key that only activates when we are momentarily in a layer + WKSP_RIGHT, // Smart key that only activates when we are momentarily in a layer +}; + + +#define LOWER MO(_SYMB) +#define RAISE MO(_NUMP) + +#define CTL_SPC MT(MOD_LCTL, KC_SPC) +#define OSMSFT OSM(MOD_LSFT) +#define LOCK LGUI(KC_L) +#define MODSFT LSFT(KC_LGUI) +#define APPS LGUI(KC_SPC) diff --git a/users/issmirnov/rows.h b/users/issmirnov/rows.h new file mode 100644 index 0000000000..d35af2175c --- /dev/null +++ b/users/issmirnov/rows.h @@ -0,0 +1,55 @@ +#pragma once + +#include QMK_KEYBOARD_H + +// This wrapper is required in order to expand the row macro inside the keymap configs. +#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__) +#define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__) + +// Share common config. We'll skip the mod rows and func rows. +// Note, it's also really neat the way the scoping works. Since we perform the expansion in the keymap.c file +// so we can use our enums for custom keycodes +#define _________________QWERTY_L1_________________ KC_Q , KC_W , KC_E , KC_R , KC_T +#define _________________QWERTY_L2_________________ KC_A , KC_S , KC_D , KC_F , KC_G +#define _________________QWERTY_L3_________________ KC_Z , KC_X , KC_C , KC_V , KC_B + +#define _________________QWERTY_R1_________________ KC_Y , KC_U , KC_I , KC_O , KC_P +#define _________________QWERTY_R2_________________ KC_H , KC_J , KC_K , KC_L , TAP_TOG_LAYER +#define _________________QWERTY_R3_________________ KC_N , KC_M , KC_DOT , KC_COMMA , TG(_NUMP) + +#define ___________________BLANK___________________ _______ , _______ , _______ , _______ , _______ +#define ___________________XXXXX___________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX + +#define _________________SYMB_L1___________________ KC_MINS , KC_AT , KC_LCBR , KC_RCBR , KC_GRV +#define _________________SYMB_L2___________________ KC_CIRC , KC_UNDS , KC_LPRN , KC_RPRN , KC_DLR +#define _________________SYMB_L3___________________ KC_LABK , KC_RABK , KC_LBRACKET , KC_RBRACKET , KC_TILD + +#define _________________SYMB_R1___________________ KC_ASTR , KC_EXLM , KC_PIPE , KC_PERC , KC_PLUS +#define _________________SYMB_R2___________________ KC_HASH , KC_EQL , KC_COLN , KC_SCLN , TAP_TOG_LAYER +#define _________________SYMB_R3___________________ KC_AMPR , KC_QUES , KC_SLASH , KC_BSLASH , TG(_NUMP) + + +#define _________________NUMP_L1___________________ KC_NO , KC_NO , LGUI(KC_UP) , XXXXXXX , XXXXXXX +#define _________________NUMP_L2___________________ XXXXXXX , LGUI(KC_LEFT) , LGUI(KC_DOWN) , LGUI(KC_RIGHT) , XXXXXXX +#define _________________NUMP_L3___________________ XXXXXXX , XXXXXXX , XXXXXXX , KC_AUDIO_VOL_DOWN , KC_AUDIO_VOL_UP + +#define _________________NUMP_R1___________________ KC_COMM , KC_7 , KC_8 , KC_9 , XXXXXXX +#define _________________NUMP_R2___________________ KC_0 , KC_4 , KC_5 , KC_6 , TO(_SYMB) +#define _________________NUMP_R3___________________ KC_DOT , KC_1 , KC_2 , KC_3 , TO(_QWERTY) + +// Note: These are 6x1 blocks, since modifiers are also adjusted. +#define ______________OVERWATCH_L1_________________ KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T +#define ______________OVERWATCH_L2_________________ KC_LCTL , KC_A , KC_S , KC_D , KC_F , KC_P +#define ______________OVERWATCH_L3_________________ KC_LSHIFT , KC_Z , KC_X , KC_C , KC_V , KC_GRAVE +// Ergodox only has 5 keys on bottom row: +#define ______________OVERWATCH_L4_________________ KC_LCTL , KC_F9 , KC_PSCREEN , KC_H , KC_R + + + +#define _________________NAVI_L1___________________ XXXXXXX , XXXXXXX , KC_UP , XXXXXXX , XXXXXXX +#define _________________NAVI_L2___________________ XXXXXXX , KC_LEFT , KC_DOWN , KC_RGHT , XXXXXXX +#define _________________NAVI_L3___________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX + +#define _________________NAVI_R1___________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX +#define _________________NAVI_R2___________________ XXXXXXX , KC_LCTL , XXXXXXX , XXXXXXX , XXXXXXX +#define _________________NAVI_R3___________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX diff --git a/users/issmirnov/rules.mk b/users/issmirnov/rules.mk new file mode 100644 index 0000000000..096d7b4c0d --- /dev/null +++ b/users/issmirnov/rules.mk @@ -0,0 +1,25 @@ + +SRC += tap_tog.c +SRC += issmirnov.c + +# https://www.reddit.com/r/olkb/comments/bmpgjm/programming_help/ +# Should shave 2000 bytes +LINK_TIME_OPTIMIZATION_ENABLE = yes + +# Enable debugging only when needed. +CONSOLE_ENABLE = yes # +400 bytes (hid_listen support) + +# Enable combo keys for vim usage. +# https://github.com/qmk/qmk_firmware/blob/master/docs/feature_combo.md +COMBO_ENABLE = yes + +# This allows the keyboard to tell the host OS that up to 248 keys are held down at once +NKRO_ENABLE = no # note: also needs FORCE_NKRO in config.h + +# Disable unused features to save on space +# https://thomasbaart.nl/2018/12/01/reducing-firmware-size-in-qmk/ +MOUSEKEY_ENABLE = no # 2000 bytes +BOOTMAGIC_ENABLE = no +COMMAND_ENABLE = no # https://beta.docs.qmk.fm/features/feature_command +UNICODE_ENABLE = no # Unicode +SWAP_HANDS_ENABLE = no # Allow swapping hands of keyboard diff --git a/users/issmirnov/tap_tog.c b/users/issmirnov/tap_tog.c new file mode 100644 index 0000000000..02cea08b1d --- /dev/null +++ b/users/issmirnov/tap_tog.c @@ -0,0 +1,52 @@ +#include QMK_KEYBOARD_H + +#include "tap_tog.h" + +bool tap_tog_layer_other_key_pressed = false; +bool tap_tog_layer_toggled_on = false; +uint8_t tap_tog_count = 0; + +void process_tap_tog(uint8_t layer, keyrecord_t *record) { + tap_tog_count++; + // press + if (record->event.pressed) { + + // TTL has already been pressed and we are toggled into that layer + // so now we need to leave + if(tap_tog_layer_toggled_on) { + layer_clear(); + tap_tog_layer_toggled_on = false; + } + + // this means we're in our default layer + // so switch the layer immediately + // whether we'll switch back when it's released depends on if a button gets pressed while this is held down + else { + // switch layer + layer_on(layer); + tap_tog_layer_other_key_pressed = false; // if this becomes true before it gets released, it will act as a held modifier + } + } + + // release + else { + // if it was used as a held modifier (like traditional shift) + if(tap_tog_layer_other_key_pressed) { + // switch layer back + layer_clear(); + } + // if it was used as a toggle button + else { + // next time, it will turn layer off + tap_tog_layer_toggled_on = true; + + // If it's been tapped twice, reset the toggle flag. + // Otherwise, we get stuck oscillating between this code block and the + // pressed && TTL_toggled_on block. + if (tap_tog_count >= 4 ) { + tap_tog_count = 0; + tap_tog_layer_toggled_on = false; + } + } + } +} diff --git a/users/issmirnov/tap_tog.h b/users/issmirnov/tap_tog.h new file mode 100644 index 0000000000..f59711f043 --- /dev/null +++ b/users/issmirnov/tap_tog.h @@ -0,0 +1,10 @@ +#pragma once + +#include "issmirnov.h" + +extern bool tap_tog_layer_other_key_pressed; // set to true if any key pressed while TAP_TOG_LAYER held down +extern bool tap_tog_layer_toggled_on; // will become true if no keys are pressed while TTL held down +extern uint8_t tap_tog_count; // number of presses on TAP_TOG_LAYER button. + +// Tap dance analog with momentary toggle when held, switch when tapped +void process_tap_tog(uint8_t layer, keyrecord_t *record); diff --git a/users/manna-harbour_miryoku/config.h b/users/manna-harbour_miryoku/config.h index c3c513d063..5ac3208c90 100644 --- a/users/manna-harbour_miryoku/config.h +++ b/users/manna-harbour_miryoku/config.h @@ -1,5 +1,4 @@ - -// generated from users/manna-harbour_miryoku/miryoku.org +// generated from users/manna-harbour_miryoku/miryoku.org -*- buffer-read-only: t -*- #pragma once diff --git a/users/manna-harbour_miryoku/manna-harbour_miryoku.c b/users/manna-harbour_miryoku/manna-harbour_miryoku.c index bb4770afc2..8ae38c25c8 100644 --- a/users/manna-harbour_miryoku/manna-harbour_miryoku.c +++ b/users/manna-harbour_miryoku/manna-harbour_miryoku.c @@ -1,12 +1,18 @@ - -// generated from users/manna-harbour_miryoku/miryoku.org +// generated from users/manna-harbour_miryoku/miryoku.org -*- buffer-read-only: t -*- #include QMK_KEYBOARD_H #define KC_NP KC_NO // key is not present #define KC_NA KC_NO // present but not available for use #define KC_NU KC_NO // available but not used + +// non-KC_ keycodes #define KC_RST RESET +#define KC_TOG RGB_TOG +#define KC_MOD RGB_MOD +#define KC_HUI RGB_HUI +#define KC_SAI RGB_SAI +#define KC_VAI RGB_VAI enum layers { BASE, MEDR, NAVR, MOUR, NSSL, NSL, FUNL }; @@ -14,43 +20,43 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [BASE] = LAYOUT_miryoku( KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_M, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, + KC_Z, ALGR_T(KC_X), KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, ALGR_T(KC_DOT), KC_SLSH, KC_NP, KC_NP, LT(MEDR, KC_ESC), LT(NAVR, KC_SPC), LT(MOUR, KC_TAB), LT(NSSL, KC_ENT), LT(NSL, KC_BSPC), LT(FUNL, KC_DEL), KC_NP, KC_NP ), [NAVR] = LAYOUT_miryoku( KC_RST, KC_NA, KC_NA, KC_NA, KC_NA, KC_AGIN, KC_UNDO, KC_CUT, KC_COPY, KC_PSTE, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, KC_NA, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, - KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, + KC_NA, KC_ALGR, KC_NA, KC_NA, KC_NA, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_NP, KC_NP, KC_NA, KC_NA, KC_NA, KC_ENT, KC_BSPC, KC_DEL, KC_NP, KC_NP ), [MOUR] = LAYOUT_miryoku( KC_RST, KC_NA, KC_NA, KC_NA, KC_NA, KC_NU, KC_NU, KC_NU, KC_NU, KC_NU, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, KC_NA, KC_NU, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, - KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, KC_NU, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, + KC_NA, KC_ALGR, KC_NA, KC_NA, KC_NA, KC_NU, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, KC_NP, KC_NP, KC_NA, KC_NA, KC_NA, KC_BTN3, KC_BTN1, KC_BTN2, KC_NP, KC_NP ), [MEDR] = LAYOUT_miryoku( - KC_RST, KC_NA, KC_NA, KC_NA, KC_NA, KC_NU, KC_NU, KC_NU, KC_NU, KC_NU, + KC_RST, KC_NA, KC_NA, KC_NA, KC_NA, KC_TOG, KC_MOD, KC_HUI, KC_SAI, KC_VAI, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, KC_NA, KC_NU, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, - KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, KC_NU, KC_NU, KC_NU, KC_NU, KC_NU, + KC_NA, KC_ALGR, KC_NA, KC_NA, KC_NA, KC_NU, KC_NU, KC_NU, KC_NU, KC_NU, KC_NP, KC_NP, KC_NA, KC_NA, KC_NA, KC_MSTP, KC_MPLY, KC_MUTE, KC_NP, KC_NP ), [FUNL] = LAYOUT_miryoku( KC_F12, KC_F7, KC_F8, KC_F9, KC_PSCR, KC_NA, KC_NA, KC_NA, KC_NA, KC_RST, KC_F11, KC_F4, KC_F5, KC_F6, KC_SLCK, KC_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - KC_F10, KC_F1, KC_F2, KC_F3, KC_PAUS, KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, + KC_F10, KC_F1, KC_F2, KC_F3, KC_PAUS, KC_NA, KC_NA, KC_NA, KC_ALGR, KC_NA, KC_NP, KC_NP, KC_APP, KC_SPC, KC_TAB, KC_NA, KC_NA, KC_NA, KC_NP, KC_NP ), [NSL] = LAYOUT_miryoku( KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, KC_NA, KC_NA, KC_NA, KC_NA, KC_RST, KC_SCLN, KC_4, KC_5, KC_6, KC_EQL, KC_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - KC_GRV, KC_1, KC_2, KC_3, KC_BSLS, KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, + KC_GRV, KC_1, KC_2, KC_3, KC_BSLS, KC_NA, KC_NA, KC_NA, KC_ALGR, KC_NA, KC_NP, KC_NP, KC_DOT, KC_0, KC_MINS, KC_NA, KC_NA, KC_NA, KC_NP, KC_NP ), [NSSL] = LAYOUT_miryoku( KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, KC_NA, KC_NA, KC_NA, KC_NA, KC_RST, KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS, KC_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, KC_NA, KC_NA, KC_NA, KC_ALGR, KC_NA, KC_NP, KC_NP, KC_GT, KC_RPRN, KC_UNDS, KC_NA, KC_NA, KC_NA, KC_NP, KC_NP ) }; diff --git a/users/manna-harbour_miryoku/miryoku.org b/users/manna-harbour_miryoku/miryoku.org index 556f95f60e..692321d01e 100644 --- a/users/manna-harbour_miryoku/miryoku.org +++ b/users/manna-harbour_miryoku/miryoku.org @@ -1,18 +1,23 @@ #+Title: miryoku.org +[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/kle-miryoku-keycodes.png]] + The miryoku layout is an ergonomic, minimal, orthogonal layout for ergo or ortho keyboards, implemented as part of the QMK firmware. The layout is maintained in emacs org-mode tables and converted to QMK keymap data structures using embedded python scripts. The layout is mapped onto keyboards with different physical -layouts as a subset without code duplication using the QMK userland feature and +layouts as a subset without code duplication using the QMK userspace feature and C macros. Versions of the layout can also be seen outside of the QMK source at [[https://github.com/manna-harbour/miryoku/]]. +After making changes here call org-babel-tangle (C-c C-v t). + * Contents - [[#layout][Layout]] - [[#code-generation][Code Generation]] - [[#subset-mapping][Subset Mapping]] +- [[#related-documentation][Related Documentation]] * Layout @@ -45,6 +50,7 @@ C macros. Versions of the layout can also be seen outside of the QMK source at - Dual-function layer change on thumbs. - Layers are designed orthogonally with a single purpose per hand and are accessed by holding a thumb key on the opposite hand. + - All layers on the same hand are based on the same basic key arrangement. - Holding layer change and modifiers on one hand combined with a single key press on the other hand can produce any combination of modifiers and single keys without any finger contortions. @@ -53,9 +59,10 @@ C macros. Versions of the layout can also be seen outside of the QMK source at or simultaneously without race conditions. - As mods are only enabled on the opposite hand, auto-repeat is available on the home row on layers for use with cursor and mouse keys. - - Tap-hold auto-repeat is disabled to enable faster tap-hold switching on - thumbs but thumb tap keys are mirrored onto some layers for use with - auto-repeat. + - Tap-hold auto-repeat is disabled to permit faster tap-hold switching on + thumbs, but thumb tap keys are mirrored onto some layers for use with + auto-repeat. On other layers thumb keys are redefined with important + functions for that layer. ** Layers @@ -92,7 +99,7 @@ included for prose, dot and slash for file and directory names. #+NAME: hold | RST | | | | | | | | | RST | | LGUI | LALT | LCTL | LSFT | | | LSFT | LCTL | LALT | LGUI | -| | | | | | | | | | | +| | ALGR | | | | | | | ALGR | | | NP | NP | MEDR | NAVR | MOUR | NSSL | NSL | FUNL | NP | NP | @@ -127,11 +134,12 @@ the home position. Unused keys are available for other related functions. *** Media (MEDR) Tertiary RH layer is media control, with volume up / down and next / prev -mirroring the navigation keys. Pause, stop and mute are on thumbs. Unused keys -are available for other related functions. +mirroring the navigation keys. Pause, stop and mute are on thumbs. RGB control +is on the top row (combine with shift to invert). Unused keys are available for +other related functions. #+NAME: medr -| | | | | | +| TOG | MOD | HUI | SAI | VAI | | | MPRV | VOLD | VOLU | MNXT | | | | | | | | MSTP | MPLY | MUTE | NP | NP | @@ -365,7 +373,7 @@ Modifiers usable in hold table. Need to have the same name for KC_ and _T versi - LCTL - LALT - LGUI -- LAGR +- ALGR ** Other @@ -376,7 +384,7 @@ Header for tangled src files. #+NAME: header #+BEGIN_SRC C :tangle no -generated from users/manna-harbour_miryoku/miryoku.org +generated from users/manna-harbour_miryoku/miryoku.org -*- buffer-read-only: t -*- #+END_SRC @@ -397,8 +405,7 @@ bottom row unused and the rest of the bottom row are the thumb keys. Contains the keymap. Included from keymap.c [[./manna-harbour_miryoku.c][users/manna-harbour_miryoku/manna-harbour_miryoku.c]] -#+BEGIN_SRC C :noweb yes :tangle manna-harbour_miryoku.c - +#+BEGIN_SRC C :noweb yes :padline no :tangle manna-harbour_miryoku.c // <<header>> #include QMK_KEYBOARD_H @@ -406,7 +413,14 @@ Contains the keymap. Included from keymap.c #define KC_NP KC_NO // key is not present #define KC_NA KC_NO // present but not available for use #define KC_NU KC_NO // available but not used + +// non-KC_ keycodes #define KC_RST RESET +#define KC_TOG RGB_TOG +#define KC_MOD RGB_MOD +#define KC_HUI RGB_HUI +#define KC_SAI RGB_SAI +#define KC_VAI RGB_VAI <<table-enums()>> @@ -427,8 +441,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { Config options. Automatically included. [[./config.h][users/manna-harbour_miryoku/config.h]] -#+BEGIN_SRC C :noweb yes :tangle config.h - +#+BEGIN_SRC C :noweb yes :padline no :tangle config.h // <<header>> #pragma once @@ -450,12 +463,12 @@ Config options. Automatically included. Build options. Automatically included. [[./rules.mk][users/manna-harbour_miryoku/rules.mk]] -#+BEGIN_SRC makefile :noweb yes :tangle rules.mk - +#+BEGIN_SRC makefile :noweb yes :padline no :tangle rules.mk # <<header>> MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +EXTRAFLAGS += -flto # Link Time Optimization to reduce code size, 31358->28034/28672 #+END_SRC @@ -474,8 +487,7 @@ thumb key is the innermost key of the partial bottom row. The remaining keys are unused. [[../../layouts/community/ergodox/manna-harbour_miryoku/keymap.c][layouts/community/ergodox/manna-harbour_miryoku/keymap.c]] -#+BEGIN_SRC C :noweb yes :tangle ../../layouts/community/ergodox/manna-harbour_miryoku/keymap.c - +#+BEGIN_SRC C :noweb yes :padline no :tangle ../../layouts/community/ergodox/manna-harbour_miryoku/keymap.c // <<header>> #define LAYOUT_miryoku(\ @@ -512,12 +524,12 @@ cd ../.. && make ergodox_ez:manna-harbour_miryoku:teensy For the ortho_4x12 layout, the right half as is as follows: The rightmost column bottom 3 rows is the pinkie column. The middle 4 columns top 3 rows are for the -remaining fingers. The bottom row left 3 columns are the thumb keys. The -remaining keys are unused. +remaining fingers. The pinkie column is one row lower than the other columns to +provide some column stagger on ortho keyboards. The bottom row left 3 columns +are the thumb keys. The remaining keys are unused. [[../../layouts/community/ortho_4x12/manna-harbour_miryoku/keymap.c][layouts/community/ortho_4x12/manna-harbour_miryoku/keymap.c]] -#+BEGIN_SRC C :noweb yes :tangle ../../layouts/community/ortho_4x12/manna-harbour_miryoku/keymap.c - +#+BEGIN_SRC C :noweb yes :padline no :tangle ../../layouts/community/ortho_4x12/manna-harbour_miryoku/keymap.c // <<header>> #define LAYOUT_miryoku(\ @@ -553,14 +565,14 @@ To use the keymap on a keyboard which does not support the layouts feature, LAYOUT_miryoku is defined as a macro mapping onto the keyboard's own LAYOUT macro, leaving the unused keys as KC_NO. The userspace keymap is then included. - *** crkbd The outer columns are unused. -[[../../keyboards/crkbd/keymaps/manna-harbour_miryoku/keymap.c][keyboards/crkbd/keymaps/manna-harbour_miryoku/keymap.c]] -#+BEGIN_SRC C :noweb yes :tangle ../../keyboards/crkbd/keymaps/manna-harbour_miryoku/keymap.c +**** keymap.c +[[../../keyboards/crkbd/keymaps/manna-harbour_miryoku/keymap.c][keyboards/crkbd/keymaps/manna-harbour_miryoku/keymap.c]] +#+BEGIN_SRC C :noweb yes :padline no :tangle ../../keyboards/crkbd/keymaps/manna-harbour_miryoku/keymap.c // <<header>> #define LAYOUT_miryoku( \ @@ -578,16 +590,100 @@ KC_NO, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, KC_ #include "manna-harbour_miryoku.c" + +#ifdef SSD1306OLED + +#include "ssd1306.h" + +void matrix_init_user(void) { + iota_gfx_init(!has_usb()); // turns on the display +} + +// When add source files to SRC in rules.mk, you can use functions. +const char *read_logo(void); + +void matrix_scan_user(void) { + iota_gfx_task(); +} + +void matrix_render_user(struct CharacterMatrix *matrix) { + if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { + matrix_write(matrix, read_logo()); + } +} + +void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +void iota_gfx_task_user(void) { + struct CharacterMatrix matrix; + matrix_clear(&matrix); + matrix_render_user(&matrix); + matrix_update(&display, &matrix); +} + +#endif //SSD1306OLED + #+END_SRC + +**** config.h + +[[../../keyboards/crkbd/keymaps/manna-harbour_miryoku/config.h][keyboards/crkbd/keymaps/manna-harbour_miryoku/config.h]] +#+BEGIN_SRC C :noweb yes :padline no :tangle ../../keyboards/crkbd/keymaps/manna-harbour_miryoku/config.h +// <<header>> + +#pragma once + +#define EE_HANDS + +#ifdef RGB_MATRIX_ENABLE +#define RGB_MATRIX_KEYPRESSES // reacts to keypresses +#define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash. +#define RGB_MATRIX_HUE_STEP 8 +#define RGB_MATRIX_SAT_STEP 8 +#define RGB_MATRIX_VAL_STEP 8 +#define RGB_MATRIX_SPD_STEP 10 +#endif + +#define SSD1306OLED // old oled driver + +#+END_SRC + + +**** rules.mk + +[[../../keyboards/crkbd/keymaps/manna-harbour_miryoku/rules.mk][keyboards/crkbd/keymaps/manna-harbour_miryoku/rules.mk]] +#+BEGIN_SRC C :noweb yes :padline no :tangle ../../keyboards/crkbd/keymaps/manna-harbour_miryoku/rules.mk +# <<header>> + +RGB_MATRIX_ENABLE = WS2812 + +# old oled driver +SRC += ./lib/glcdfont.c \ + ./lib/logo_reader.c + +#+END_SRC + + To build for this keyboard, #+BEGIN_SRC sh :tangle no -cd ../.. && make crkbd:manna-harbour_miryoku:avrdude +cd ../.. && make crkbd:manna-harbour_miryoku:flash #+END_SRC * Related Documentation +:PROPERTIES: +:CUSTOM_ID: related-documentation +:END: + ** QMK diff --git a/users/manna-harbour_miryoku/rules.mk b/users/manna-harbour_miryoku/rules.mk index baff1431f0..a54616b47a 100644 --- a/users/manna-harbour_miryoku/rules.mk +++ b/users/manna-harbour_miryoku/rules.mk @@ -1,5 +1,5 @@ - -# generated from users/manna-harbour_miryoku/miryoku.org +# generated from users/manna-harbour_miryoku/miryoku.org -*- buffer-read-only: t -*- MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +LTO_ENABLE = yes diff --git a/users/stanrc85/stanrc85.c b/users/stanrc85/stanrc85.c index e3da6d6466..6ea0e33bc1 100644 --- a/users/stanrc85/stanrc85.c +++ b/users/stanrc85/stanrc85.c @@ -56,26 +56,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { uint8_t mods = get_mods(); clear_mods(); - send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), 10); + send_string_with_delay_P(PSTR("qmk compile -kb " QMK_KEYBOARD " -km " QMK_KEYMAP "\n"), 10); //New way if (mods & MOD_MASK_SHIFT) { - //RESET board for flashing if SHIFT held or tapped with KC_MAKE - #if defined(__arm__) - send_string_with_delay_P(PSTR(":dfu-util"), 10); - #elif defined(BOOTLOADER_DFU) - send_string_with_delay_P(PSTR(":dfu"), 10); - #elif defined(BOOTLOADER_HALFKAY) - send_string_with_delay_P(PSTR(":teensy"), 10); - #elif defined(BOOTLOADER_CATERINA) - send_string_with_delay_P(PSTR(":avrdude"), 10); - #endif // bootloader options - send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), 10); + send_string(SS_LGUI()); + send_string("qmk toolbox\n"); reset_keyboard(); } - if (mods & MOD_MASK_CTRL) { - send_string_with_delay_P(PSTR(" -j8 --output-sync"), 10); - } - send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), 10); - set_mods(mods); + set_mods(mods); } break; case KC_RDP: //Opens Windows RDP diff --git a/users/twschum/config.h b/users/twschum/config.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/users/twschum/config.h diff --git a/users/twschum/readme.md b/users/twschum/readme.md new file mode 100644 index 0000000000..b354e4b79c --- /dev/null +++ b/users/twschum/readme.md @@ -0,0 +1,14 @@ +Copyright 2019 Tim Schumacher <twschum@gmail.com> @twschum + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. diff --git a/users/twschum/rules.mk b/users/twschum/rules.mk new file mode 100644 index 0000000000..9878e6f690 --- /dev/null +++ b/users/twschum/rules.mk @@ -0,0 +1,5 @@ +SRC += twschum.c +SRC += xtonhasvim.c +ifeq ($(strip $(FLASH_BOOTLOADER)), yes) + OPT_DEFS += -DFLASH_BOOTLOADER +endif diff --git a/users/twschum/twschum.c b/users/twschum/twschum.c new file mode 100644 index 0000000000..2d34f95718 --- /dev/null +++ b/users/twschum/twschum.c @@ -0,0 +1,257 @@ +#include "twschum.h" + +#ifdef TWSCHUM_TAPPING_CTRL_PREFIX +// state for the great state machine of custom actions! +#define TIMEOUT_DELAY 200 // ms +static uint16_t idle_timer; +static bool timeout_is_active = false; + +static bool ctrl_shortcuts_enabled_g = false; +//static bool B_down = 0; // TODO just use top bit from count +//static int8_t B_count = 0; + +#define N_TAPPING_CTRL_KEYS 2 +static struct Tapping_ctrl_key_t special_keys_g[N_TAPPING_CTRL_KEYS] = { + {false, 0, KC_B}, {false, 0, KC_A} +}; + +static inline void start_idle_timer(void) { + idle_timer = timer_read(); + timeout_is_active = true; +} +static inline void clear_state_after_idle_timeout(void) { + idle_timer = 0; + timeout_is_active = false; + + // send timed out plain keys from tapping ctrl mod + for (int i = 0; i < N_TAPPING_CTRL_KEYS; ++i) { + struct Tapping_ctrl_key_t* key = special_keys_g + i; + repeat_send_keys(key->count, key->keycode); + key->count = 0; + } +} + +inline void matrix_scan_user(void) { + if (timeout_is_active && timer_elapsed(idle_timer) > TIMEOUT_DELAY) { + clear_state_after_idle_timeout(); + } +} + +static inline bool tap_ctrl_event(struct Tapping_ctrl_key_t* key, keyrecord_t* record) { + if (!ctrl_shortcuts_enabled_g) { + // normal operation, just send the plain keycode + if (record->event.pressed) { + register_code(key->keycode); + } + else { + unregister_code(key->keycode); + } + return false; + } + key->down = record->event.pressed; + // increment count and reset timer when key pressed + // start the timeout when released + if (key->down) { + ++(key->count); + timeout_is_active = false; + idle_timer = 0; + } + else { + if (key->count) { + start_idle_timer(); + } + } + return false; +} + +static inline bool tap_ctrl_other_pressed(void) { + for (int i = 0; i < N_TAPPING_CTRL_KEYS; ++i) { + struct Tapping_ctrl_key_t* key = special_keys_g + i; + if (key->count) { + if (key->down) { + // another key has been pressed while the leader key is down, + // so send number of ctrl-KEY combos before the other key + repeat_send_keys(key->count, KC_LCTL, key->keycode); + key->count = 0; + } + else { + // another key pressed after leader key released, + // need to send the plain keycode plus potential mods + if (get_mods() & MOD_MASK_CTRL) { + // make sure to send a shift if prssed + repeat_send_keys(key->count, KC_RSHIFT, key->keycode); + } + else { + repeat_send_keys(key->count, key->keycode); + } + key->count = 0; + } + return true; // will send the other keycode + } + } + return true; // safe default +} +#endif /* TWSCHUM_TAPPING_CTRL_PREFIX */ + + +/* Use RGB underglow to indicate layer + * https://docs.qmk.fm/reference/customizing-functionality + */ +// add to quantum/rgblight_list.h +#ifdef RGBLIGHT_ENABLE +static bool rgb_layers_enabled = true; +static bool rgb_L0_enabled = false; + +layer_state_t layer_state_set_user(layer_state_t state) { + if (!rgb_layers_enabled) { + return state; + } + switch (get_highest_layer(state)) { + case _Base: + if (rgb_L0_enabled) { + rgblight_sethsv_noeeprom(_Base_HSV_ON); + } + else { + rgblight_sethsv_noeeprom(_Base_HSV_OFF); + } + break; + case _Vim: + rgblight_sethsv_noeeprom(_Vim_HSV); + break; + case _Fn: + rgblight_sethsv_noeeprom(_Fn_HSV); + break; + case _Nav: + rgblight_sethsv_noeeprom(_Nav_HSV); + break; + case _Num: + rgblight_sethsv_noeeprom(_Num_HSV); + break; + case _Cfg: + rgblight_sethsv_noeeprom(_Cfg_HSV); + break; + case _None: + rgblight_sethsv_noeeprom(_None_HSV); + break; + } + return state; +} +#endif /* RGBLIGHT_ENABLE */ + +/* process_record_vimlayer: handles the VIM_ keycodes from xtonhasvim's vim + * emulation layer + * add process_record_keymap to allow specific keymap to still add keys + * Makes the callstack look like: + * process_record_ + * _quantum + * _kb + * _user + * _keymap + * _vimlayer + */ +__attribute__ ((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} + +/* Return True to continue processing keycode, false to stop further processing + * process_record_keymap to be call by process_record_user in the vim addon */ +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + + /* keymap gets first whack, then vimlayer */ + if(!process_record_keymap(keycode, record)) return false; + if(!process_record_vimlayer(keycode, record)) return false; + + switch (keycode) { + /* KC_MAKE is a keycode to be used with any keymap + * Outputs `make <keyboard>:<keymap>` + * 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 + * 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. + */ + case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader + if (!record->event.pressed) { + uint8_t temp_mod = get_mods(); + uint8_t temp_osm = get_oneshot_mods(); + clear_mods(); clear_oneshot_mods(); + SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP); + #ifndef FLASH_BOOTLOADER + if ( (temp_mod | temp_osm) & MOD_MASK_SHIFT ) { + SEND_STRING(":flash"); + } + #endif + if ( (temp_mod | temp_osm) & MOD_MASK_CTRL) { + SEND_STRING(" -j8 --output-sync"); + } + SEND_STRING(SS_TAP(X_ENTER)); + set_mods(temp_mod); + } + break; + + #ifdef RGBLIGHT_ENABLE + case TG_LAYER_RGB: + if (record->event.pressed) { + rgb_layers_enabled = !rgb_layers_enabled; + } + return false; + case TG_L0_RGB: + if (record->event.pressed) { + rgb_L0_enabled = !rgb_L0_enabled; + } + return false; + #endif + + case SALT_CMD: + if (!record->event.pressed) { + SEND_STRING(SALT_CMD_MACRO); + } + return false; + case LESS_PD: + if (!record->event.pressed) { + SEND_STRING(LESS_PD_MACRO); + } + return false; + case CODE_PASTE: + if (!record->event.pressed) { + SEND_STRING(CODE_PASTE_MACRO); + } + return false; + + #ifdef TWSCHUM_TAPPING_CTRL_PREFIX + case EN_CTRL_SHORTCUTS: + if (record->event.pressed) { + ctrl_shortcuts_enabled_g = !ctrl_shortcuts_enabled_g; + start_idle_timer(); // need to clear out state in some cases + } + return false; + case CTRL_A: + return tap_ctrl_event(&special_keys_g[1], record); + case CTRL_B: + return tap_ctrl_event(&special_keys_g[0], record); + default: + if (record->event.pressed) { + return tap_ctrl_other_pressed(); + } + #endif + } + return true; +} + +#ifdef RGBLIGHT_ENABLE +void matrix_init_user(void) { + // called once on board init + rgblight_enable(); +} +#endif + +void suspend_power_down_user(void) { + // TODO shut off backlighting +} + +void suspend_wakeup_init_user(void) { + // TODO turn on backlighting +} diff --git a/users/twschum/twschum.h b/users/twschum/twschum.h new file mode 100644 index 0000000000..e8c9aeffcd --- /dev/null +++ b/users/twschum/twschum.h @@ -0,0 +1,131 @@ +#pragma once +#include <stdarg.h> +#include "quantum.h" +#include "xtonhasvim.h" + +/************************** + * QMK Features Used + ************************** + * RGBLIGHT_ENABLE + * - Adds layer indication via RGB underglow + * - see the `layer_definitions` enum and following _*_HSV #defines + * + * + * + ************************** + * Custom Feature Flags + ************************** + * + * TWSCHUM_TAPPING_CTRL_PREFIX + * - Adds feature that makes sending nested sequences of C-a, C-b[, C-b, ...] + * as simple as C-a b [b ...] + * - Not necessarily super useful outside specialized nested tmux sessions, + * but it was a fun state-machine to build + * + * TWSCHUM_VIM_LAYER + * - Fork of xtonhasvim, adding vim-emulation + * + * TWSCHUM_IS_MAC + * - Flag for handling media keys and other settings between OSX and Win/Unix + * without having to include bootmagic + * + ************************** + * Features Wishlist + ************************** + * use VIM_Q as macro recorder! + * Dynamic macros + * Leader functions + * Uniicode leader commands??? (symbolic unicode) + * Mac mode vs not: -probably bootmagic or use default with dynamic swap out here + * KC_MFFD(KC_MEDIA_FAST_FORWARD) and KC_MRWD(KC_MEDIA_REWIND) instead of KC_MNXT and KC_MPRV + */ + +/* Each layer gets a color, overwritable per keyboard */ +enum layers_definitions { + _Base, + _Vim, + _Fn, + _Nav, + _Num, + _Cfg, + _None, +}; +#ifdef RGBLIGHT_ENABLE +#define _Base_HSV_ON HSV_WHITE +#define _Base_HSV_OFF 0, 0, 0 +#define _Vim_HSV HSV_ORANGE +#define _Fn_HSV HSV_GREEN +#define _Nav_HSV HSV_AZURE +#define _Num_HSV HSV_GOLD +#define _Cfg_HSV HSV_RED +#define _None_HSV HSV_WHITE +#endif + +enum extra_keycodes { + TWSCHUM_START = VIM_SAFE_RANGE, + KC_MAKE, // types the make command for this keyboard +#ifdef TWSCHUM_TAPPING_CTRL_PREFIX + CTRL_A, + CTRL_B, + EN_CTRL_SHORTCUTS, +#endif +#ifdef RGBLIGHT_ENABLE + TG_LAYER_RGB, // Toggle between standard RGB underglow, and RGB underglow to do layer indication + TG_L0_RGB, // Toggle color on or off of layer0 +#endif + SALT_CMD, // macro + LESS_PD, // macro + CODE_PASTE, // macro + KEYMAP_SAFE_RANGE, // range to start for the keymap +}; +#define SALT_CMD_MACRO "sudo salt \\* cmd.run ''"SS_TAP(X_LEFT) +#define LESS_PD_MACRO "sudo less /pipedream/cache/" +// TODO mac vs linux +#define CODE_PASTE_MACRO SS_LSFT("\n")"```"SS_LSFT("\n")SS_LALT("v")SS_LSFT("\n")"```" + + +/* PP_NARG macro returns the number of arguments passed to it. + * https://groups.google.com/forum/#!topic/comp.std.c/d-6Mj5Lko_s + */ +#define PP_NARG(...) PP_NARG_(__VA_ARGS__,PP_RSEQ_N()) +#define PP_NARG_(...) PP_ARG_N(__VA_ARGS__) +#define PP_MAX_ARGS 64 +#define PP_ARG_N( \ + _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \ + _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ + _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \ + _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ + _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \ + _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ + _61,_62,_63,N,...) N +#define PP_RSEQ_N() 63,62,61,60, \ + 59,58,57,56,55,54,53,52,51,50, \ + 49,48,47,46,45,44,43,42,41,40, \ + 39,38,37,36,35,34,33,32,31,30, \ + 29,28,27,26,25,24,23,22,21,20, \ + 19,18,17,16,15,14,13,12,11,10, \ + 9,8,7,6,5,4,3,2,1,0 + +#define send_keys(...) send_n_keys(PP_NARG(__VA_ARGS__), __VA_ARGS__) +static inline void send_n_keys(int n, ...) { + uint8_t i = 0; + uint16_t keycodes[PP_MAX_ARGS]; + va_list keys; + va_start(keys, n); + for (; i < n; ++i) { + keycodes[i] = (uint16_t)va_arg(keys, int); // cast suppresses warning + register_code(keycodes[i]); + } + for (; n > 0; --n) { + unregister_code(keycodes[n-1]); + } + va_end(keys); +} +#define repeat_send_keys(n, ...) {for (int i=0; i < n; ++i) {send_keys(__VA_ARGS__);}} + +/* State functions for nested c-a & c-b leader keystrokes */ +struct Tapping_ctrl_key_t { + bool down; + int8_t count; + const uint16_t keycode; +}; diff --git a/users/twschum/xtonhasvim.c b/users/twschum/xtonhasvim.c new file mode 100644 index 0000000000..a1adf39f04 --- /dev/null +++ b/users/twschum/xtonhasvim.c @@ -0,0 +1,593 @@ + /* Copyright 2015-2017 Christon DeWan * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "xtonhasvim.h" + + +uint16_t vstate = VIM_START; +static bool yank_was_lines = false; +static bool SHIFTED = false; +static uint32_t mod_override_layer_state = 0; +static uint16_t mod_override_triggering_key = 0; + +static void edit(void) { vstate = VIM_START; layer_clear(); } +#define EDIT edit() + + +static void simple_movement(uint16_t keycode) { + switch(keycode) { + case VIM_B: + register_code(KC_LALT); + tap_code16(LSFT(KC_LEFT)); // select to start of this word + unregister_code(KC_LALT); + break; + case VIM_E: + register_code(KC_LALT); + tap_code16(LSFT(KC_RIGHT)); // select to end of this word + unregister_code(KC_LALT); + break; + case VIM_H: + tap_code16(LSFT(KC_LEFT)); + break; + case VIM_J: + tap_code16(LGUI(KC_LEFT)); + tap_code16(LSFT(KC_DOWN)); + tap_code16(LSFT(KC_DOWN)); + break; + case VIM_K: + tap_code16(LGUI(KC_LEFT)); + tap_code(KC_DOWN); + tap_code16(LSFT(KC_UP)); + tap_code16(LSFT(KC_UP)); + break; + case VIM_L: + tap_code16(LSFT(KC_RIGHT)); + break; + case VIM_W: + register_code(KC_LALT); + tap_code16(LSFT(KC_RIGHT)); // select to end of this word + tap_code16(LSFT(KC_RIGHT)); // select to end of next word + tap_code16(LSFT(KC_LEFT)); // select to start of next word + unregister_code(KC_LALT); + break; + } +} + +static void comma_period(uint16_t keycode) { + switch (keycode) { + case VIM_COMMA: + if (SHIFTED) { + // indent + tap_code16(LGUI(KC_LBRACKET)); + } else { + // toggle comment + tap_code16(LGUI(KC_SLASH)); + } + break; + case VIM_PERIOD: + if (SHIFTED) { + // outdent + tap_code16(LGUI(KC_RBRACKET)); + } + break; + } +} + + +bool process_record_vimlayer(uint16_t keycode, keyrecord_t *record) { + + /****** mod passthru *****/ + if(record->event.pressed && layer_state_is(vim_cmd_layer()) && (IS_MOD(keycode) || keycode == LSFT(KC_LALT))) { + mod_override_layer_state = layer_state; + mod_override_triggering_key = keycode; + // TODO: change this to track key location instead + layer_clear(); + return true; // let the event fall through... + } + if(mod_override_layer_state && !record->event.pressed && keycode == mod_override_triggering_key) { + layer_state_set(mod_override_layer_state); + mod_override_layer_state = 0; + mod_override_triggering_key = 0; + return true; + } + + if (VIM_START <= keycode && keycode <= VIM_ESC) { + if(keycode == VIM_SHIFT) { + SHIFTED = record->event.pressed; + return false; + } + + if (record->event.pressed) { + if(keycode == VIM_START) { + // entry from anywhere + layer_on(vim_cmd_layer()); + vstate = VIM_START; + + // reset state + yank_was_lines = false; + SHIFTED = false; + mod_override_layer_state = 0; + mod_override_triggering_key = 0; + + return false; + } + switch(vstate) { + case VIM_START: + switch(keycode){ + /***************************** + * ground state + *****************************/ + case VIM_A: + if(SHIFTED) { + // tap_code16(LGUI(KC_RIGHT)); + tap_code16(LCTL(KC_E)); + } else { + tap_code(KC_RIGHT); + } + EDIT; + break; + case VIM_B: + register_code(KC_LALT); + register_code(KC_LEFT); + break; + case VIM_C: + if(SHIFTED) { + register_code(KC_LSHIFT); + tap_code16(LGUI(KC_RIGHT)); + unregister_code(KC_LSHIFT); + tap_code16(LGUI(KC_X)); + yank_was_lines = false; + EDIT; + } else { + vstate = VIM_C; + } + break; + case VIM_D: + if(SHIFTED) { + tap_code16(LCTL(KC_K)); + } else { + vstate = VIM_D; + } + break; + case VIM_E: + register_code(KC_LALT); + register_code(KC_RIGHT); + break; + case VIM_G: + if(SHIFTED) { + tap_code(KC_END); + } else { + vstate = VIM_G; + } + break; + case VIM_H: + register_code(KC_LEFT); + break; + case VIM_I: + if(SHIFTED){ + tap_code16(LCTL(KC_A)); + } + EDIT; + break; + case VIM_J: + if(SHIFTED) { + tap_code16(LGUI(KC_RIGHT)); + tap_code(KC_DEL); + } else { + register_code(KC_DOWN); + } + break; + case VIM_K: + register_code(KC_UP); + break; + case VIM_L: + register_code(KC_RIGHT); + break; + case VIM_O: + if(SHIFTED) { + tap_code16(LGUI(KC_LEFT)); + tap_code(KC_ENTER); + tap_code(KC_UP); + EDIT; + } else { + tap_code16(LGUI(KC_RIGHT)); + tap_code(KC_ENTER); + EDIT; + } + break; + case VIM_P: + if(SHIFTED) { + tap_code16(LGUI(KC_LEFT)); + tap_code16(LGUI(KC_V)); + } else { + if(yank_was_lines) { + tap_code16(LGUI(KC_RIGHT)); + tap_code(KC_RIGHT); + tap_code16(LGUI(KC_V)); + } else { + tap_code16(LGUI(KC_V)); + } + } + break; + case VIM_S: + // s for substitute? + if(SHIFTED) { + tap_code16(LGUI(KC_LEFT)); + register_code(KC_LSHIFT); + tap_code16(LGUI(KC_RIGHT)); + unregister_code(KC_LSHIFT); + tap_code16(LGUI(KC_X)); + yank_was_lines = false; + EDIT; + } else { + tap_code16(LSFT(KC_RIGHT)); + tap_code16(LGUI(KC_X)); + yank_was_lines = false; + EDIT; + } + break; + case VIM_U: + if(SHIFTED) { + register_code(KC_LSFT); + tap_code16(LGUI(KC_Z)); + unregister_code(KC_LSHIFT); + } else { + tap_code16(LGUI(KC_Z)); + } + break; + case VIM_V: + if(SHIFTED) { + tap_code16(LGUI(KC_LEFT)); + tap_code16(LSFT(KC_DOWN)); + vstate = VIM_VS; + } else { + vstate = VIM_V; + } + break; + case VIM_W: + register_code(KC_LALT); + tap_code(KC_RIGHT); + tap_code(KC_RIGHT); + tap_code(KC_LEFT); + unregister_code(KC_LALT); + break; + case VIM_X: + // tap_code16(LSFT(KC_RIGHT)); + // tap_code16(LGUI(KC_X)); + register_code(KC_DEL); + break; + case VIM_Y: + if(SHIFTED) { + tap_code16(LGUI(KC_LEFT)); + tap_code16(LSFT(KC_DOWN)); + tap_code16(LGUI(KC_C)); + tap_code(KC_RIGHT); + yank_was_lines = true; + } else { + vstate = VIM_Y; + } + break; + case VIM_COMMA: + case VIM_PERIOD: + comma_period(keycode); + break; + } + break; + case VIM_C: + /***************************** + * c- ...for change. I never use this... + *****************************/ + switch(keycode) { + case VIM_B: + case VIM_E: + case VIM_H: + case VIM_J: + case VIM_K: + case VIM_L: + case VIM_W: + simple_movement(keycode); + tap_code16(LGUI(KC_X)); + yank_was_lines = false; + EDIT; + break; + + case VIM_C: + tap_code16(LGUI(KC_LEFT)); + register_code(KC_LSHIFT); + tap_code16(LGUI(KC_RIGHT)); + unregister_code(KC_LSHIFT); + tap_code16(LGUI(KC_X)); + yank_was_lines = false; + EDIT; + break; + case VIM_I: + vstate = VIM_CI; + break; + default: + vstate = VIM_START; + break; + } + break; + case VIM_CI: + /***************************** + * ci- ...change inner word + *****************************/ + switch(keycode) { + case VIM_W: + tap_code16(LALT(KC_LEFT)); + register_code(KC_LSHIFT); + tap_code16(LALT(KC_RIGHT)); + unregister_code(KC_LSHIFT); + tap_code16(LGUI(KC_X)); + yank_was_lines = false; + EDIT; + default: + vstate = VIM_START; + break; + } + break; + case VIM_D: + /***************************** + * d- ...delete stuff + *****************************/ + switch(keycode) { + case VIM_B: + case VIM_E: + case VIM_H: + case VIM_J: + case VIM_K: + case VIM_L: + case VIM_W: + simple_movement(keycode); + tap_code16(LGUI(KC_X)); + yank_was_lines = false; + vstate = VIM_START; + break; + case VIM_D: + tap_code16(LGUI(KC_LEFT)); + tap_code16(LSFT(KC_DOWN)); + tap_code16(LGUI(KC_X)); + yank_was_lines = true; + vstate = VIM_START; + break; + case VIM_I: + vstate = VIM_DI; + break; + default: + vstate = VIM_START; + break; + } + break; + case VIM_DI: + /***************************** + * ci- ...delete a word... FROM THE INSIDE! + *****************************/ + switch(keycode) { + case VIM_W: + tap_code16(LALT(KC_LEFT)); + register_code(KC_LSHIFT); + tap_code16(LALT(KC_RIGHT)); + unregister_code(KC_LSHIFT); + tap_code16(LGUI(KC_X)); + yank_was_lines = false; + vstate = VIM_START; + default: + vstate = VIM_START; + break; + } + break; + case VIM_V: + /***************************** + * visual! + *****************************/ + switch(keycode) { + case VIM_D: + case VIM_X: + tap_code16(LGUI(KC_X)); + yank_was_lines = false; + vstate = VIM_START; + break; + case VIM_B: + register_code(KC_LALT); + register_code(KC_LSHIFT); + register_code(KC_LEFT); + // leave open for key repeat + break; + case VIM_E: + register_code(KC_LALT); + register_code(KC_LSHIFT); + register_code(KC_RIGHT); + // leave open for key repeat + break; + case VIM_H: + register_code(KC_LSHIFT); + register_code(KC_LEFT); + break; + case VIM_I: + vstate = VIM_VI; + break; + case VIM_J: + register_code(KC_LSHIFT); + register_code(KC_DOWN); + break; + case VIM_K: + register_code(KC_LSHIFT); + register_code(KC_UP); + break; + case VIM_L: + register_code(KC_LSHIFT); + register_code(KC_RIGHT); + break; + case VIM_W: + register_code(KC_LALT); + tap_code16(LSFT(KC_RIGHT)); // select to end of this word + tap_code16(LSFT(KC_RIGHT)); // select to end of next word + tap_code16(LSFT(KC_LEFT)); // select to start of next word + unregister_code(KC_LALT); + break; + case VIM_P: + tap_code16(LGUI(KC_V)); + vstate = VIM_START; + break; + case VIM_Y: + tap_code16(LGUI(KC_C)); + tap_code(KC_RIGHT); + yank_was_lines = false; + vstate = VIM_START; + break; + case VIM_V: + case VIM_ESC: + tap_code(KC_RIGHT); + vstate = VIM_START; + break; + case VIM_COMMA: + case VIM_PERIOD: + comma_period(keycode); + break; + default: + // do nothing + break; + } + break; + case VIM_VI: + /***************************** + * vi- ...select a word... FROM THE INSIDE! + *****************************/ + switch(keycode) { + case VIM_W: + tap_code16(LALT(KC_LEFT)); + register_code(KC_LSHIFT); + tap_code16(LALT(KC_RIGHT)); + unregister_code(KC_LSHIFT); + vstate = VIM_V; + default: + // ignore + vstate = VIM_V; + break; + } + break; + case VIM_VS: + /***************************** + * visual line + *****************************/ + switch(keycode) { + case VIM_D: + case VIM_X: + tap_code16(LGUI(KC_X)); + yank_was_lines = true; + vstate = VIM_START; + break; + case VIM_J: + register_code(KC_LSHIFT); + register_code(KC_DOWN); + break; + case VIM_K: + register_code(KC_LSHIFT); + register_code(KC_UP); + break; + case VIM_Y: + tap_code16(LGUI(KC_C)); + yank_was_lines = true; + tap_code(KC_RIGHT); + vstate = VIM_START; + break; + case VIM_P: + tap_code16(LGUI(KC_V)); + vstate = VIM_START; + break; + case VIM_V: + case VIM_ESC: + tap_code(KC_RIGHT); + vstate = VIM_START; + break; + case VIM_COMMA: + case VIM_PERIOD: + comma_period(keycode); + break; + default: + // do nothing + break; + } + break; + case VIM_G: + /***************************** + * gg, and a grab-bag of other macros i find useful + *****************************/ + switch(keycode) { + case VIM_G: + tap_code(KC_HOME); + break; + // codes b + case VIM_H: + tap_code16(LCTL(KC_A)); + break; + case VIM_J: + register_code(KC_PGDN); + break; + case VIM_K: + register_code(KC_PGUP); + break; + case VIM_L: + tap_code16(LCTL(KC_E)); + break; + default: + // do nothing + break; + } + vstate = VIM_START; + break; + case VIM_Y: + /***************************** + * yoink! + *****************************/ + switch(keycode) { + case VIM_B: + case VIM_E: + case VIM_H: + case VIM_J: + case VIM_K: + case VIM_L: + case VIM_W: + simple_movement(keycode); + tap_code16(LGUI(KC_C)); + tap_code(KC_RIGHT); + yank_was_lines = false; + break; + case VIM_Y: + tap_code16(LGUI(KC_LEFT)); + tap_code16(LSFT(KC_DOWN)); + tap_code16(LGUI(KC_C)); + tap_code(KC_RIGHT); + yank_was_lines = true; + break; + default: + // NOTHING + break; + } + vstate = VIM_START; + break; + } + } else { + /************************ + * key unregister_code events + ************************/ + clear_keyboard(); + } + return false; + } else { + return true; + } +} + diff --git a/users/twschum/xtonhasvim.h b/users/twschum/xtonhasvim.h new file mode 100644 index 0000000000..fd9ebd4f03 --- /dev/null +++ b/users/twschum/xtonhasvim.h @@ -0,0 +1,62 @@ + /* Copyright 2015-2017 Christon DeWan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef USERSPACE +#define USERSPACE + +#include QMK_KEYBOARD_H + +enum xtonhasvim_keycodes { + VIM_START = SAFE_RANGE, // bookend for vim states + VIM_A, + VIM_B, + VIM_C, + VIM_CI, + VIM_D, + VIM_DI, + VIM_E, + VIM_H, + VIM_G, + VIM_I, + VIM_J, + VIM_K, + VIM_L, + VIM_O, + VIM_P, + VIM_S, + VIM_U, + VIM_V, + VIM_VS, // visual-line + VIM_VI, + VIM_W, + VIM_X, + VIM_Y, + VIM_PERIOD, // to support indent/outdent + VIM_COMMA, // and toggle comments + VIM_SHIFT, // avoid side-effect of supporting real shift. + VIM_ESC, // bookend + VIM_SAFE_RANGE // start other keycodes here. +}; + +bool process_record_vimlayer(uint16_t keycode, keyrecord_t *record); + +// NOTE: Define this in keymap.c to return vim layer +extern uint8_t vim_cmd_layer(void); + +extern uint16_t vstate; + + +#endif diff --git a/users/xulkal/custom_rgb.h b/users/xulkal/custom_rgb.h index f19dd223c2..10010b5242 100644 --- a/users/xulkal/custom_rgb.h +++ b/users/xulkal/custom_rgb.h @@ -1,9 +1,12 @@ #pragma once #if defined(RGB_MATRIX_ENABLE) -#include "rgb_matrix.h" +# include "rgb_matrix.h" #elif defined(RGBLIGHT_ENABLE) -#include "rgblight.h" +# if !defined(__AVR__) +# define PROGMEM +# endif +# include "rgblight.h" #endif #ifdef RGB_MATRIX_ENABLE |