logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (2018B)


  1. #include QMK_KEYBOARD_H
  2. #define _MAIN 0
  3. #define _FN 1
  4. #define KC_X0 LT(_FN, KC_ESC)
  5. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  6. [_MAIN] = LAYOUT_ortho_2x4(
  7. G(KC_D), KC_UP, C(KC_C), C(KC_V),
  8. KC_LEFT, KC_DOWN, KC_RGHT, MO(_FN)
  9. ),
  10. [_FN] = LAYOUT_ortho_2x4(
  11. UG_TOGG, UG_NEXT, RGB_M_R, RGB_M_SN,
  12. BL_TOGG, BL_STEP, BL_BRTG, _______
  13. )
  14. };
  15. #ifdef OLED_ENABLE
  16. oled_rotation_t oled_init_user(oled_rotation_t rotation) {
  17. return OLED_ROTATION_180; // flips the display 180 degrees if offhand
  18. }
  19. bool oled_task_user(void) {
  20. // Host Keyboard Layer Status
  21. oled_write_ln_P(PSTR("ANAVI Macro Pad 8"), false);
  22. oled_write_P(PSTR("Active layer: "), false);
  23. switch (get_highest_layer(layer_state)) {
  24. case _MAIN:
  25. oled_write_ln_P(PSTR("Main"), false);
  26. break;
  27. case _FN:
  28. oled_write_ln_P(PSTR("FN"), false);
  29. break;
  30. default:
  31. // Or use the write_ln shortcut over adding '\n' to the end of your string
  32. oled_write_ln_P(PSTR("N/A"), false);
  33. }
  34. // Host Keyboard LED Status
  35. led_t led_state = host_keyboard_led_state();
  36. oled_write_P(PSTR("Num Lock: "), false);
  37. oled_write_ln_P(led_state.num_lock ? PSTR("On") : PSTR("Off"), false);
  38. oled_write_P(PSTR("Caps Lock: "), false);
  39. oled_write_ln_P(led_state.caps_lock ? PSTR("On") : PSTR("Off"), false);
  40. oled_write_P(PSTR("Scroll Lock: "), false);
  41. oled_write_ln_P(led_state.scroll_lock ? PSTR("On") : PSTR("Off"), false);
  42. oled_write_P(PSTR("Backlit: "), false);
  43. oled_write_ln_P(is_backlight_enabled() ? PSTR("On") : PSTR("Off"), false);
  44. #ifdef RGBLIGHT_ENABLE
  45. static char rgbStatusLine1[26] = {0};
  46. snprintf(rgbStatusLine1, sizeof(rgbStatusLine1), "RGB Mode: %d", rgblight_get_mode());
  47. oled_write_ln(rgbStatusLine1, false);
  48. static char rgbStatusLine2[26] = {0};
  49. snprintf(rgbStatusLine2, sizeof(rgbStatusLine2), "h:%d s:%d v:%d", rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val());
  50. oled_write_ln(rgbStatusLine2, false);
  51. #endif
  52. return false;
  53. }
  54. #endif