rev1.c (1019B)
1 // Copyright 2025 Danny Nguyen (danny@keeb.io) 2 // SPDX-License-Identifier: GPL-2.0-or-later 3 4 #include "quantum.h" 5 #include "split_util.h" 6 7 void matrix_init_kb(void) { 8 gpio_set_pin_output(CAPS_LOCK_LED_PIN); 9 matrix_init_user(); 10 } 11 12 bool led_update_kb(led_t led_state) { 13 // Only update if left half 14 if (isLeftHand && led_update_user(led_state)) { 15 gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock); 16 } 17 return true; 18 } 19 20 bool encoder_update_kb(uint8_t index, bool clockwise) { 21 if (!encoder_update_user(index, clockwise)) { return false; } 22 if (index == 0) { 23 if (clockwise) { 24 tap_code(KC_PGDN); 25 } else { 26 tap_code(KC_PGUP); 27 } 28 } else if (index == 1) { 29 if (clockwise) { 30 tap_code(KC_VOLU); 31 } else { 32 tap_code(KC_VOLD); 33 } 34 } else if (index == 2) { 35 if (clockwise) { 36 tap_code(KC_DOWN); 37 } else { 38 tap_code(KC_UP); 39 } 40 } 41 return false; 42 }