qmk_firmware

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

rev3.c (988B)


      1 // Copyright 2025 Danny Nguyen (@nooges)
      2 // SPDX-License-Identifier: GPL-2.0-or-later
      3 
      4 #include "quantum.h"
      5 
      6 void keyboard_pre_init_kb(void) {
      7     // Disable the PD peripheral in pre-init because its pins (B4, B6) are being used in the matrix:
      8     PWR->CR3 |= PWR_CR3_UCPD_DBDIS;
      9     // Call the corresponding _user() function (see https://docs.qmk.fm/#/custom_quantum_functions)
     10     keyboard_pre_init_user();
     11 }
     12 bool encoder_update_kb(uint8_t index, bool clockwise) {
     13     if (!encoder_update_user(index, clockwise)) { return false; }
     14     if (index == 0) {
     15         if (clockwise) {
     16             tap_code(KC_VOLU);
     17         } else {
     18             tap_code(KC_VOLD);
     19         }
     20     }
     21     else if (index == 1) {
     22         if (clockwise) {
     23             tap_code(KC_DOWN);
     24         } else {
     25             tap_code(KC_UP);
     26         }
     27     }
     28     else if (index == 2) {
     29         if (clockwise) {
     30             tap_code(KC_PGDN);
     31         } else {
     32             tap_code(KC_PGUP);
     33         }
     34     }
     35     return false;
     36 }