Guest User

Untitled

a guest
Nov 15th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. #include <Mechy.h>
  2. #include <Mechy/Wiring.h>
  3. #include <Mechy/KeyPress.h>
  4. #include <Mechy/MediaKey.h>
  5. #include <Mechy/GotoLayer.h>
  6. #include <Mechy/TapHold.h>
  7. #include <Mechy/Receiver.h>
  8. #include <Mechy/Hardware/DZ60.h>
  9.  
  10. #define QWERTY_LAYER 0
  11. #define NAV_LAYER 1
  12. #define MEDIA_LAYER 2
  13. #define CONTROL_LAYER 3
  14.  
  15. #define SPC_FN LT(KC_SPC, GOTO(NAV_LAYER))
  16. #define TAB_FN LT(KC_SPC, GOTO(MEDIA_LAYER))
  17. #define FN_FN LT(KC_SPC, GOTO(CONTROL_LAYER))
  18. #define CTRL_ESC LT(KC_ESC, KC_LCTL)
  19.  
  20. #define GUI_TAB KC(LGUI(KEY_TAB))
  21.  
  22. KBD mainKeys[] = LAYOUT_60(
  23. KC_ESC , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_EQL , KC_BSPC ,
  24. TAB_FN , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_LBRC, KC_RBRC, KC_BSLS ,
  25. CTRL_ESC , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_ENT ,
  26. KC_LSFT , KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT ,
  27. KC_LCTL , KC_LALT , KC_LGUI , KC_SPC , KC_RGUI , KC_RALT , KC_RCTL , FN_FN
  28. );
  29.  
  30. KBD navKeys[] = LAYOUT_60(
  31. KC_GRV, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_DEL ,
  32. GUI_TAB, ____ , ____ , KC_LCBR, KC_RCBR, ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
  33. ____ , ____ , ____ , KC_LPRN, KC_RPRN, ____ , KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, ____ , ____ , ____ ,
  34. ____ , ____ , ____ , KC_LBRC, KC_RBRC, ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
  35. ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____
  36. );
  37.  
  38. KBD mediaKeys[] = LAYOUT_60(
  39. ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
  40. ____ , KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_MNXT, ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
  41. ____ , ____ , ____ , ____ , ____ , ____ , KC_HOME, KC_PGDN, KC_PGUP, KC_END , ____ , ____ , ____ ,
  42. ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
  43. ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____
  44. );
  45.  
  46. KBD controlKeys[] = LAYOUT_60(
  47. ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
  48. ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
  49. ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
  50. ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____ ,
  51. ____ , ____ , ____ , ____ , ____ , ____ , ____ , ____
  52. );
  53.  
  54.  
  55. #if (__has_include("secrets.h"))
  56. #include "secrets.h"
  57. const char* macros[7] = {M0, M1, M2, M3, M4, M5, M6};
  58. #else
  59. const char* macros[7] = {"", "", "", "", "", "", ""};
  60. #endif
  61.  
  62. Layout layout = Layout(ROWS, COLS, mainKeys, navKeys, mediaKeys);
  63. Scanner scanner = Scanner(&layout, pinRows, pinCols, ROWS, COLS);
  64.  
  65. Mechy mechy = Mechy();
  66. Hardware hardware = Hardware(&mechy);
  67.  
  68. void setup() {
  69. Wiring::pinMode(_D5, INPUT);
  70. Wiring::pinMode(_B0, INPUT);
  71.  
  72. mechy.add(new KeyPress());
  73. mechy.add(new MediaKey());
  74. mechy.add(new GotoLayer());
  75. mechy.add(new TapHold());
  76.  
  77. mechy.attach(&scanner);
  78.  
  79. mechy.begin();
  80. hardware.begin();
  81. }
  82.  
  83. void loop() {
  84. mechy.tick();
  85. hardware.tick();
  86. }
Add Comment
Please, Sign In to add comment