keymap.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include QMK_KEYBOARD_H
  2. #define DEF 0
  3. #define HDN 1
  4. #define OSY 2
  5. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  6. [DEF] = LAYOUT(
  7. KC_FN0, KC_SLSH, KC_ASTR, KC_MINS, \
  8. KC_7, KC_8, KC_9, KC_PLUS, \
  9. KC_4, KC_5, KC_6, \
  10. KC_1, KC_2, KC_3, \
  11. KC_0, KC_DOT, KC_ENT \
  12. ),
  13. [HDN] = LAYOUT(
  14. KC_FN1, KC_1, KC_2, KC_3, \
  15. KC_Q, KC_W, KC_E, KC_R, \
  16. KC_A, KC_S, KC_D, \
  17. KC_Z, KC_X, KC_C, \
  18. KC_LSFT, KC_LALT, KC_SPC \
  19. ),
  20. [OSY] = LAYOUT(
  21. KC_A, KC_Q, KC_1, KC_FN2, \
  22. KC_S, KC_W, KC_2, KC_LALT, \
  23. KC_D, KC_E, KC_3, \
  24. KC_F, KC_R, KC_4, \
  25. KC_SPC, KC_T, KC_TAB \
  26. )
  27. };
  28. const uint16_t PROGMEM fn_actions[] = {
  29. [0] = ACTION_LAYER_SET(HDN, ON_PRESS),
  30. [1] = ACTION_LAYER_SET(OSY, ON_PRESS),
  31. [2] = ACTION_LAYER_SET(DEF, ON_PRESS),
  32. };
  33. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
  34. return MACRO_NONE;
  35. };
  36. bool process_record_user (uint16_t keycode, keyrecord_t *record) {
  37. switch(keycode) {
  38. case KC_FN0:
  39. if (record->event.pressed) {
  40. PORTC |= (1 << 6); // PC6 goes high
  41. }
  42. break;
  43. case KC_FN1:
  44. if (record->event.pressed) {
  45. PORTC &= ~(1 << 6); // PC6 goes high
  46. PORTD |= (1<<4);
  47. }
  48. break;
  49. case KC_FN2:
  50. if (record->event.pressed) {
  51. PORTD &= ~(1 << 4); // PC6 goes high
  52. }
  53. break;
  54. }
  55. return true;
  56. }