logo

qmk_firmware

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

ver3.c (3651B)


  1. /* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
  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 RGB_MATRIX_ENABLE
  18. #include "rgb_matrix.h"
  19. led_config_t g_led_config = { {
  20. { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
  21. { NO_LED, 6, NO_LED, NO_LED, 7, NO_LED, NO_LED, 8, NO_LED, NO_LED, 9, NO_LED, NO_LED, 0, NO_LED },
  22. { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
  23. { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
  24. { NO_LED, 5, NO_LED, NO_LED, 4, NO_LED, NO_LED, 3, NO_LED, NO_LED, 2, NO_LED, NO_LED, 1, NO_LED }
  25. }, {
  26. { 195, 3 }, { 195, 16 }, { 150, 16 }, { 105, 16 }, { 60, 16 }, { 15, 16 }, { 15, 3 }, { 60, 3 }, { 105, 3 }, { 150, 3 }
  27. }, {
  28. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
  29. } };
  30. #endif
  31. #ifdef OLED_ENABLE
  32. oled_rotation_t oled_init_kb(oled_rotation_t rotation) { return OLED_ROTATION_180; }
  33. bool oled_task_kb(void) {
  34. if (!oled_task_user()) {
  35. return false;
  36. }
  37. oled_write_P(PSTR("LAYER"), false);
  38. oled_advance_char();
  39. oled_write_char(get_highest_layer(layer_state) + 0x30, true);
  40. led_t led_state = host_keyboard_led_state();
  41. oled_set_cursor(18, 0);
  42. oled_write_P(PSTR("NUM"), led_state.num_lock);
  43. oled_set_cursor(18, 1);
  44. oled_write_P(PSTR("CAP"), led_state.caps_lock);
  45. oled_set_cursor(18, 2);
  46. oled_write_P(PSTR("SCR"), led_state.scroll_lock);
  47. uint8_t mod_state = get_mods();
  48. oled_set_cursor(10, 3);
  49. oled_write_P(PSTR("S"), mod_state & MOD_MASK_SHIFT);
  50. oled_advance_char();
  51. oled_write_P(PSTR("C"), mod_state & MOD_MASK_CTRL);
  52. oled_advance_char();
  53. oled_write_P(PSTR("A"), mod_state & MOD_MASK_ALT);
  54. oled_advance_char();
  55. oled_write_P(PSTR("G"), mod_state & MOD_MASK_GUI);
  56. oled_advance_char();
  57. /* Matrix display is 12 x 12 pixels */
  58. #define MATRIX_DISPLAY_X 5
  59. #define MATRIX_DISPLAY_Y 18
  60. // matrix
  61. for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
  62. for (uint8_t y = 0; y < MATRIX_COLS; y++) {
  63. bool on = (matrix_get_row(x) & (1 << y)) > 0;
  64. // force on for oled location
  65. if((x == 0) && (y >= (MATRIX_COLS - 3))) on = 1;
  66. oled_write_pixel(MATRIX_DISPLAY_X + y + 2, MATRIX_DISPLAY_Y + x + 2, on);
  67. }
  68. }
  69. // outline
  70. for (uint8_t x = 0; x < 19; x++) {
  71. oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y, true);
  72. oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y + 9, true);
  73. }
  74. for (uint8_t y = 0; y < 9; y++) {
  75. oled_write_pixel(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y+y, true);
  76. oled_write_pixel(MATRIX_DISPLAY_X + 19, MATRIX_DISPLAY_Y+y, true);
  77. }
  78. // bodge for layer number left hand side
  79. for (uint8_t y = 0; y < 8; y++) {
  80. oled_write_pixel(35, 0 + y, true);
  81. }
  82. return false;
  83. }
  84. #endif