logo

qmk_firmware

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

work_board.c (2974B)


  1. /* Copyright 2021 Drashna Jael're
  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 OLED_ENABLE
  18. # ifdef RGB_MATRIX_ENABLE
  19. # error Cannot run OLED and Per Key RGB at the same time due to pin conflicts
  20. # endif
  21. oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
  22. return OLED_ROTATION_90;
  23. }
  24. bool oled_task_kb(void) {
  25. if (!oled_task_user()) {
  26. return false;
  27. }
  28. oled_write_P(PSTR("LAYER"), false);
  29. oled_write_P(PSTR("Lower"), layer_state_is(3));
  30. oled_write_P(PSTR("Raise"), layer_state_is(4));
  31. oled_write_P(PSTR("Adjst"), layer_state_is(5));
  32. led_t led_usb_state = host_keyboard_led_state();
  33. oled_write_P(PSTR("Lock:"), false);
  34. oled_write_P(PSTR(" "), false);
  35. oled_write_P(PSTR("N"), led_usb_state.num_lock);
  36. oled_write_P(PSTR("C"), led_usb_state.caps_lock);
  37. oled_write_ln_P(PSTR("S"), led_usb_state.scroll_lock);
  38. uint8_t modifiers = get_mods() | get_oneshot_mods();
  39. oled_write_P(PSTR("Mods:"), false);
  40. oled_write_P(PSTR(" "), false);
  41. oled_write_P(PSTR("S"), (modifiers & MOD_MASK_SHIFT));
  42. oled_write_P(PSTR("C"), (modifiers & MOD_MASK_CTRL));
  43. oled_write_P(PSTR("A"), (modifiers & MOD_MASK_ALT));
  44. oled_write_P(PSTR("G"), (modifiers & MOD_MASK_GUI));
  45. /* Show Ctrl-Gui Swap options */
  46. static const char PROGMEM logo[][2][3] = {
  47. {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
  48. {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
  49. };
  50. oled_write_P(PSTR("BTMGK"), false);
  51. oled_write_P(PSTR(" "), false);
  52. oled_write_P(logo[0][0], !keymap_config.swap_lctl_lgui);
  53. oled_write_P(logo[1][0], keymap_config.swap_lctl_lgui);
  54. oled_write_P(PSTR(" "), false);
  55. oled_write_P(logo[0][1], !keymap_config.swap_lctl_lgui);
  56. oled_write_P(logo[1][1], keymap_config.swap_lctl_lgui);
  57. oled_write_P(PSTR(" NKRO"), keymap_config.nkro);
  58. return false;
  59. }
  60. #endif
  61. #ifdef RGB_MATRIX_ENABLE
  62. bool rgb_matrix_indicators_kb(void) {
  63. if (!rgb_matrix_indicators_user()) {
  64. return false;
  65. }
  66. rgb_matrix_set_color(5, 0, 0, 0);
  67. rgb_matrix_set_color(7, 0, 0, 0);
  68. return true;
  69. }
  70. void keyboard_pre_init_kb(void) {
  71. gpio_set_pin_output(B2);
  72. gpio_set_pin_output(B3);
  73. gpio_set_pin_output(B7);
  74. gpio_write_pin_low(B2);
  75. gpio_write_pin_low(B3);
  76. gpio_write_pin_low(B7);
  77. keyboard_pre_init_user();
  78. }
  79. #endif