logo

qmk_firmware

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

murphpad.c (2643B)


  1. /* Copyright 2021 Kyle McCreery
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "quantum.h"
  17. #ifdef ENCODER_ENABLE
  18. bool encoder_update_kb(uint8_t index, bool clockwise) {
  19. if (!encoder_update_user(index, clockwise)) {
  20. return false;
  21. }
  22. switch (index) {
  23. case 0:
  24. if (clockwise) {
  25. tap_code(KC_VOLU);
  26. } else {
  27. tap_code(KC_VOLD);
  28. }
  29. break;
  30. case 1:
  31. if (clockwise) {
  32. tap_code(KC_BRIU);
  33. } else {
  34. tap_code(KC_BRID);
  35. }
  36. break;
  37. }
  38. return true;
  39. }
  40. #endif
  41. #ifdef OLED_ENABLE
  42. static const char PROGMEM mw_logo[] = {
  43. 0x8A, 0x8B, 0x8C, 0x8D, '\r',
  44. 0xAA, 0xAB, 0xAC, 0xAD, 0xAE,
  45. 0xCA, 0xCB, 0xCC, 0xCD, '\r',
  46. 0x20, 0x8E, 0x8F, 0x90, 0x00};
  47. oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
  48. return OLED_ROTATION_270; // flips the display 270 degrees
  49. }
  50. bool oled_task_kb(void) {
  51. if (!oled_task_user()) {
  52. return false;
  53. }
  54. oled_write_P(mw_logo, false); // Render MechWild "MW" Logo
  55. oled_set_cursor(0,6);
  56. oled_write_ln_P(PSTR("Layer"), false);
  57. switch (get_highest_layer(layer_state)) {
  58. case 0:
  59. oled_write_ln_P(PSTR("Base"), false);
  60. break;
  61. case 1:
  62. oled_write_ln_P(PSTR("FN 1"), false);
  63. break;
  64. case 2:
  65. oled_write_ln_P(PSTR("FN 2"), false);
  66. break;
  67. case 3:
  68. oled_write_ln_P(PSTR("FN 3"), false);
  69. break;
  70. default:
  71. oled_write_ln_P(PSTR("Undef"), false);
  72. }
  73. oled_write_ln_P(PSTR(""), false);
  74. // Host Keyboard LED Status
  75. led_t led_state = host_keyboard_led_state();
  76. oled_write_ln_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
  77. oled_write_ln_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
  78. oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
  79. return true;
  80. }
  81. #endif