aboutsummaryrefslogtreecommitdiff
path: root/quantum/pointing_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/pointing_device.c')
-rw-r--r--quantum/pointing_device.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/quantum/pointing_device.c b/quantum/pointing_device.c
new file mode 100644
index 000000000..0aaab84cd
--- /dev/null
+++ b/quantum/pointing_device.c
@@ -0,0 +1,62 @@
1/*
2Copyright 2017 Joshua Broekhuijsen <snipeye+qmk@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include "report.h"
20#include "host.h"
21#include "timer.h"
22#include "print.h"
23#include "debug.h"
24#include "pointing_device.h"
25
26static report_mouse_t mouseReport = {};
27
28__attribute__ ((weak))
29void pointing_device_init(void){
30 //initialize device, if that needs to be done.
31}
32
33__attribute__ ((weak))
34void pointing_device_send(void){
35 //If you need to do other things, like debugging, this is the place to do it.
36 host_mouse_send(mouseReport);
37 //send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device
38 mouseReport.x = 0;
39 mouseReport.y = 0;
40 mouseReport.v = 0;
41 mouseReport.h = 0;
42}
43
44__attribute__ ((weak))
45void pointing_device_task(void){
46 //gather info and put it in:
47 //mouseReport.x = 127 max -127 min
48 //mouseReport.y = 127 max -127 min
49 //mouseReport.v = 127 max -127 min (scroll vertical)
50 //mouseReport.h = 127 max -127 min (scroll horizontal)
51 //mouseReport.buttons = 0x1F (decimal 31, binary 00011111) max (bitmask for mouse buttons 1-5, 1 is rightmost, 5 is leftmost) 0x00 min
52 //send the report
53 pointing_device_send();
54}
55
56report_mouse_t pointing_device_get_report(void){
57 return mouseReport;
58}
59
60void pointing_device_set_report(report_mouse_t newMouseReport){
61 mouseReport = newMouseReport;
62} \ No newline at end of file