logo

qmk_firmware

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

yampad.c (2280B)


  1. /* Copyright 2019
  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. #include <stdio.h>
  18. #if defined(OLED_ENABLE)
  19. oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
  20. return OLED_ROTATION_270;
  21. }
  22. bool oled_task_kb(void) {
  23. if (!oled_task_user()) {
  24. return false;
  25. }
  26. // Host Keyboard Layer Status
  27. oled_write_P(PSTR("Layer"), false);
  28. switch (get_highest_layer(layer_state)) {
  29. case 0:
  30. oled_write_ln_P(PSTR(" BAS"), false);
  31. break;
  32. case 1:
  33. oled_write_ln_P(PSTR(" NAV"), false);
  34. break;
  35. case 2:
  36. oled_write_ln_P(PSTR(" RGB"), false);
  37. break;
  38. default:
  39. // Or use the write_ln shortcut over adding '\n' to the end of your string
  40. oled_write_ln_P(PSTR(" UND"), false);
  41. }
  42. // Host Keyboard LED Status
  43. led_t led_state = host_keyboard_led_state();
  44. oled_write_P(PSTR("-----"), false);
  45. oled_write_P(PSTR("Stats"), false);
  46. oled_write_P(led_state.num_lock ? PSTR("num:*") : PSTR("num:."), false);
  47. oled_write_P(led_state.caps_lock ? PSTR("cap:*") : PSTR("cap:."), false);
  48. oled_write_P(led_state.scroll_lock ? PSTR("scr:*") : PSTR("scr:."), false);
  49. // Host Keyboard RGB backlight status
  50. oled_write_P(PSTR("-----"), false);
  51. oled_write_P(PSTR("Light"), false);
  52. static char led_buf[30];
  53. snprintf(led_buf, sizeof(led_buf) - 1, "RGB:%cM: %2d\nh: %2ds: %2dv: %2d\n",
  54. rgblight_is_enabled() ? '*' : '.', (uint8_t)rgblight_get_mode(),
  55. (uint8_t)(rgblight_get_hue() / RGBLIGHT_HUE_STEP),
  56. (uint8_t)(rgblight_get_sat() / RGBLIGHT_SAT_STEP),
  57. (uint8_t)(rgblight_get_val() / RGBLIGHT_VAL_STEP));
  58. oled_write(led_buf, false);
  59. return false;
  60. }
  61. #endif