keymap.c 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include "viterbi.h"
  2. #include "action_layer.h"
  3. #include "eeconfig.h"
  4. extern keymap_config_t keymap_config;
  5. #define _QWERTY 0
  6. #define _FN 1
  7. enum custom_keycodes {
  8. QWERTY = SAFE_RANGE,
  9. FN,
  10. };
  11. #define KC_ KC_TRNS
  12. #define _______ KC_TRNS
  13. #define KC_SWIN LGUI(KC_TILD) // Switch between windows
  14. #define KC_SAPP LGUI(KC_TAB) // Switch between applications
  15. #define KC_FN1 MO(_FN)
  16. #define KC_LCAG LCAG(KC_NO)
  17. #define KC_RTOG RGB_TOG
  18. #define KC_RMOD RGB_MOD
  19. #define KC_RVAD RGB_VAD
  20. #define KC_RVAI RGB_VAI
  21. #define KC_CLRM KC_NO // TODO: Clear sticky modifiers
  22. #define KC_RST RESET
  23. // TODO: Make modifiers sticky
  24. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  25. [_QWERTY] = KC_KEYMAP(
  26. //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----.
  27. GRV , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,MINS,EQL ,BSPC,
  28. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  29. TAB , Q , W , E , R , T ,LBRC, Y , U , I , O , P ,BSLS,PGUP,
  30. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  31. ESC , A , S , D , F , G ,RBRC, H , J , K , L ,SCLN,QUOT,ENT ,
  32. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  33. LSFT, Z , X , C , V , B ,SWIN, N , M ,COMM,DOT , UP ,SLSH,RSFT,
  34. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  35. LCTL,LCAG,LALT,LGUI,SPC ,CLRM,SAPP, FN1 ,SPC ,RGUI,LEFT,DOWN,RGHT,PGDN
  36. //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----'
  37. ),
  38. [_FN] = KC_KEYMAP(
  39. //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----.
  40. , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , ,
  41. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  42. , , , ,RST , , , , , , , , , ,
  43. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  44. , , , , , , , RTOG,RMOD,RVAD,RVAI, , , ,
  45. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  46. , , , , , , , ,MUTE,VOLD,VOLU, , , ,
  47. //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
  48. , , , , , , , , , , , , ,
  49. //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----'
  50. )
  51. };
  52. #ifdef AUDIO_ENABLE
  53. float tone_qwerty[][2] = SONG(QWERTY_SOUND);
  54. #endif
  55. void persistent_default_layer_set(uint16_t default_layer) {
  56. eeconfig_update_default_layer(default_layer);
  57. default_layer_set(default_layer);
  58. }
  59. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  60. switch (keycode) {
  61. case QWERTY:
  62. if (record->event.pressed) {
  63. #ifdef AUDIO_ENABLE
  64. PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
  65. #endif
  66. persistent_default_layer_set(1UL<<_QWERTY);
  67. }
  68. return false;
  69. break;
  70. }
  71. return true;
  72. }