keymap.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #include QMK_KEYBOARD_H
  2. #define _MAIN 0
  3. #define _FN 1
  4. #define KC_X0 LT(_FN, KC_ESC)
  5. #ifdef RGBLIGHT_ENABLE
  6. // How long (in ms) to wait between animation steps for the rainbow mode
  7. const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {60, 30, 15};
  8. // How long (in milliseconds) to wait between animation steps for each of the "Swirling rainbow" animations
  9. const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {20, 10, 4};
  10. #endif
  11. /**
  12. * Kodi shortcuts:
  13. *
  14. * ESC - Previous menu OR Home screen
  15. * Enter - Select
  16. * X - Stop
  17. * Arrows to move
  18. *
  19. * For details have a look at:
  20. * https://kodi.wiki/view/Keyboard_controls
  21. */
  22. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  23. [_MAIN] = LAYOUT_ortho_2x4(
  24. KC_ESC, KC_UP, KC_ENTER, KC_X,
  25. KC_LEFT, KC_DOWN, KC_RIGHT, MO(_FN)
  26. ),
  27. [_FN] = LAYOUT_ortho_2x4(
  28. RGB_TOG, RGB_MOD, RGB_M_R, RGB_M_SN,
  29. BL_TOGG, BL_STEP, BL_BRTG, _______
  30. )
  31. };
  32. #ifdef OLED_DRIVER_ENABLE
  33. oled_rotation_t oled_init_user(oled_rotation_t rotation) {
  34. return OLED_ROTATION_180; // flips the display 180 degrees if offhand
  35. }
  36. void oled_task_user(void) {
  37. // Host Keyboard Layer Status
  38. oled_write_ln_P(PSTR("ANAVI Macro Pad 8"), false);
  39. oled_write_P(PSTR("Active layer: "), false);
  40. switch (get_highest_layer(layer_state)) {
  41. case _MAIN:
  42. oled_write_ln_P(PSTR("Kodi"), false);
  43. break;
  44. case _FN:
  45. oled_write_ln_P(PSTR("FN"), false);
  46. break;
  47. default:
  48. // Or use the write_ln shortcut over adding '\n' to the end of your string
  49. oled_write_ln_P(PSTR("N/A"), false);
  50. }
  51. // Host Keyboard LED Status
  52. led_t led_state = host_keyboard_led_state();
  53. oled_write_P(PSTR("Num Lock: "), false);
  54. oled_write_ln_P(led_state.num_lock ? PSTR("On") : PSTR("Off"), false);
  55. oled_write_P(PSTR("Caps Lock: "), false);
  56. oled_write_ln_P(led_state.caps_lock ? PSTR("On") : PSTR("Off"), false);
  57. oled_write_P(PSTR("Scroll Lock: "), false);
  58. oled_write_ln_P(led_state.scroll_lock ? PSTR("On") : PSTR("Off"), false);
  59. oled_write_P(PSTR("Backlit: "), false);
  60. oled_write_ln_P(is_backlight_enabled() ? PSTR("On") : PSTR("Off"), false);
  61. #ifdef RGBLIGHT_ENABLE
  62. static char rgbStatusLine1[26] = {0};
  63. snprintf(rgbStatusLine1, sizeof(rgbStatusLine1), "RGB Mode: %d", rgblight_get_mode());
  64. oled_write_ln(rgbStatusLine1, false);
  65. static char rgbStatusLine2[26] = {0};
  66. snprintf(rgbStatusLine2, sizeof(rgbStatusLine2), "h:%d s:%d v:%d", rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val());
  67. oled_write_ln(rgbStatusLine2, false);
  68. #endif
  69. }
  70. #endif