qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

rev2.c (907B)


      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 #ifdef ENCODER_ENABLE
     21 bool encoder_update_kb(uint8_t index, bool clockwise) {
     22     if (!encoder_update_user(index, clockwise)) { return false; }
     23     if (index == 0) {
     24         if (clockwise) {
     25             tap_code(KC_PGDN);
     26         } else {
     27             tap_code(KC_PGUP);
     28         }
     29     } else if (index == 1) {
     30         if (clockwise) {
     31             tap_code(KC_VOLU);
     32         } else {
     33             tap_code(KC_VOLD);
     34         }
     35     }
     36     return false;
     37 }
     38 #endif