diff options
Diffstat (limited to 'keyboards/bastardkb/charybdis/charybdis.h')
-rw-r--r-- | keyboards/bastardkb/charybdis/charybdis.h | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/keyboards/bastardkb/charybdis/charybdis.h b/keyboards/bastardkb/charybdis/charybdis.h new file mode 100644 index 000000000..42423c0c9 --- /dev/null +++ b/keyboards/bastardkb/charybdis/charybdis.h | |||
@@ -0,0 +1,126 @@ | |||
1 | /* | ||
2 | * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> | ||
3 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
4 | * | ||
5 | * This program is free software: you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation, either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #pragma once | ||
20 | |||
21 | // clang-format off | ||
22 | #if defined(KEYBOARD_bastardkb_charybdis_3x5) | ||
23 | # include "3x5.h" | ||
24 | #elif defined(KEYBOARD_bastardkb_charybdis_4x6) | ||
25 | # include "4x6.h" | ||
26 | #else | ||
27 | # error "Unsuported format" | ||
28 | #endif | ||
29 | // clang-format on | ||
30 | |||
31 | #include "quantum.h" | ||
32 | |||
33 | #ifdef POINTING_DEVICE_ENABLE | ||
34 | # ifndef NO_CHARYBDIS_KEYCODES | ||
35 | enum charybdis_keycodes { | ||
36 | # ifdef VIA_ENABLE | ||
37 | POINTER_DEFAULT_DPI_FORWARD = USER00, | ||
38 | # else | ||
39 | POINTER_DEFAULT_DPI_FORWARD = SAFE_RANGE, | ||
40 | # endif // VIA_ENABLE | ||
41 | POINTER_DEFAULT_DPI_REVERSE, | ||
42 | POINTER_SNIPING_DPI_FORWARD, | ||
43 | POINTER_SNIPING_DPI_REVERSE, | ||
44 | SNIPING_MODE, | ||
45 | SNIPING_MODE_TOGGLE, | ||
46 | DRAGSCROLL_MODE, | ||
47 | DRAGSCROLL_MODE_TOGGLE, | ||
48 | CHARYBDIS_SAFE_RANGE, | ||
49 | }; | ||
50 | |||
51 | # define DPI_MOD POINTER_DEFAULT_DPI_FORWARD | ||
52 | # define DPI_RMOD POINTER_DEFAULT_DPI_REVERSE | ||
53 | # define S_D_MOD POINTER_SNIPING_DPI_FORWARD | ||
54 | # define S_D_RMOD POINTER_SNIPING_DPI_REVERSE | ||
55 | # define SNIPING SNIPING_MODE | ||
56 | # define SNP_TOG SNIPING_MODE_TOGGLE | ||
57 | # define DRGSCRL DRAGSCROLL_MODE | ||
58 | # define DRG_TOG DRAGSCROLL_MODE_TOGGLE | ||
59 | # endif // !NO_CHARYBDIS_KEYCODES | ||
60 | |||
61 | /** \brief Return the current DPI value for the pointer's default mode. */ | ||
62 | uint16_t charybdis_get_pointer_default_dpi(void); | ||
63 | |||
64 | /** | ||
65 | * \brief Update the pointer's default DPI to the next or previous step. | ||
66 | * | ||
67 | * Increases the DPI value if `forward` is `true`, decreases it otherwise. | ||
68 | * The increment/decrement steps are equal to CHARYBDIS_DEFAULT_DPI_CONFIG_STEP. | ||
69 | * | ||
70 | * The new value is persisted in EEPROM. | ||
71 | */ | ||
72 | void charybdis_cycle_pointer_default_dpi(bool forward); | ||
73 | |||
74 | /** | ||
75 | * \brief Same as `charybdis_cycle_pointer_default_dpi`, but do not write to | ||
76 | * EEPROM. | ||
77 | * | ||
78 | * This means that reseting the board will revert the value to the last | ||
79 | * persisted one. | ||
80 | */ | ||
81 | void charybdis_cycle_pointer_default_dpi_noeeprom(bool forward); | ||
82 | |||
83 | /** \brief Return the current DPI value for the pointer's sniper-mode. */ | ||
84 | uint16_t charybdis_get_pointer_sniping_dpi(void); | ||
85 | |||
86 | /** | ||
87 | * \brief Update the pointer's sniper-mode DPI to the next or previous step. | ||
88 | * | ||
89 | * Increases the DPI value if `forward` is `true`, decreases it otherwise. | ||
90 | * The increment/decrement steps are equal to CHARYBDIS_SNIPING_DPI_CONFIG_STEP. | ||
91 | * | ||
92 | * The new value is persisted in EEPROM. | ||
93 | */ | ||
94 | void charybdis_cycle_pointer_sniping_dpi(bool forward); | ||
95 | |||
96 | /** | ||
97 | * \brief Same as `charybdis_cycle_pointer_sniping_dpi`, but do not write to | ||
98 | * EEPROM. | ||
99 | * | ||
100 | * This means that reseting the board will revert the value to the last | ||
101 | * persisted one. | ||
102 | */ | ||
103 | void charybdis_cycle_pointer_sniping_dpi_noeeprom(bool forward); | ||
104 | |||
105 | /** \brief Whether sniper-mode is enabled. */ | ||
106 | bool charybdis_get_pointer_sniping_enabled(void); | ||
107 | |||
108 | /** | ||
109 | * \brief Enable/disable sniper mode. | ||
110 | * | ||
111 | * When sniper mode is enabled the dpi is reduced to slow down the pointer for | ||
112 | * more accurate movements. | ||
113 | */ | ||
114 | void charybdis_set_pointer_sniping_enabled(bool enable); | ||
115 | |||
116 | /** \brief Whether drag-scroll is enabled. */ | ||
117 | bool charybdis_get_pointer_dragscroll_enabled(void); | ||
118 | |||
119 | /** | ||
120 | * \brief Enable/disable drag-scroll mode. | ||
121 | * | ||
122 | * When drag-scroll mode is enabled, horizontal and vertical pointer movements | ||
123 | * are translated into horizontal and vertical scroll movements. | ||
124 | */ | ||
125 | void charybdis_set_pointer_dragscroll_enabled(bool enable); | ||
126 | #endif // POINTING_DEVICE_ENABLE | ||