You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.7 KiB

  1. /* Copyright 2021 Matthew Dias
  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. if (clockwise) {
  23. // tap_code(RGB_MOD);
  24. rgblight_step();
  25. } else {
  26. // tap_code(RGB_RMOD);
  27. rgblight_step_reverse();
  28. }
  29. return false;
  30. }
  31. #endif
  32. #ifdef OLED_ENABLE
  33. bool oled_task_kb(void) {
  34. if (!oled_task_user()) {
  35. return false;
  36. }
  37. // Host Keyboard Layer Status
  38. oled_write_P(PSTR("Layer: "), false);
  39. switch (get_highest_layer(layer_state)) {
  40. case 0:
  41. oled_write_P(PSTR("Default\n"), false);
  42. break;
  43. default:
  44. oled_write_P(PSTR("Undefined\n"), false);
  45. }
  46. // Host Keyboard LED Status
  47. led_t led_state = host_keyboard_led_state();
  48. oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
  49. oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
  50. oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
  51. return false;
  52. }
  53. #endif