diff options
author | JohSchneider <JohSchneider@googlemail.com> | 2021-08-05 21:51:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-06 07:51:24 +1000 |
commit | bcb6e23387290afb64712314bfb095f8d96c1a4e (patch) | |
tree | c82814bce65ba34e28d7df885f23dd083d3c73d2 /tmk_core/protocol/ps2_mouse.c | |
parent | 5bbc527460462fb9961fbd9f972cd5e1c49558da (diff) | |
download | qmk_firmware-bcb6e23387290afb64712314bfb095f8d96c1a4e.tar.gz qmk_firmware-bcb6e23387290afb64712314bfb095f8d96c1a4e.zip |
Arm ps2 mouse interrupt (#6490)
* ps2_mouse on ARM: an interrupt-version of the ps2-mouse code ported to ARM/chibios
* ps2_mouse on ARM: link EXT callback-channel selection to the user defined PS2_LINE_CLOCK
* ps2_mouse on ARM: replace DELAY_X defines with hardware-agnostic wait_X
* ps2_mouse on ARM: replace chibios-specific defines for the pins/lines with defines from quantum/config_common.h
and drop the '_LINE' component from teh define name
* ps2_mouse on ARM: expose the software-intterupt port as a user editable define
* Update docs/feature_ps2_mouse.md
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
* Update feature_ps2_mouse.md
* use a define to deduce the PS_DATA_PORT instead
* reduce all-zero extcfg to oneliner
* ps2_mouse: use generic wait instead of avr-delay
* Update docs/feature_ps2_mouse.md
* ps2_mouse: changes for new chibios version
(17.6.0 -> 19.1.0)
replacing the legacy externa-interrupt driver with pal-callbacks
* ps2_mouse: use PLATFORM_KEY
Co-Authored-By: Joel Challis <git@zvecr.com>
* ps2_mouse: clang-format corrections
* ps2_mouse: add systemlocks
using the chibios equivalent to AVRs cli: chSys[Unl|L]ock
Co-authored-by: Johannes <you@example.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Joel Challis <git@zvecr.com>
Diffstat (limited to 'tmk_core/protocol/ps2_mouse.c')
-rw-r--r-- | tmk_core/protocol/ps2_mouse.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c index 5415453a0..525aeb45a 100644 --- a/tmk_core/protocol/ps2_mouse.c +++ b/tmk_core/protocol/ps2_mouse.c | |||
@@ -16,9 +16,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <stdbool.h> | 18 | #include <stdbool.h> |
19 | #include <avr/io.h> | 19 | |
20 | #include <util/delay.h> | 20 | #if defined(__AVR__) |
21 | # include <avr/io.h> | ||
22 | #endif | ||
23 | |||
21 | #include "ps2_mouse.h" | 24 | #include "ps2_mouse.h" |
25 | #include "wait.h" | ||
22 | #include "host.h" | 26 | #include "host.h" |
23 | #include "timer.h" | 27 | #include "timer.h" |
24 | #include "print.h" | 28 | #include "print.h" |
@@ -42,7 +46,7 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report); | |||
42 | void ps2_mouse_init(void) { | 46 | void ps2_mouse_init(void) { |
43 | ps2_host_init(); | 47 | ps2_host_init(); |
44 | 48 | ||
45 | _delay_ms(PS2_MOUSE_INIT_DELAY); // wait for powering up | 49 | wait_ms(PS2_MOUSE_INIT_DELAY); // wait for powering up |
46 | 50 | ||
47 | PS2_MOUSE_SEND(PS2_MOUSE_RESET, "ps2_mouse_init: sending reset"); | 51 | PS2_MOUSE_SEND(PS2_MOUSE_RESET, "ps2_mouse_init: sending reset"); |
48 | 52 | ||
@@ -210,7 +214,7 @@ static inline void ps2_mouse_enable_scrolling(void) { | |||
210 | PS2_MOUSE_SEND(PS2_MOUSE_SET_SAMPLE_RATE, "Set sample rate"); | 214 | PS2_MOUSE_SEND(PS2_MOUSE_SET_SAMPLE_RATE, "Set sample rate"); |
211 | PS2_MOUSE_SEND(80, "80"); | 215 | PS2_MOUSE_SEND(80, "80"); |
212 | PS2_MOUSE_SEND(PS2_MOUSE_GET_DEVICE_ID, "Finished enabling scroll wheel"); | 216 | PS2_MOUSE_SEND(PS2_MOUSE_GET_DEVICE_ID, "Finished enabling scroll wheel"); |
213 | _delay_ms(20); | 217 | wait_ms(20); |
214 | } | 218 | } |
215 | 219 | ||
216 | #define PRESS_SCROLL_BUTTONS mouse_report->buttons |= (PS2_MOUSE_SCROLL_BTN_MASK) | 220 | #define PRESS_SCROLL_BUTTONS mouse_report->buttons |= (PS2_MOUSE_SCROLL_BTN_MASK) |
@@ -252,7 +256,7 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) { | |||
252 | if (scroll_state == SCROLL_BTN && timer_elapsed(scroll_button_time) < PS2_MOUSE_SCROLL_BTN_SEND) { | 256 | if (scroll_state == SCROLL_BTN && timer_elapsed(scroll_button_time) < PS2_MOUSE_SCROLL_BTN_SEND) { |
253 | PRESS_SCROLL_BUTTONS; | 257 | PRESS_SCROLL_BUTTONS; |
254 | host_mouse_send(mouse_report); | 258 | host_mouse_send(mouse_report); |
255 | _delay_ms(100); | 259 | wait_ms(100); |
256 | RELEASE_SCROLL_BUTTONS; | 260 | RELEASE_SCROLL_BUTTONS; |
257 | } | 261 | } |
258 | #endif | 262 | #endif |