diff options
| author | Drashna Jaelre <drashna@live.com> | 2019-11-20 12:37:24 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-20 12:37:24 -0800 |
| commit | eb91c962886b1bb52c2d457a574cba09e2a8b0f0 (patch) | |
| tree | 20f3d49671b6d42ca1edf285431e3e4120551228 /users/drashna/drashna.c | |
| parent | 8e8986b2506ca4cdd2339a441314a0838e3a4329 (diff) | |
| download | qmk_firmware-eb91c962886b1bb52c2d457a574cba09e2a8b0f0.tar.gz qmk_firmware-eb91c962886b1bb52c2d457a574cba09e2a8b0f0.zip | |
[Keymap] All about (ARM) RGB and OLEDs (drashna keymaps) (#7354)
* Add Kyria Keymap
* Enable all RGBLIGHT Animations for ARM and high capacity AVR
* Reduce GNUC version for __has_include
* Cleanup Ortho 4x12 Community layout
* Update Collide 39 keymap
* Cleanup Keymaps
* Enable full 30 LEDs for Ergodox
* Change EEPROM Load timing
* Use RGB Matrix on Planck Rev6
* Use correct keymap swap
* Enable everything for ARM
* Only enable rgb sleep on avr until crash is fixed
* Add additional Kyria keymap config
* Overhaul Kyria OLED display
* Improve kyria keymap based on usage
* Minor tweaks to rules
* Update OLED code to truncate properly
* Fix RGB Light layer indication
* Switch all of biton32 to get_highest_layer function
* Fix OLED Keylogger display
* Run qmk cformat over all of my user files
* Slight tweak to kyria based on usage
* Move around LALT_T config
* Add comments about base wrappers to keymaps
* Another cformat pass
* Temp fix for VUSB boards and NKRO
* Convert tabs to spaces in rules.mk files
* Only enable RGBLight if it's enabled
* Add Encoder Flip setting
* Update OLED font file
Diffstat (limited to 'users/drashna/drashna.c')
| -rw-r--r-- | users/drashna/drashna.c | 60 |
1 files changed, 23 insertions, 37 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index b48d837d0..71779a621 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c | |||
| @@ -25,8 +25,6 @@ userspace_config_t userspace_config; | |||
| 25 | # define DRASHNA_UNICODE_MODE 2 | 25 | # define DRASHNA_UNICODE_MODE 2 |
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | |||
| 29 | |||
| 30 | bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) { | 28 | bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) { |
| 31 | static uint16_t this_timer; | 29 | static uint16_t this_timer; |
| 32 | if (pressed) { | 30 | if (pressed) { |
| @@ -73,19 +71,22 @@ void bootmagic_lite(void) { | |||
| 73 | } | 71 | } |
| 74 | } | 72 | } |
| 75 | 73 | ||
| 74 | __attribute__((weak)) void keyboard_pre_init_keymap(void) {} | ||
| 75 | |||
| 76 | void keyboard_pre_init_user(void) { | ||
| 77 | userspace_config.raw = eeconfig_read_user(); | ||
| 78 | keyboard_pre_init_keymap(); | ||
| 79 | } | ||
| 76 | // Add reconfigurable functions here, for keymap customization | 80 | // Add reconfigurable functions here, for keymap customization |
| 77 | // This allows for a global, userspace functions, and continued | 81 | // This allows for a global, userspace functions, and continued |
| 78 | // customization of the keymap. Use _keymap instead of _user | 82 | // customization of the keymap. Use _keymap instead of _user |
| 79 | // functions in the keymaps | 83 | // functions in the keymaps |
| 80 | __attribute__((weak)) | 84 | __attribute__((weak)) void matrix_init_keymap(void) {} |
| 81 | void matrix_init_keymap(void) {} | ||
| 82 | 85 | ||
| 83 | // Call user matrix init, set default RGB colors and then | 86 | // Call user matrix init, set default RGB colors and then |
| 84 | // call the keymap's init function | 87 | // call the keymap's init function |
| 85 | void matrix_init_user(void) { | 88 | void matrix_init_user(void) { |
| 86 | userspace_config.raw = eeconfig_read_user(); | 89 | #if defined(BOOTLOADER_CATERINA) && defined(__AVR__) |
| 87 | |||
| 88 | #ifdef BOOTLOADER_CATERINA | ||
| 89 | DDRD &= ~(1 << 5); | 90 | DDRD &= ~(1 << 5); |
| 90 | PORTD &= ~(1 << 5); | 91 | PORTD &= ~(1 << 5); |
| 91 | 92 | ||
| @@ -100,8 +101,7 @@ void matrix_init_user(void) { | |||
| 100 | matrix_init_keymap(); | 101 | matrix_init_keymap(); |
| 101 | } | 102 | } |
| 102 | 103 | ||
| 103 | __attribute__((weak)) | 104 | __attribute__((weak)) void keyboard_post_init_keymap(void) {} |
| 104 | void keyboard_post_init_keymap(void) {} | ||
| 105 | 105 | ||
| 106 | void keyboard_post_init_user(void) { | 106 | void keyboard_post_init_user(void) { |
| 107 | #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) | 107 | #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) |
| @@ -110,10 +110,9 @@ void keyboard_post_init_user(void) { | |||
| 110 | keyboard_post_init_keymap(); | 110 | keyboard_post_init_keymap(); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | __attribute__((weak)) | 113 | __attribute__((weak)) void shutdown_keymap(void) {} |
| 114 | void shutdown_keymap(void) {} | ||
| 115 | 114 | ||
| 116 | void rgb_matrix_update_pwm_buffers(void); | 115 | void rgb_matrix_update_pwm_buffers(void); |
| 117 | 116 | ||
| 118 | void shutdown_user(void) { | 117 | void shutdown_user(void) { |
| 119 | #ifdef RGBLIGHT_ENABLE | 118 | #ifdef RGBLIGHT_ENABLE |
| @@ -122,29 +121,22 @@ void shutdown_user(void) { | |||
| 122 | rgblight_setrgb_red(); | 121 | rgblight_setrgb_red(); |
| 123 | #endif // RGBLIGHT_ENABLE | 122 | #endif // RGBLIGHT_ENABLE |
| 124 | #ifdef RGB_MATRIX_ENABLE | 123 | #ifdef RGB_MATRIX_ENABLE |
| 125 | rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 ); | 124 | rgb_matrix_set_color_all(0xFF, 0x00, 0x00); |
| 126 | rgb_matrix_update_pwm_buffers(); | 125 | rgb_matrix_update_pwm_buffers(); |
| 127 | 126 | ||
| 128 | #endif // RGB_MATRIX_ENABLE | 127 | #endif // RGB_MATRIX_ENABLE |
| 129 | shutdown_keymap(); | 128 | shutdown_keymap(); |
| 130 | } | 129 | } |
| 131 | 130 | ||
| 132 | __attribute__((weak)) | 131 | __attribute__((weak)) void suspend_power_down_keymap(void) {} |
| 133 | void suspend_power_down_keymap(void) {} | ||
| 134 | 132 | ||
| 135 | void suspend_power_down_user(void) { | 133 | void suspend_power_down_user(void) { suspend_power_down_keymap(); } |
| 136 | suspend_power_down_keymap(); | ||
| 137 | } | ||
| 138 | 134 | ||
| 139 | __attribute__((weak)) | 135 | __attribute__((weak)) void suspend_wakeup_init_keymap(void) {} |
| 140 | void suspend_wakeup_init_keymap(void) {} | ||
| 141 | 136 | ||
| 142 | void suspend_wakeup_init_user(void) { | 137 | void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); } |
| 143 | suspend_wakeup_init_keymap(); | ||
| 144 | } | ||
| 145 | 138 | ||
| 146 | __attribute__((weak)) | 139 | __attribute__((weak)) void matrix_scan_keymap(void) {} |
| 147 | void matrix_scan_keymap(void) {} | ||
| 148 | 140 | ||
| 149 | // No global matrix scan code, so just run keymap's matrix | 141 | // No global matrix scan code, so just run keymap's matrix |
| 150 | // scan function | 142 | // scan function |
| @@ -166,8 +158,7 @@ void matrix_scan_user(void) { | |||
| 166 | matrix_scan_keymap(); | 158 | matrix_scan_keymap(); |
| 167 | } | 159 | } |
| 168 | 160 | ||
| 169 | __attribute__((weak)) | 161 | __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } |
| 170 | layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } | ||
| 171 | 162 | ||
| 172 | // on layer change, no matter where the change was initiated | 163 | // on layer change, no matter where the change was initiated |
| 173 | // Then runs keymap's layer change check | 164 | // Then runs keymap's layer change check |
| @@ -179,32 +170,27 @@ layer_state_t layer_state_set_user(layer_state_t state) { | |||
| 179 | return layer_state_set_keymap(state); | 170 | return layer_state_set_keymap(state); |
| 180 | } | 171 | } |
| 181 | 172 | ||
| 182 | __attribute__((weak)) | 173 | __attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; } |
| 183 | layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; } | ||
| 184 | 174 | ||
| 185 | // Runs state check and changes underglow color and animation | 175 | // Runs state check and changes underglow color and animation |
| 186 | layer_state_t default_layer_state_set_user(layer_state_t state) { | 176 | layer_state_t default_layer_state_set_user(layer_state_t state) { |
| 187 | state = default_layer_state_set_keymap(state); | 177 | state = default_layer_state_set_keymap(state); |
| 188 | #if 0 | 178 | #if 0 |
| 189 | #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) | 179 | # if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) |
| 190 | state = default_layer_state_set_rgb(state); | 180 | state = default_layer_state_set_rgb(state); |
| 191 | # endif // RGBLIGHT_ENABLE | 181 | # endif // RGBLIGHT_ENABLE |
| 192 | #endif | 182 | #endif |
| 193 | return state; | 183 | return state; |
| 194 | } | 184 | } |
| 195 | 185 | ||
| 196 | __attribute__((weak)) | 186 | __attribute__((weak)) void led_set_keymap(uint8_t usb_led) {} |
| 197 | void led_set_keymap(uint8_t usb_led) {} | ||
| 198 | 187 | ||
| 199 | // Any custom LED code goes here. | 188 | // Any custom LED code goes here. |
| 200 | // So far, I only have keyboard specific code, | 189 | // So far, I only have keyboard specific code, |
| 201 | // So nothing goes here. | 190 | // So nothing goes here. |
| 202 | void led_set_user(uint8_t usb_led) { | 191 | void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); } |
| 203 | led_set_keymap(usb_led); | ||
| 204 | } | ||
| 205 | 192 | ||
| 206 | __attribute__((weak)) | 193 | __attribute__((weak)) void eeconfig_init_keymap(void) {} |
| 207 | void eeconfig_init_keymap(void) {} | ||
| 208 | 194 | ||
| 209 | void eeconfig_init_user(void) { | 195 | void eeconfig_init_user(void) { |
| 210 | userspace_config.raw = 0; | 196 | userspace_config.raw = 0; |
