4x6_4.c (2270B)
1 /** 2 * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) 3 * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> 4 * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly) 5 * Copyright 2023 casuanoob <casuanoob@hotmail.com> (@casuanoob) 6 * 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Publicw License as published by 9 * the Free Software Foundation, either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #include "dilemma.h" 22 23 #ifdef SWAP_HANDS_ENABLE 24 const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { 25 /* Left hand, matrix positions */ 26 {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}}, 27 {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}, 28 {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}}, 29 {{0, 8}, {1, 8}, {2, 8}, {3, 8}, {4, 8}, {5, 8}}, 30 {{0, 9}, {1, 9}, {2, 9}, {3, 9}, {4, 9}, {5, 9}}, 31 /* Right hand, matrix positions */ 32 {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}, 33 {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}}, 34 {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}}, 35 {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}}, 36 {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}} 37 }; 38 39 # ifdef ENCODER_MAP_ENABLE 40 const uint8_t PROGMEM encoder_hand_swap_config[NUM_ENCODERS] = {1, 0}; 41 # endif 42 #endif 43 44 #ifdef ENCODER_ENABLE 45 bool encoder_update_kb(uint8_t index, bool clockwise) { 46 if (!encoder_update_user(index, clockwise)) { 47 return false; 48 } 49 switch (index) { 50 case 0: // Left-half encoder, mouse scroll. 51 tap_code(clockwise ? MS_WHLD : MS_WHLU); 52 break; 53 case 1: // Right-half encoder, volume control. 54 tap_code(clockwise ? KC_AUDIO_VOL_UP : KC_AUDIO_VOL_DOWN); 55 break; 56 } 57 return true; 58 } 59 #endif // ENCODER_ENABLE