at master 1.1 kB view raw
1/* 2Copyright 2021 Thomas Weißschuh <thomas@t-8ch.de> 3 4This program is free software: you can redistribute it and/or modify 5it under the terms of the GNU General Public License as published by 6the Free Software Foundation, either version 2 of the License, or 7(at your option) any later version. 8 9This program is distributed in the hope that it will be useful, 10but WITHOUT ANY WARRANTY; without even the implied warranty of 11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12GNU General Public License for more details. 13 14You should have received a copy of the GNU General Public License 15along with this program. If not, see <http://www.gnu.org/licenses/>. 16*/ 17 18#include "process_programmable_button.h" 19#include "programmable_button.h" 20 21bool process_programmable_button(uint16_t keycode, keyrecord_t *record) { 22 if (IS_QK_PROGRAMMABLE_BUTTON(keycode)) { 23 uint8_t button = keycode - QK_PROGRAMMABLE_BUTTON + 1; 24 if (record->event.pressed) { 25 programmable_button_register(button); 26 } else { 27 programmable_button_unregister(button); 28 } 29 } 30 return true; 31}