keymap.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include QMK_KEYBOARD_H
  2. #include "split_util.h"
  3. #include "keymap_xrows.h"
  4. #ifdef SSD1306OLED
  5. #include "oled.h"
  6. #endif
  7. // keymaps definitions are moved to keymap_Xrows.c.
  8. bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
  9. switch(keycode) {
  10. case KC_LOCK:
  11. if (record->event.pressed) {
  12. if (get_enable_kc_lang()) {
  13. SEND_STRING( SS_LCTRL(SS_LSFT(SS_TAP(X_POWER))) );
  14. } else {
  15. SEND_STRING( SS_LGUI("l") );
  16. }
  17. }
  18. return false;
  19. }
  20. return true;
  21. }
  22. #ifdef SSD1306OLED
  23. void matrix_init_keymap(void) {
  24. //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
  25. iota_gfx_init(!has_usb()); // turns on the display
  26. }
  27. void matrix_scan_user(void) {
  28. iota_gfx_task(); // this is what updates the display continuously
  29. }
  30. #endif
  31. #ifdef RGBLIGHT_ENABLE
  32. uint32_t layer_state_set_keymap(uint32_t state) {
  33. rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
  34. switch (biton32(state)) {
  35. case _EDVORAKJ1:
  36. case _EDVORAKJ2:
  37. // _EDVORAKJ1 & J2 are same colored
  38. rgblight_sethsv_noeeprom_white();
  39. break;
  40. case _LOWER:
  41. rgblight_sethsv_noeeprom_red();
  42. break;
  43. case _RAISE:
  44. rgblight_sethsv_noeeprom_blue();
  45. break;
  46. case _ADJUST:
  47. rgblight_sethsv_noeeprom_green();
  48. break;
  49. default: // for any other layers, or the default layer
  50. rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_GRADIENT + 3);
  51. rgblight_sethsv_noeeprom_red();
  52. break;
  53. }
  54. return state;
  55. }
  56. #endif