keymap.c 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. Copyright 2019 @foostan
  3. Copyright 2020 Drashna Jaelre <@drashna>
  4. Copyright 2022 Alejandro Jarovisky <@ajarov>
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  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 "keymap_spanish.h"
  18. enum layers {
  19. L_BASE,
  20. L_UPPER,
  21. L_RIGHT,
  22. L_UPPER_RIGHT,
  23. };
  24. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  25. [L_BASE] = LAYOUT_split_3x6_3(
  26. //,-----------------------------------------------------. ,-----------------------------------------------------.
  27. KC_TAB, ES_Q, ES_W, ES_E, ES_R, ES_T, ES_Y, ES_U, ES_I, ES_O, ES_P, KC_BSPC,
  28. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  29. KC_LCTL, ES_A, ES_S, ES_D, ES_F, ES_G, ES_H, ES_J, ES_K, ES_L, ES_NTIL, ES_ACUT,
  30. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  31. KC_LSFT, ES_Z, ES_X, ES_C, ES_V, ES_B, ES_N, ES_M, ES_COMM, ES_DOT, ES_MINS, KC_RSFT,
  32. //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
  33. KC_LGUI, MO(1), KC_SPC, KC_ENT, MO(2), KC_LALT
  34. //`--------------------------' `--------------------------'
  35. ),
  36. [L_UPPER] = LAYOUT_split_3x6_3(
  37. //,-----------------------------------------------------. ,-----------------------------------------------------.
  38. KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_APP, KC_INS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_BSPC,
  39. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  40. KC_LCTL, KC_F5, KC_F6, KC_F7, KC_F8, KC_PSCR, KC_DEL, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, ES_DIAE,
  41. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  42. KC_LSFT, KC_F9, KC_F10, KC_F11, KC_F12, KC_PAUS, XXXXXXX, XXXXXXX, ES_SCLN, ES_COLN, ES_UNDS, KC_RSFT,
  43. //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
  44. KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_LALT
  45. //`--------------------------' `--------------------------'
  46. ),
  47. [L_RIGHT] = LAYOUT_split_3x6_3(
  48. //,-----------------------------------------------------. ,-----------------------------------------------------.
  49. KC_CAPS, ES_EXLM, ES_DQUO, ES_HASH, ES_CIRC, XXXXXXX, ES_ASTR, ES_7, ES_8, ES_9, ES_MINS, KC_BSPC,
  50. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  51. KC_LCTL, ES_LCBR, ES_RCBR, ES_LPRN, ES_RPRN, ES_QUES, ES_SLSH, ES_4, ES_5, ES_6, ES_PLUS, ES_QUOT,
  52. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  53. KC_LSFT, ES_LBRC, ES_RBRC, ES_LABK, ES_RABK, ES_EQL, ES_0, ES_1, ES_2, ES_3, ES_DOT, KC_RSFT,
  54. //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
  55. KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_LALT
  56. //`--------------------------' `--------------------------'
  57. ),
  58. [L_UPPER_RIGHT] = LAYOUT_split_3x6_3(
  59. //,-----------------------------------------------------. ,-----------------------------------------------------.
  60. XXXXXXX, ES_IEXL, ES_AT, ES_EURO, ES_DLR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, ES_MORD, XXXXXXX, KC_BSPC,
  61. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  62. KC_LCTL, ES_FORD, ES_AMPR, ES_PIPE, ES_BSLS, ES_IQUE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, ES_TILD, ES_GRV,
  63. //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
  64. KC_LSFT, XXXXXXX, ES_NOT, ES_CCED, ES_PERC, XXXXXXX, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, KC_RSFT,
  65. //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
  66. KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_LALT
  67. //`--------------------------' `--------------------------'
  68. )
  69. };
  70. layer_state_t layer_state_set_user(layer_state_t state) {
  71. return update_tri_layer_state(state, L_UPPER, L_RIGHT, L_UPPER_RIGHT);
  72. }
  73. #ifdef OLED_ENABLE
  74. oled_rotation_t oled_init_user(oled_rotation_t rotation) {
  75. if (!is_keyboard_master()) {
  76. return OLED_ROTATION_180; // flips the display 180 degrees if offhand
  77. }
  78. return rotation;
  79. }
  80. void oled_render_layer_state(void) {
  81. // Host Keyboard Layer Status
  82. oled_write_P(PSTR("Layer: "), false);
  83. switch (get_highest_layer(layer_state)) {
  84. case L_BASE:
  85. oled_write_ln_P(PSTR("Default"), false);
  86. break;
  87. case L_UPPER:
  88. oled_write_ln_P(PSTR("Upper"), false);
  89. break;
  90. case L_RIGHT:
  91. oled_write_ln_P(PSTR("Right"), false);
  92. break;
  93. case L_UPPER_RIGHT:
  94. oled_write_ln_P(PSTR("Upper Right"), false);
  95. break;
  96. default:
  97. oled_write_ln_P(PSTR("Undefined"), false);
  98. }
  99. // Host Keyboard LED Status
  100. led_t led_state = host_keyboard_led_state();
  101. oled_write_ln_P(PSTR(""), false);
  102. oled_write_ln_P(led_state.caps_lock ? PSTR("CAPS LOCK") : PSTR(" "), false);
  103. }
  104. void render_bootmagic_status(bool status) {
  105. /* Show Ctrl-Gui Swap options */
  106. static const char PROGMEM logo[][2][3] = {
  107. {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
  108. {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
  109. };
  110. if (status) {
  111. oled_write_ln_P(logo[0][0], false);
  112. oled_write_ln_P(logo[0][1], false);
  113. } else {
  114. oled_write_ln_P(logo[1][0], false);
  115. oled_write_ln_P(logo[1][1], false);
  116. }
  117. }
  118. void oled_render_logo(void) {
  119. static const char PROGMEM crkbd_logo[] = {
  120. 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
  121. 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
  122. 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
  123. 0};
  124. oled_write_P(crkbd_logo, false);
  125. }
  126. bool oled_task_user(void) {
  127. if (is_keyboard_master()) {
  128. oled_render_layer_state();
  129. } else {
  130. oled_render_logo();
  131. }
  132. return false;
  133. }
  134. #endif // OLED_ENABLE