qmk_firmware

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

keymap.c (1874B)


      1 /* Copyright 2021 Glorious, LLC <salman@pcgamingrace.com>
      2  * Modified 2022 by rustedaperture for qmk_firmware
      3 
      4 This program is free software: you can redistribute it and/or modify
      5 it under the terms of the GNU General Public License as published by
      6 the Free Software Foundation, either version 2 of the License, or
      7 (at your option) any later version.
      8 
      9 This program is distributed in the hope that it will be useful,
     10 but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 GNU General Public License for more details.
     13 
     14 You should have received a copy of the GNU General Public License
     15 along with this program.  If not, see <http://www.gnu.org/licenses/>.
     16 */
     17 
     18 #include QMK_KEYBOARD_H
     19 #include "analog.h"
     20 #include "qmk_midi.h"
     21 
     22 // clang-format off
     23 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     24 
     25 //      NUM      /       *       -
     26 //      7        8       9       +
     27 //      4        5       6       ENCODER
     28 //      1        2       3       RET
     29 //      0                        .
     30 
     31   [0] = LAYOUT(
     32     MO(1),   KC_PSLS,   KC_PAST,   KC_PMNS,
     33     KC_P7,   KC_P8,     KC_P9,     KC_PPLS,
     34     KC_P4,   KC_P5,     KC_P6,     KC_CALC,
     35     KC_P1,   KC_P2,     KC_P3,     KC_PENT,
     36     KC_P0,                         KC_PDOT
     37   ),
     38   [1] = LAYOUT(
     39     _______,   KC_PSLS,   KC_PAST,   KC_PMNS,
     40     KC_P7,     RM_VALU,   KC_P9,     KC_PPLS,
     41     RM_PREV,   KC_P5,     RM_NEXT,   KC_CALC,
     42     KC_P1,     RM_VALD,   KC_P3,     KC_PENT,
     43     RM_TOGG,                         QK_BOOT
     44   )
     45 };
     46 
     47 // Potentiometer Slider, MIDI Control
     48 
     49 uint8_t divisor = 0;
     50 
     51 void slider(void) {
     52     if (divisor++) { /* only run the slider function 1/256 times it's called */
     53         return;
     54     }
     55     midi_send_cc(&midi_device, 2, 0x3E, 0x7F + (analogReadPin(SLIDER_PIN) >> 3));
     56 }
     57 
     58 void housekeeping_task_user(void) {
     59     slider();
     60 }