Guest User

Viterbi Keymap.c

a guest
Apr 17th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 11.92 KB | None | 0 0
  1. #include "viterbi.h"
  2. #include "action_layer.h"
  3. #include "eeconfig.h"
  4.  
  5. extern keymap_config_t keymap_config;
  6.  
  7. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  8. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  9. // Layer names don't all need to be of the same length, obviously, and you can also skip them
  10. // entirely and just use numbers.
  11. #define _QWERTY 0
  12. #define _LOWER 1
  13. #define _RAISE 2
  14. #define _ADJUST 16
  15.  
  16. enum custom_keycodes {
  17.   QWERTY = SAFE_RANGE,
  18.   LOWER,
  19.   RAISE,
  20.   ADJUST,
  21. };
  22.  
  23. // Fillers to make layering more clear
  24. #define KC_     KC_TRNS
  25. #define _______ KC_TRNS
  26. #define XXXXXXX KC_NO
  27. #define KC_AJST ADJUST
  28. #define KC_LOWR LOWER
  29. #define KC_RASE RAISE
  30.  
  31. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  32.  
  33. /* QWERTY
  34.  * ,------------------------------------------------.      ,------------------------------------------------.
  35.  * |  `   |   1  |   2  |   3  |   4  |   5  |   -  |      |   =  |   6  |   7  |   8  |   9  |   0  | Bksp |
  36.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  37.  * | Tab  |   Q  |   W  |   E  |   R  |   T  | PGUP |      |   [  |   Y  |   U  |   I  |   O  |   P  |   ]  |
  38.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  39.  * | Esc  |   A  |   S  |   D  |   F  |   G  | PGDN |      |   '  |   H  |   J  |   K  |   L  |   ;  |Enter |
  40.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  41.  * | Shift|   Z  |   X  |   C  |   V  |   B  | DEL  |      |   \  |   N  |   M  |   ,  |   .  |   /  |Shift |
  42.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  43.  * |  Ctrl  | Super  | Lower  |  Alt  |       Space |      | Space       |  Alt  | Raise  | Super  |  Ctrl  |
  44.  * `------------------------------------------------'      `------------------------------------------------'
  45.  */
  46.   [_QWERTY] = LAYOUT_kc(
  47.   //,------+------+------+------+------+------+------.    ,------+------+------+------+------+------+------.
  48.       GRV  , 1    , 2    , 3    , 4    , 5    , MINS ,      EQL  , 6    , 7    , 8    , 9    , 0    , BSPC ,
  49.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  50.       TAB  , Q    , W    , E    , R    , T    , PGUP ,      LBRC , Y    , U    , I    , O    , P    , RBRC ,
  51.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  52.       ESC  , A    , S    , D    , F    , G    , PGDN ,      QUOT , H    , J    , K    , L    , SCLN , ENT  ,
  53.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  54.       LSFT , Z    , X    , C    , V    , B    , DEL  ,      BSLS , N    , M    , COMM , DOT  , SLSH , RSFT ,
  55.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  56.       LCTL , LGUI , NO   , LOWR , LALT , NO   , SPC  ,      SPC  , NO   ,TG(RASE), RALT , NO   , RGUI , RCTL // < Here
  57.   //`------+------+------+------+------+------+------'    `------+------+------+------+------+------+------'
  58.   ), //                                                                  ^^^^^^
  59.  
  60. /* Lower
  61.  * ,------------------------------------------------.      ,------------------------------------------------.
  62.  * |      | F1   | F2   | F3   | F4   | F5   | F6   |      | F7   | F8   | F9   | F10  | F11  | F12  |      |
  63.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  64.  * |      |  1   |  2   |  3   |  4   |  5   | HOME |      |      |  6   |  7   |  8   |  9   |  0   |      |
  65.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  66.  * |      |  +   |  -   |  *   |  /   |  %   | END  |      |  (   |  )   |  [   |  ]   |  {   |  }   |      |
  67.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  68.  * |      |      |      |      |      |      | INS  |      |      |      |      |      |      |      |      |
  69.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  70.  * |      |      |      |      |      |      |      |      |      |      |      |      |      |      |      |
  71.  * `------------------------------------------------'      `------------------------------------------------'
  72.  */
  73.   [_LOWER] = LAYOUT_kc(
  74.   //,------+------+------+------+------+------+------.    ,------+------+------+------+------+------+------.
  75.            , F1   , F2   , F3   , F4   , F5   , F6   ,      F7   , F8   , F9   , F10  , F11  , F12  ,      ,
  76.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  77.            ,  1   ,  2   ,  3   ,  4   ,  5   , HOME ,           ,  6   ,  7   ,  8   ,  9   ,  0   ,      ,
  78.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  79.            , PLUS , MINS , ASTR , PSLS , PERC , END  ,      LPRN , RPRN , LBRC , RBRC , LCBR , RCBR ,      ,
  80.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  81.            ,      ,      ,      ,      ,      , INS  ,           ,      ,      ,      ,      ,      ,      ,
  82.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  83.            ,      ,      ,      ,      ,      ,      ,           ,      ,      ,      ,      ,      ,
  84.   //`------+------+------+------+------+------+------'    `------+------+------+------+------+------+------'
  85.   ),
  86.  
  87. /* Raise
  88.  * ,------------------------------------------------.      ,------------------------------------------------.
  89.  * |      |      |      |      |      |      |      |      |      |      |      |      |      |      |      |
  90.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  91.  * |      |      |      |      |      |      |      |      |      |      |      |      |      |      |      |
  92.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  93.  * |      |      |      |      |      |      |      |      |      |      |      |      |      |  UP  |      |
  94.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  95.  * |      |      |      |      |      |      |      |      |      |      |      |      | LEFT | DOWN |RIGHT |
  96.  * |------+------+------+------+------+------+------|      |------+------+------+------+------+------+------|
  97.  * |      |      |      |      |      |      |      |      |      |      |      |      |      |      |      |
  98.  * `------------------------------------------------'      `------------------------------------------------'
  99.  */
  100.   [_RAISE] = LAYOUT_kc(
  101.   //,------+------+------+------+------+------+------.    ,------+------+------+------+------+------+------.
  102.            ,      ,      ,      ,      ,      ,      ,           ,      ,      ,      ,      ,      ,      ,
  103.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  104.            ,      ,      ,      ,      ,      ,      ,           ,      ,      ,      ,      ,      ,      ,
  105.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  106.            ,      ,      ,      ,      ,      ,      ,           ,      ,      ,      ,      ,  UP  ,      ,
  107.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  108.            ,      ,      ,      ,      ,      ,      ,           ,      ,      ,      , LEFT , DOWN , RGHT ,
  109.   //|------+------+------+------+------+------+------|    |------+------+------+------+------+------+------|
  110.            ,      ,      ,      ,      ,      ,      ,           ,      ,      ,      ,      ,      ,
  111.   //`------+------+------+------+------+------+------'    `------+------+------+------+------+------+------'
  112.   ),
  113.  
  114.   [_ADJUST] = LAYOUT(
  115.     _______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  _______, \
  116.     _______, _______, RESET  , RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, KC_DEL,  _______, \
  117.     _______, _______, _______, _______, AU_ON,   AU_OFF,  AG_NORM, AG_SWAP, QWERTY,  _______, _______, _______, _______, _______, \
  118.     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
  119.     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
  120.   )
  121.  
  122. };
  123.  
  124. #ifdef AUDIO_ENABLE
  125. float tone_qwerty[][2]     = SONG(QWERTY_SOUND);
  126. #endif
  127.  
  128. void persistent_default_layer_set(uint16_t default_layer) {
  129.   eeconfig_update_default_layer(default_layer);
  130.   default_layer_set(default_layer);
  131. }
  132.  
  133. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  134.   switch (keycode) {
  135.     case QWERTY:
  136.       if (record->event.pressed) {
  137.         #ifdef AUDIO_ENABLE
  138.           PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
  139.         #endif
  140.         persistent_default_layer_set(1UL<<_QWERTY);
  141.       }
  142.       return false;
  143.       break;
  144.     case LOWER:
  145.       if (record->event.pressed) {
  146.         layer_on(_LOWER);
  147.         update_tri_layer(_LOWER, _RAISE, _ADJUST);
  148.       } else {
  149.         layer_off(_LOWER);
  150.         update_tri_layer(_LOWER, _RAISE, _ADJUST);
  151.       }
  152.       return false;
  153.       break;
  154.     case RAISE:
  155.       if (record->event.pressed) {
  156.         layer_on(_RAISE);
  157.         update_tri_layer(_LOWER, _RAISE, _ADJUST);
  158.       } else {
  159.         layer_off(_RAISE);
  160.         update_tri_layer(_LOWER, _RAISE, _ADJUST);
  161.       }
  162.       return false;
  163.       break;
  164.     case ADJUST:
  165.       if (record->event.pressed) {
  166.         layer_on(_ADJUST);
  167.       } else {
  168.         layer_off(_ADJUST);
  169.       }
  170.       return false;
  171.       break;
  172.   }
  173.   return true;
  174. }
  175.  
  176.  
  177. /*
  178.     The error recieved:
  179.  
  180. Compiling: keyboards/viterbi/keymaps/default/keymap.c                                              In file included from keyboards/viterbi/viterbi.h:5:0,
  181.                  from keyboards/viterbi/keymaps/default/keymap.c:1:
  182. keyboards/viterbi/viterbi.h:21:99: error: implicit declaration of function 'KC_TG'; did you mean 'KC_P6'? [-Werror=implicit-function-declaration]
  183.          KC_##L40, KC_##L41, KC_##L42, KC_##L43, KC_##L44, KC_##L45, KC_##L46, KC_##R40, KC_##R41, KC_##R42, KC_##R43, KC_##R44, KC_##R45, KC_##R46 \
  184.                                                                                                    ^
  185. keyboards/viterbi/rev1/rev1.h:40:25: note: in definition of macro 'LAYOUT'
  186.    { R46, R45, R44, R43, R42, R41, R40 } \
  187.                          ^~~
  188. keyboards/viterbi/keymaps/default/keymap.c:46:15: note: in expansion of macro 'LAYOUT_kc'
  189.    [_QWERTY] = LAYOUT_kc(
  190.                ^~~~~~~~~
  191. keyboards/viterbi/keymaps/default/keymap.c:56:77: error: 'RASE' undeclared here (not in a function); did you mean 'RAISE'?
  192.        LCTL , LGUI , NO   , LOWR , LALT , NO   , SPC  ,      SPC  , NO   ,TG(RASE), RALT , NO   , RGUI , RCTL // < Here
  193.                                                                              ^
  194. keyboards/viterbi/rev1/rev1.h:40:25: note: in definition of macro 'LAYOUT'
  195.    { R46, R45, R44, R43, R42, R41, R40 } \
  196.                          ^~~
  197. keyboards/viterbi/keymaps/default/keymap.c:46:15: note: in expansion of macro 'LAYOUT_kc'
  198.    [_QWERTY] = LAYOUT_kc(
  199.                ^~~~~~~~~
  200. cc1: all warnings being treated as errors
  201.  [ERRORS]
  202.  |
  203.  |
  204.  |
  205. make[1]: *** [tmk_core/rules.mk:360: .build/obj_viterbi_rev1_default/keyboards/viterbi/keymaps/default/keymap.o] Error 1
  206. Make finished with errors
  207. make: *** [Makefile:549: viterbi/rev1:default] Error 1
  208.  
  209.  
  210. */
Add Comment
Please, Sign In to add comment