qmk_firmware

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

charybdis.h (3098B)


      1 // Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com>
      2 // Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly)
      3 // SPDX-License-Identifier: GPL-2.0-or-later
      4 #pragma once
      5 
      6 #include "quantum.h"
      7 
      8 #ifdef POINTING_DEVICE_ENABLE
      9 #    ifndef NO_CHARYBDIS_KEYCODES
     10 enum charybdis_keycodes {
     11     POINTER_DEFAULT_DPI_FORWARD = QK_KB_0,
     12     POINTER_DEFAULT_DPI_REVERSE,
     13     POINTER_SNIPING_DPI_FORWARD,
     14     POINTER_SNIPING_DPI_REVERSE,
     15     SNIPING_MODE,
     16     SNIPING_MODE_TOGGLE,
     17     DRAGSCROLL_MODE,
     18     DRAGSCROLL_MODE_TOGGLE,
     19 };
     20 
     21 #        define DPI_MOD POINTER_DEFAULT_DPI_FORWARD
     22 #        define DPI_RMOD POINTER_DEFAULT_DPI_REVERSE
     23 #        define S_D_MOD POINTER_SNIPING_DPI_FORWARD
     24 #        define S_D_RMOD POINTER_SNIPING_DPI_REVERSE
     25 #        define SNIPING SNIPING_MODE
     26 #        define SNP_TOG SNIPING_MODE_TOGGLE
     27 #        define DRGSCRL DRAGSCROLL_MODE
     28 #        define DRG_TOG DRAGSCROLL_MODE_TOGGLE
     29 #    endif // !NO_CHARYBDIS_KEYCODES
     30 
     31 /** \brief Return the current DPI value for the pointer's default mode. */
     32 uint16_t charybdis_get_pointer_default_dpi(void);
     33 
     34 /**
     35  * \brief Update the pointer's default DPI to the next or previous step.
     36  *
     37  * Increases the DPI value if `forward` is `true`, decreases it otherwise.
     38  * The increment/decrement steps are equal to CHARYBDIS_DEFAULT_DPI_CONFIG_STEP.
     39  *
     40  * The new value is persisted in EEPROM.
     41  */
     42 void charybdis_cycle_pointer_default_dpi(bool forward);
     43 
     44 /**
     45  * \brief Same as `charybdis_cycle_pointer_default_dpi`, but do not write to
     46  * EEPROM.
     47  *
     48  * This means that reseting the board will revert the value to the last
     49  * persisted one.
     50  */
     51 void charybdis_cycle_pointer_default_dpi_noeeprom(bool forward);
     52 
     53 /** \brief Return the current DPI value for the pointer's sniper-mode. */
     54 uint16_t charybdis_get_pointer_sniping_dpi(void);
     55 
     56 /**
     57  * \brief Update the pointer's sniper-mode DPI to the next or previous step.
     58  *
     59  * Increases the DPI value if `forward` is `true`, decreases it otherwise.
     60  * The increment/decrement steps are equal to CHARYBDIS_SNIPING_DPI_CONFIG_STEP.
     61  *
     62  * The new value is persisted in EEPROM.
     63  */
     64 void charybdis_cycle_pointer_sniping_dpi(bool forward);
     65 
     66 /**
     67  * \brief Same as `charybdis_cycle_pointer_sniping_dpi`, but do not write to
     68  * EEPROM.
     69  *
     70  * This means that reseting the board will revert the value to the last
     71  * persisted one.
     72  */
     73 void charybdis_cycle_pointer_sniping_dpi_noeeprom(bool forward);
     74 
     75 /** \brief Whether sniper-mode is enabled. */
     76 bool charybdis_get_pointer_sniping_enabled(void);
     77 
     78 /**
     79  * \brief Enable/disable sniper mode.
     80  *
     81  * When sniper mode is enabled the dpi is reduced to slow down the pointer for
     82  * more accurate movements.
     83  */
     84 void charybdis_set_pointer_sniping_enabled(bool enable);
     85 
     86 /** \brief Whether drag-scroll is enabled. */
     87 bool charybdis_get_pointer_dragscroll_enabled(void);
     88 
     89 /**
     90  * \brief Enable/disable drag-scroll mode.
     91  *
     92  * When drag-scroll mode is enabled, horizontal and vertical pointer movements
     93  * are translated into horizontal and vertical scroll movements.
     94  */
     95 void charybdis_set_pointer_dragscroll_enabled(bool enable);
     96 #endif // POINTING_DEVICE_ENABLE