dilemma.h (3618B)
1 /** 2 * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly) 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 #pragma once 19 20 #include "quantum.h" 21 22 #ifdef POINTING_DEVICE_ENABLE 23 # ifndef NO_DILEMMA_KEYCODES 24 enum dilemma_keycodes { 25 POINTER_DEFAULT_DPI_FORWARD = QK_KB_0, 26 POINTER_DEFAULT_DPI_REVERSE, 27 POINTER_SNIPING_DPI_FORWARD, 28 POINTER_SNIPING_DPI_REVERSE, 29 SNIPING_MODE, 30 SNIPING_MODE_TOGGLE, 31 DRAGSCROLL_MODE, 32 DRAGSCROLL_MODE_TOGGLE, 33 }; 34 35 # define DPI_MOD POINTER_DEFAULT_DPI_FORWARD 36 # define DPI_RMOD POINTER_DEFAULT_DPI_REVERSE 37 # define S_D_MOD POINTER_SNIPING_DPI_FORWARD 38 # define S_D_RMOD POINTER_SNIPING_DPI_REVERSE 39 # define SNIPING SNIPING_MODE 40 # define SNP_TOG SNIPING_MODE_TOGGLE 41 # define DRGSCRL DRAGSCROLL_MODE 42 # define DRG_TOG DRAGSCROLL_MODE_TOGGLE 43 # endif // !NO_DILEMMA_KEYCODES 44 45 /** \brief Return the current DPI value for the pointer's default mode. */ 46 uint16_t dilemma_get_pointer_default_dpi(void); 47 48 /** 49 * \brief Update the pointer's default DPI to the next or previous step. 50 * 51 * Increases the DPI value if `forward` is `true`, decreases it otherwise. 52 * The increment/decrement steps are equal to DILEMMA_DEFAULT_DPI_CONFIG_STEP. 53 * 54 * The new value is persisted in EEPROM. 55 */ 56 void dilemma_cycle_pointer_default_dpi(bool forward); 57 58 /** 59 * \brief Same as `dilemma_cycle_pointer_default_dpi`, but do not write to 60 * EEPROM. 61 * 62 * This means that reseting the board will revert the value to the last 63 * persisted one. 64 */ 65 void dilemma_cycle_pointer_default_dpi_noeeprom(bool forward); 66 67 /** \brief Return the current DPI value for the pointer's sniper-mode. */ 68 uint16_t dilemma_get_pointer_sniping_dpi(void); 69 70 /** 71 * \brief Update the pointer's sniper-mode DPI to the next or previous step. 72 * 73 * Increases the DPI value if `forward` is `true`, decreases it otherwise. 74 * The increment/decrement steps are equal to DILEMMA_SNIPING_DPI_CONFIG_STEP. 75 * 76 * The new value is persisted in EEPROM. 77 */ 78 void dilemma_cycle_pointer_sniping_dpi(bool forward); 79 80 /** 81 * \brief Same as `dilemma_cycle_pointer_sniping_dpi`, but do not write to 82 * EEPROM. 83 * 84 * This means that reseting the board will revert the value to the last 85 * persisted one. 86 */ 87 void dilemma_cycle_pointer_sniping_dpi_noeeprom(bool forward); 88 89 /** \brief Whether sniper-mode is enabled. */ 90 bool dilemma_get_pointer_sniping_enabled(void); 91 92 /** 93 * \brief Enable/disable sniper mode. 94 * 95 * When sniper mode is enabled the dpi is reduced to slow down the pointer for 96 * more accurate movements. 97 */ 98 void dilemma_set_pointer_sniping_enabled(bool enable); 99 100 /** \brief Whether drag-scroll is enabled. */ 101 bool dilemma_get_pointer_dragscroll_enabled(void); 102 103 /** 104 * \brief Enable/disable drag-scroll mode. 105 * 106 * When drag-scroll mode is enabled, horizontal and vertical pointer movements 107 * are translated into horizontal and vertical scroll movements. 108 */ 109 void dilemma_set_pointer_dragscroll_enabled(bool enable); 110 #endif // POINTING_DEVICE_ENABLE