rev2.c 871 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2025 Danny Nguyen (danny@keeb.io)
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "quantum.h"
  4. #include "split_util.h"
  5. void matrix_init_kb(void) {
  6. gpio_set_pin_output(CAPS_LOCK_LED_PIN);
  7. matrix_init_user();
  8. }
  9. void led_update_ports(led_t led_state) {
  10. // Only update if left half
  11. if (is_keyboard_left()) {
  12. gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock);
  13. }
  14. }
  15. #ifdef ENCODER_ENABLE
  16. bool encoder_update_kb(uint8_t index, bool clockwise) {
  17. if (!encoder_update_user(index, clockwise)) { return false; }
  18. if (index == 0) {
  19. if (clockwise) {
  20. tap_code(KC_PGDN);
  21. } else {
  22. tap_code(KC_PGUP);
  23. }
  24. } else if (index == 1) {
  25. if (clockwise) {
  26. tap_code(KC_VOLU);
  27. } else {
  28. tap_code(KC_VOLD);
  29. }
  30. }
  31. return false;
  32. }
  33. #endif