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.

63 lines
1.6 KiB

  1. /* Copyright 2021 Brandon Lewis
  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 "ristretto.h"
  17. enum layers {
  18. _BASE,
  19. _RAISE,
  20. _LOWER,
  21. _ADJUST
  22. };
  23. bool encoder_update_kb(uint8_t index, bool clockwise) {
  24. if (!encoder_update_user(index, clockwise)) { return false; }
  25. if(index == 0) {
  26. if (clockwise) {
  27. tap_code(KC_VOLD);
  28. } else {
  29. tap_code(KC_VOLU);
  30. }
  31. }
  32. return true;
  33. }
  34. #ifdef OLED_ENABLE
  35. oled_rotation_t oled_init_user(oled_rotation_t rotation) {
  36. return OLED_ROTATION_270;
  37. }
  38. __attribute__((weak)) void oled_task_user(void) {
  39. oled_write_P(PSTR("\n\n"), false);
  40. oled_write_ln_P(PSTR("LAYER"), false);
  41. oled_write_ln_P(PSTR(""), false);
  42. switch (get_highest_layer(layer_state)) {
  43. case _BASE:
  44. oled_write_P(PSTR("BASE\n"), false);
  45. break;
  46. case _RAISE:
  47. oled_write_P(PSTR("RAISE\n"), false);
  48. break;
  49. case _LOWER:
  50. oled_write_P(PSTR("LOWER\n"), false);
  51. break;
  52. case _ADJUST:
  53. oled_write_P(PSTR("ADJ\n"), false);
  54. break;
  55. }
  56. }
  57. #endif