You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

342 lines
12 KiB

Update to drashna userspace and keymaps (#3172) * Use string with delay * Add skipped region to ergodox * Add send string config * Use default_layer_state instead of function * Fully generalize keyboards * old iris cleanup * Fix Drashna keymap compile issues By checking to see if secret.c exists before actually trying to add it * Remove unnecessary references * Add 4x12 ortho board * Update userspace readme for secrets * Make RGB more modular * Fix iris keymap, since we don't need the lower left (Function keys) * Fix includes * Add Blanks * Fix Ergodox lower layer * Add suspend commands * Add Maltron Layout * Add additional layouts * Finish adding gamepad to Iris * Tweaks to iris gamepag layer * make gaming layers more friendly * minor gaming layer tweak * Add Carplax * Add modded key timer function * Cleanup and macro documentation * Add QMK DFU info * Add 'old' keymap for 12 LED spare * Update Pro Micro documentation * Disable twinkling so it fits in firmware space * Switch to QMK DFU bootloader, since it's better anyhow * Write default layer state colors to EEPROM Since we are writing to EEPROM anyways, and this way, it sticks on reboot * Fix QMK DFU bootloader options * More updates for QMK DFU support * Use matrix scanning hack for startup_user until #3113 gets merged * Fix indicator light consistency issue * Add/readd ifdefs to indicators * Add/readd alt indicator * Remove RGB Twinkling from Viterbi macro pad * Fix default layer color detection * Fix rebase and detection issues * Cleanup code so it will compile if RGBLIGHT is disabled * Revert vsode settings * Use Pragma Once instead of boilerplate code
5 years ago
Update to drashna userspace and keymaps (#3172) * Use string with delay * Add skipped region to ergodox * Add send string config * Use default_layer_state instead of function * Fully generalize keyboards * old iris cleanup * Fix Drashna keymap compile issues By checking to see if secret.c exists before actually trying to add it * Remove unnecessary references * Add 4x12 ortho board * Update userspace readme for secrets * Make RGB more modular * Fix iris keymap, since we don't need the lower left (Function keys) * Fix includes * Add Blanks * Fix Ergodox lower layer * Add suspend commands * Add Maltron Layout * Add additional layouts * Finish adding gamepad to Iris * Tweaks to iris gamepag layer * make gaming layers more friendly * minor gaming layer tweak * Add Carplax * Add modded key timer function * Cleanup and macro documentation * Add QMK DFU info * Add 'old' keymap for 12 LED spare * Update Pro Micro documentation * Disable twinkling so it fits in firmware space * Switch to QMK DFU bootloader, since it's better anyhow * Write default layer state colors to EEPROM Since we are writing to EEPROM anyways, and this way, it sticks on reboot * Fix QMK DFU bootloader options * More updates for QMK DFU support * Use matrix scanning hack for startup_user until #3113 gets merged * Fix indicator light consistency issue * Add/readd ifdefs to indicators * Add/readd alt indicator * Remove RGB Twinkling from Viterbi macro pad * Fix default layer color detection * Fix rebase and detection issues * Cleanup code so it will compile if RGBLIGHT is disabled * Revert vsode settings * Use Pragma Once instead of boilerplate code
5 years ago
Update to drashna userspace and keymaps (#3172) * Use string with delay * Add skipped region to ergodox * Add send string config * Use default_layer_state instead of function * Fully generalize keyboards * old iris cleanup * Fix Drashna keymap compile issues By checking to see if secret.c exists before actually trying to add it * Remove unnecessary references * Add 4x12 ortho board * Update userspace readme for secrets * Make RGB more modular * Fix iris keymap, since we don't need the lower left (Function keys) * Fix includes * Add Blanks * Fix Ergodox lower layer * Add suspend commands * Add Maltron Layout * Add additional layouts * Finish adding gamepad to Iris * Tweaks to iris gamepag layer * make gaming layers more friendly * minor gaming layer tweak * Add Carplax * Add modded key timer function * Cleanup and macro documentation * Add QMK DFU info * Add 'old' keymap for 12 LED spare * Update Pro Micro documentation * Disable twinkling so it fits in firmware space * Switch to QMK DFU bootloader, since it's better anyhow * Write default layer state colors to EEPROM Since we are writing to EEPROM anyways, and this way, it sticks on reboot * Fix QMK DFU bootloader options * More updates for QMK DFU support * Use matrix scanning hack for startup_user until #3113 gets merged * Fix indicator light consistency issue * Add/readd ifdefs to indicators * Add/readd alt indicator * Remove RGB Twinkling from Viterbi macro pad * Fix default layer color detection * Fix rebase and detection issues * Cleanup code so it will compile if RGBLIGHT is disabled * Revert vsode settings * Use Pragma Once instead of boilerplate code
5 years ago
Update to drashna userspace and keymaps (#3172) * Use string with delay * Add skipped region to ergodox * Add send string config * Use default_layer_state instead of function * Fully generalize keyboards * old iris cleanup * Fix Drashna keymap compile issues By checking to see if secret.c exists before actually trying to add it * Remove unnecessary references * Add 4x12 ortho board * Update userspace readme for secrets * Make RGB more modular * Fix iris keymap, since we don't need the lower left (Function keys) * Fix includes * Add Blanks * Fix Ergodox lower layer * Add suspend commands * Add Maltron Layout * Add additional layouts * Finish adding gamepad to Iris * Tweaks to iris gamepag layer * make gaming layers more friendly * minor gaming layer tweak * Add Carplax * Add modded key timer function * Cleanup and macro documentation * Add QMK DFU info * Add 'old' keymap for 12 LED spare * Update Pro Micro documentation * Disable twinkling so it fits in firmware space * Switch to QMK DFU bootloader, since it's better anyhow * Write default layer state colors to EEPROM Since we are writing to EEPROM anyways, and this way, it sticks on reboot * Fix QMK DFU bootloader options * More updates for QMK DFU support * Use matrix scanning hack for startup_user until #3113 gets merged * Fix indicator light consistency issue * Add/readd ifdefs to indicators * Add/readd alt indicator * Remove RGB Twinkling from Viterbi macro pad * Fix default layer color detection * Fix rebase and detection issues * Cleanup code so it will compile if RGBLIGHT is disabled * Revert vsode settings * Use Pragma Once instead of boilerplate code
5 years ago
Update to drashna userspace and keymaps (#3172) * Use string with delay * Add skipped region to ergodox * Add send string config * Use default_layer_state instead of function * Fully generalize keyboards * old iris cleanup * Fix Drashna keymap compile issues By checking to see if secret.c exists before actually trying to add it * Remove unnecessary references * Add 4x12 ortho board * Update userspace readme for secrets * Make RGB more modular * Fix iris keymap, since we don't need the lower left (Function keys) * Fix includes * Add Blanks * Fix Ergodox lower layer * Add suspend commands * Add Maltron Layout * Add additional layouts * Finish adding gamepad to Iris * Tweaks to iris gamepag layer * make gaming layers more friendly * minor gaming layer tweak * Add Carplax * Add modded key timer function * Cleanup and macro documentation * Add QMK DFU info * Add 'old' keymap for 12 LED spare * Update Pro Micro documentation * Disable twinkling so it fits in firmware space * Switch to QMK DFU bootloader, since it's better anyhow * Write default layer state colors to EEPROM Since we are writing to EEPROM anyways, and this way, it sticks on reboot * Fix QMK DFU bootloader options * More updates for QMK DFU support * Use matrix scanning hack for startup_user until #3113 gets merged * Fix indicator light consistency issue * Add/readd ifdefs to indicators * Add/readd alt indicator * Remove RGB Twinkling from Viterbi macro pad * Fix default layer color detection * Fix rebase and detection issues * Cleanup code so it will compile if RGBLIGHT is disabled * Revert vsode settings * Use Pragma Once instead of boilerplate code
5 years ago
Update to drashna userspace and keymaps (#3172) * Use string with delay * Add skipped region to ergodox * Add send string config * Use default_layer_state instead of function * Fully generalize keyboards * old iris cleanup * Fix Drashna keymap compile issues By checking to see if secret.c exists before actually trying to add it * Remove unnecessary references * Add 4x12 ortho board * Update userspace readme for secrets * Make RGB more modular * Fix iris keymap, since we don't need the lower left (Function keys) * Fix includes * Add Blanks * Fix Ergodox lower layer * Add suspend commands * Add Maltron Layout * Add additional layouts * Finish adding gamepad to Iris * Tweaks to iris gamepag layer * make gaming layers more friendly * minor gaming layer tweak * Add Carplax * Add modded key timer function * Cleanup and macro documentation * Add QMK DFU info * Add 'old' keymap for 12 LED spare * Update Pro Micro documentation * Disable twinkling so it fits in firmware space * Switch to QMK DFU bootloader, since it's better anyhow * Write default layer state colors to EEPROM Since we are writing to EEPROM anyways, and this way, it sticks on reboot * Fix QMK DFU bootloader options * More updates for QMK DFU support * Use matrix scanning hack for startup_user until #3113 gets merged * Fix indicator light consistency issue * Add/readd ifdefs to indicators * Add/readd alt indicator * Remove RGB Twinkling from Viterbi macro pad * Fix default layer color detection * Fix rebase and detection issues * Cleanup code so it will compile if RGBLIGHT is disabled * Revert vsode settings * Use Pragma Once instead of boilerplate code
5 years ago
Update to drashna userspace and keymaps (#3172) * Use string with delay * Add skipped region to ergodox * Add send string config * Use default_layer_state instead of function * Fully generalize keyboards * old iris cleanup * Fix Drashna keymap compile issues By checking to see if secret.c exists before actually trying to add it * Remove unnecessary references * Add 4x12 ortho board * Update userspace readme for secrets * Make RGB more modular * Fix iris keymap, since we don't need the lower left (Function keys) * Fix includes * Add Blanks * Fix Ergodox lower layer * Add suspend commands * Add Maltron Layout * Add additional layouts * Finish adding gamepad to Iris * Tweaks to iris gamepag layer * make gaming layers more friendly * minor gaming layer tweak * Add Carplax * Add modded key timer function * Cleanup and macro documentation * Add QMK DFU info * Add 'old' keymap for 12 LED spare * Update Pro Micro documentation * Disable twinkling so it fits in firmware space * Switch to QMK DFU bootloader, since it's better anyhow * Write default layer state colors to EEPROM Since we are writing to EEPROM anyways, and this way, it sticks on reboot * Fix QMK DFU bootloader options * More updates for QMK DFU support * Use matrix scanning hack for startup_user until #3113 gets merged * Fix indicator light consistency issue * Add/readd ifdefs to indicators * Add/readd alt indicator * Remove RGB Twinkling from Viterbi macro pad * Fix default layer color detection * Fix rebase and detection issues * Cleanup code so it will compile if RGBLIGHT is disabled * Revert vsode settings * Use Pragma Once instead of boilerplate code
5 years ago
Update to drashna userspace and keymaps (#3172) * Use string with delay * Add skipped region to ergodox * Add send string config * Use default_layer_state instead of function * Fully generalize keyboards * old iris cleanup * Fix Drashna keymap compile issues By checking to see if secret.c exists before actually trying to add it * Remove unnecessary references * Add 4x12 ortho board * Update userspace readme for secrets * Make RGB more modular * Fix iris keymap, since we don't need the lower left (Function keys) * Fix includes * Add Blanks * Fix Ergodox lower layer * Add suspend commands * Add Maltron Layout * Add additional layouts * Finish adding gamepad to Iris * Tweaks to iris gamepag layer * make gaming layers more friendly * minor gaming layer tweak * Add Carplax * Add modded key timer function * Cleanup and macro documentation * Add QMK DFU info * Add 'old' keymap for 12 LED spare * Update Pro Micro documentation * Disable twinkling so it fits in firmware space * Switch to QMK DFU bootloader, since it's better anyhow * Write default layer state colors to EEPROM Since we are writing to EEPROM anyways, and this way, it sticks on reboot * Fix QMK DFU bootloader options * More updates for QMK DFU support * Use matrix scanning hack for startup_user until #3113 gets merged * Fix indicator light consistency issue * Add/readd ifdefs to indicators * Add/readd alt indicator * Remove RGB Twinkling from Viterbi macro pad * Fix default layer color detection * Fix rebase and detection issues * Cleanup code so it will compile if RGBLIGHT is disabled * Revert vsode settings * Use Pragma Once instead of boilerplate code
5 years ago
Update to drashna userspace and keymaps (#3172) * Use string with delay * Add skipped region to ergodox * Add send string config * Use default_layer_state instead of function * Fully generalize keyboards * old iris cleanup * Fix Drashna keymap compile issues By checking to see if secret.c exists before actually trying to add it * Remove unnecessary references * Add 4x12 ortho board * Update userspace readme for secrets * Make RGB more modular * Fix iris keymap, since we don't need the lower left (Function keys) * Fix includes * Add Blanks * Fix Ergodox lower layer * Add suspend commands * Add Maltron Layout * Add additional layouts * Finish adding gamepad to Iris * Tweaks to iris gamepag layer * make gaming layers more friendly * minor gaming layer tweak * Add Carplax * Add modded key timer function * Cleanup and macro documentation * Add QMK DFU info * Add 'old' keymap for 12 LED spare * Update Pro Micro documentation * Disable twinkling so it fits in firmware space * Switch to QMK DFU bootloader, since it's better anyhow * Write default layer state colors to EEPROM Since we are writing to EEPROM anyways, and this way, it sticks on reboot * Fix QMK DFU bootloader options * More updates for QMK DFU support * Use matrix scanning hack for startup_user until #3113 gets merged * Fix indicator light consistency issue * Add/readd ifdefs to indicators * Add/readd alt indicator * Remove RGB Twinkling from Viterbi macro pad * Fix default layer color detection * Fix rebase and detection issues * Cleanup code so it will compile if RGBLIGHT is disabled * Revert vsode settings * Use Pragma Once instead of boilerplate code
5 years ago
  1. /* Copyright 2015-2017 Jack Humbert
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include QMK_KEYBOARD_H
  17. #include "drashna.h"
  18. #ifdef RGBLIGHT_ENABLE
  19. extern rgblight_config_t rgblight_config;
  20. #endif
  21. #ifdef BACKLIGHT_ENABLE
  22. enum planck_keycodes {
  23. BACKLIT = NEW_SAFE_RANGE,
  24. };
  25. #else
  26. #define BACKLIT OSM(MOD_LSFT)
  27. #endif
  28. #ifdef KEYBOARD_planck_ez
  29. # define PLNK_1 BK_LWER
  30. # define PLNK_2 SP_LWER
  31. # define PLNK_3 KC_NO
  32. # define PLNK_4 ET_RAIS
  33. #else
  34. # define PLNK_1 SP_LWER
  35. # define PLNK_2 BK_LWER
  36. # define PLNK_3 DL_RAIS
  37. # define PLNK_4 ET_RAIS
  38. #endif
  39. #define LAYOUT_ortho_4x12_base( \
  40. K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
  41. K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
  42. K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
  43. ) \
  44. LAYOUT_ortho_4x12_wrapper( \
  45. KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_BSPC, \
  46. KC_TAB, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, KC_QUOT, \
  47. KC_MLSF, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), KC_ENT, \
  48. BACKLIT, OS_LCTL, OS_LALT, OS_LGUI, PLNK_1, PLNK_2, PLNK_3, PLNK_4, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
  49. )
  50. #define LAYOUT_ortho_4x12_base_wrapper(...) LAYOUT_ortho_4x12_base(__VA_ARGS__)
  51. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  52. [_QWERTY] = LAYOUT_ortho_4x12_base_wrapper(
  53. _________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
  54. _________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
  55. _________________QWERTY_L3_________________, _________________QWERTY_R3_________________
  56. ),
  57. [_COLEMAK] = LAYOUT_ortho_4x12_base_wrapper(
  58. _________________COLEMAK_L1________________, _________________COLEMAK_R1________________,
  59. _________________COLEMAK_L2________________, _________________COLEMAK_R2________________,
  60. _________________COLEMAK_L3________________, _________________COLEMAK_R3________________
  61. ),
  62. [_DVORAK] = LAYOUT_ortho_4x12_base_wrapper(
  63. _________________DVORAK_L1_________________, _________________DVORAK_R1_________________,
  64. _________________DVORAK_L2_________________, _________________DVORAK_R2_________________,
  65. _________________DVORAK_L3_________________, _________________DVORAK_R3_________________
  66. ),
  67. [_WORKMAN] = LAYOUT_ortho_4x12_base_wrapper(
  68. _________________WORKMAN_L1________________, _________________WORKMAN_R1________________,
  69. _________________WORKMAN_L2________________, _________________WORKMAN_R2________________,
  70. _________________WORKMAN_L3________________, _________________WORKMAN_R3________________
  71. ),
  72. [_NORMAN] = LAYOUT_ortho_4x12_base_wrapper(
  73. _________________NORMAN_L1_________________, _________________NORMAN_L1_________________,
  74. _________________NORMAN_L2_________________, _________________NORMAN_R2_________________,
  75. _________________NORMAN_L3_________________, _________________NORMAN_R3_________________
  76. ),
  77. [_MALTRON] = LAYOUT_ortho_4x12_base_wrapper(
  78. _________________MALTRON_L1________________, _________________MALTRON_R1________________,
  79. _________________MALTRON_L2________________, _________________MALTRON_R2________________,
  80. _________________MALTRON_L3________________, _________________MALTRON_R3________________
  81. ),
  82. [_EUCALYN] = LAYOUT_ortho_4x12_base_wrapper(
  83. _________________EUCALYN_L1________________, _________________EUCALYN_R1________________,
  84. _________________EUCALYN_L2________________, _________________EUCALYN_R2________________,
  85. _________________EUCALYN_L3________________, _________________EUCALYN_R3________________
  86. ),
  87. [_CARPLAX] = LAYOUT_ortho_4x12_base_wrapper(
  88. _____________CARPLAX_QFMLWY_L1_____________, _____________CARPLAX_QFMLWY_R1_____________,
  89. _____________CARPLAX_QFMLWY_L2_____________, _____________CARPLAX_QFMLWY_R2_____________,
  90. _____________CARPLAX_QFMLWY_L3_____________, _____________CARPLAX_QFMLWY_R3_____________
  91. ),
  92. [_MODS] = LAYOUT_ortho_4x12_wrapper(
  93. _______, ___________________BLANK___________________, ___________________BLANK___________________, _______,
  94. _______, ___________________BLANK___________________, ___________________BLANK___________________, _______,
  95. KC_LSFT, ___________________BLANK___________________, ___________________BLANK___________________, _______,
  96. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  97. ),
  98. [_LOWER] = LAYOUT_ortho_4x12_wrapper(
  99. KC_TILD, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_BSPC,
  100. KC_DEL, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE,
  101. _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______,
  102. _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
  103. ),
  104. [_RAISE] = LAYOUT_ortho_4x12_wrapper(
  105. KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, KC_BSPC,
  106. KC_DEL, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS,
  107. _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______,
  108. _______, _______, _______, _______, _______, _______, _______, _________________RAISE_R3__________________
  109. ),
  110. [_ADJUST] = LAYOUT_ortho_4x12_wrapper(
  111. KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RST,
  112. VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EEP_RST,
  113. _______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, TG_MODS,
  114. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_NUKE
  115. )
  116. };
  117. bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
  118. switch (keycode) {
  119. #ifdef BACKLIGHT_ENABLE
  120. case BACKLIT:
  121. if (record->event.pressed) {
  122. register_code(KC_RSFT);
  123. #ifdef BACKLIGHT_ENABLE
  124. backlight_step();
  125. #endif
  126. } else {
  127. unregister_code(KC_RSFT);
  128. }
  129. return false;
  130. break;
  131. #endif
  132. }
  133. return true;
  134. }
  135. bool music_mask_user(uint16_t keycode) {
  136. switch (keycode) {
  137. case RAISE:
  138. case LOWER:
  139. case BK_LWER:
  140. case SP_LWER:
  141. case DL_RAIS:
  142. case ET_RAIS:
  143. return false;
  144. default:
  145. return true;
  146. }
  147. }
  148. #ifdef RGB_MATRIX_ENABLE
  149. void suspend_power_down_keymap(void) {
  150. rgb_matrix_set_suspend_state(true);
  151. }
  152. void suspend_wakeup_init_keymap(void) {
  153. rgb_matrix_set_suspend_state(false);
  154. }
  155. void rgb_matrix_indicators_user(void) {
  156. uint8_t this_mod = get_mods();
  157. uint8_t this_led = host_keyboard_leds();
  158. uint8_t this_osm = get_oneshot_mods();
  159. bool is_ez;
  160. #ifdef KEYBOARD_planck_ez
  161. is_ez = true;
  162. #endif
  163. if ( userspace_config.rgb_layer_change &&
  164. #ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
  165. !g_suspend_state &&
  166. #endif
  167. #if defined(RGBLIGHT_ENABLE)
  168. (!rgblight_config.enable && rgb_matrix_config.enable)
  169. #else
  170. rgb_matrix_config.enable
  171. #endif
  172. ) {
  173. switch (biton32(layer_state)) {
  174. case _RAISE:
  175. rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
  176. case _LOWER:
  177. rgb_matrix_layer_helper(0x00, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
  178. case _ADJUST:
  179. rgb_matrix_layer_helper(0xFF, 0x00, 0x00, LED_FLAG_MODIFIER); break;
  180. default:
  181. switch (biton32(default_layer_state)) {
  182. case _QWERTY:
  183. rgb_matrix_layer_helper(0x00, 0xFF, 0xFF, LED_FLAG_MODIFIER); break;
  184. case _COLEMAK:
  185. rgb_matrix_layer_helper(0xFF, 0x00, 0xFF, LED_FLAG_MODIFIER); break;
  186. case _DVORAK:
  187. rgb_matrix_layer_helper(0x00, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
  188. case _WORKMAN:
  189. rgb_matrix_layer_helper(0xD9, 0xA5, 0x21, LED_FLAG_MODIFIER); break;
  190. case _NORMAN:
  191. rgb_matrix_layer_helper(0xFF, 0x7C, 0x4D, LED_FLAG_MODIFIER); break;
  192. case _MALTRON:
  193. rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_MODIFIER); break;
  194. case _EUCALYN:
  195. rgb_matrix_layer_helper(0xFF, 0x80, 0xBF, LED_FLAG_MODIFIER); break;
  196. case _CARPLAX:
  197. rgb_matrix_layer_helper(0x00, 0x00, 0xFF, LED_FLAG_MODIFIER); break;
  198. }
  199. }
  200. }
  201. switch (biton32(default_layer_state)) {
  202. case _QWERTY:
  203. rgb_matrix_set_color(is_ez ? 41 : 42, 0x00, 0xFF, 0xFF); break;
  204. case _COLEMAK:
  205. rgb_matrix_set_color(is_ez ? 41 : 42, 0xFF, 0x00, 0xFF); break;
  206. case _DVORAK:
  207. rgb_matrix_set_color(is_ez ? 41 : 42, 0x00, 0xFF, 0x00); break;
  208. case _WORKMAN:
  209. rgb_matrix_set_color(is_ez ? 41 : 42, 0xD9, 0xA5, 0x21); break;
  210. }
  211. if ( (this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1<<USB_LED_CAPS_LOCK)) {
  212. rgb_matrix_set_color(24, 0x00, 0xFF, 0x00);
  213. rgb_matrix_set_color(36, 0x00, 0xFF, 0x00);
  214. }
  215. if ( (this_mod | this_osm) & MOD_MASK_CTRL) {
  216. rgb_matrix_set_color(25, 0xFF, 0x00, 0x00);
  217. rgb_matrix_set_color(34, 0xFF, 0x00, 0x00);
  218. rgb_matrix_set_color(37, 0xFF, 0x00, 0x00);
  219. }
  220. if ( (this_mod | this_osm) & MOD_MASK_GUI) {
  221. rgb_matrix_set_color(39, 0xFF, 0xD9, 0x00);
  222. }
  223. if ( (this_mod | this_osm) & MOD_MASK_ALT) {
  224. rgb_matrix_set_color(38, 0x00, 0x00, 0xFF);
  225. }
  226. }
  227. void matrix_init_keymap(void) {
  228. // rgblight_mode(RGB_MATRIX_MULTISPLASH);
  229. }
  230. #else //RGB_MATRIX_INIT
  231. void matrix_init_keymap(void) {
  232. #if !defined(CONVERT_TO_PROTON_C) && !defined(KEYBOARD_planck)
  233. setPinOutput(D5);
  234. writePinHigh(D5);
  235. setPinOutput(B0);
  236. writePinHigh(B0);
  237. #endif
  238. }
  239. #endif //RGB_MATRIX_INIT
  240. #ifdef ENCODER_ENABLE
  241. void encoder_update(bool clockwise) {
  242. switch (biton32(layer_state)) {
  243. case _RAISE:
  244. clockwise ? tap_code(KC_VOLD) : tap_code(KC_VOLU);
  245. break;
  246. case _LOWER:
  247. #ifdef RGB_MATRIX_ENABLE
  248. clockwise ? rgb_matrix_step() : rgblight_step_reverse();
  249. #else
  250. clockwise ? tap_code(KC_PGDN) : tap_code(KC_PGUP);
  251. #endif
  252. break;
  253. case _ADJUST:
  254. #ifdef AUDIO_CLICKY
  255. clockwise ? clicky_freq_up() : clicky_freq_down();
  256. #endif
  257. break;
  258. default:
  259. clockwise ? tap_code(KC_DOWN) : tap_code(KC_UP);
  260. }
  261. #ifdef AUDIO_CLICKY
  262. clicky_play();
  263. #endif
  264. }
  265. #endif // ENCODER_ENABLE
  266. #ifdef KEYBOARD_planck_rev6
  267. void dip_update(uint8_t index, bool active) {
  268. switch (index) {
  269. case 0:
  270. if(active) { audio_on(); } else { audio_off(); }
  271. break;
  272. case 1:
  273. if(active) { clicky_on(); } else { clicky_off(); }
  274. break;
  275. case 2:
  276. keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = active;
  277. break;
  278. case 3:
  279. userspace_config.nuke_switch = active;
  280. break;
  281. }
  282. }
  283. #endif // KEYBOARD_planck_rev6
  284. #ifdef KEYBOARD_planck_ez
  285. uint32_t layer_state_set_keymap(uint32_t state) {
  286. palClearPad(GPIOB, 8);
  287. palClearPad(GPIOB, 9);
  288. switch (biton32(state)) {
  289. case _LOWER:
  290. palSetPad(GPIOB, 9);
  291. break;
  292. case _RAISE:
  293. palSetPad(GPIOB, 8);
  294. break;
  295. case _ADJUST:
  296. palSetPad(GPIOB, 9);
  297. palSetPad(GPIOB, 8);
  298. break;
  299. default:
  300. break;
  301. }
  302. return state;
  303. }
  304. #endif