aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-06-05 08:08:35 -0700
committerGitHub <noreply@github.com>2021-06-05 08:08:35 -0700
commit770a3349bed397967dae159501ebc7a4ab1fadde (patch)
treed03db6c80671c51f13e73364f454ddaab419e823
parentc7c9f3e3cfc5e662a36edf67cd5dfe6b20d433a2 (diff)
downloadqmk_firmware-770a3349bed397967dae159501ebc7a4ab1fadde.tar.gz
qmk_firmware-770a3349bed397967dae159501ebc7a4ab1fadde.zip
Fix includes for pmw3360 driver (#13108)
-rw-r--r--keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.c13
-rw-r--r--keyboards/ploopyco/pmw3360.c13
2 files changed, 6 insertions, 20 deletions
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.c b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.c
index 9b6d93207..59e349512 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.c
+++ b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.c
@@ -18,12 +18,12 @@
18 18
19#ifdef POINTING_DEVICE_ENABLE 19#ifdef POINTING_DEVICE_ENABLE
20 20
21#include "wait.h"
22#include "debug.h"
23#include "print.h"
21#include "pmw3360.h" 24#include "pmw3360.h"
22#include "pmw3360_firmware.h" 25#include "pmw3360_firmware.h"
23 26
24#ifdef CONSOLE_ENABLE
25# include "print.h"
26#endif
27bool _inBurst = false; 27bool _inBurst = false;
28 28
29#ifndef PMW_CPI 29#ifndef PMW_CPI
@@ -36,10 +36,7 @@ bool _inBurst = false;
36# define ROTATIONAL_TRANSFORM_ANGLE 0x00 36# define ROTATIONAL_TRANSFORM_ANGLE 0x00
37#endif 37#endif
38 38
39#ifdef CONSOLE_ENABLE
40void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); } 39void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); }
41#endif
42
43 40
44bool spi_start_adv(void) { 41bool spi_start_adv(void) {
45 bool status = spi_start(SPI_SS_PIN, false, 3, SPI_DIVISOR); 42 bool status = spi_start(SPI_SS_PIN, false, 3, SPI_DIVISOR);
@@ -173,9 +170,7 @@ bool pmw_check_signature(void) {
173 170
174report_pmw_t pmw_read_burst(void) { 171report_pmw_t pmw_read_burst(void) {
175 if (!_inBurst) { 172 if (!_inBurst) {
176#ifdef CONSOLE_ENABLE
177 dprintf("burst on"); 173 dprintf("burst on");
178#endif
179 spi_write_adv(REG_Motion_Burst, 0x00); 174 spi_write_adv(REG_Motion_Burst, 0x00);
180 _inBurst = true; 175 _inBurst = true;
181 } 176 }
@@ -200,14 +195,12 @@ report_pmw_t pmw_read_burst(void) {
200 195
201 spi_stop(); 196 spi_stop();
202 197
203#ifdef CONSOLE_ENABLE
204 print_byte(data.motion); 198 print_byte(data.motion);
205 print_byte(data.dx); 199 print_byte(data.dx);
206 print_byte(data.mdx); 200 print_byte(data.mdx);
207 print_byte(data.dy); 201 print_byte(data.dy);
208 print_byte(data.mdy); 202 print_byte(data.mdy);
209 dprintf("\n"); 203 dprintf("\n");
210#endif
211 204
212 data.isMotion = (data.motion & 0x80) != 0; 205 data.isMotion = (data.motion & 0x80) != 0;
213 data.isOnSurface = (data.motion & 0x08) == 0; 206 data.isOnSurface = (data.motion & 0x08) == 0;
diff --git a/keyboards/ploopyco/pmw3360.c b/keyboards/ploopyco/pmw3360.c
index 8007fecef..5f9f72a9e 100644
--- a/keyboards/ploopyco/pmw3360.c
+++ b/keyboards/ploopyco/pmw3360.c
@@ -16,13 +16,12 @@
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 19#include "wait.h"
20#include "debug.h"
21#include "print.h"
20#include "pmw3360.h" 22#include "pmw3360.h"
21#include "pmw3360_firmware.h" 23#include "pmw3360_firmware.h"
22 24
23#ifdef CONSOLE_ENABLE
24# include "print.h"
25#endif
26bool _inBurst = false; 25bool _inBurst = false;
27 26
28#ifndef PMW_CPI 27#ifndef PMW_CPI
@@ -35,9 +34,7 @@ bool _inBurst = false;
35# define ROTATIONAL_TRANSFORM_ANGLE 0x00 34# define ROTATIONAL_TRANSFORM_ANGLE 0x00
36#endif 35#endif
37 36
38#ifdef CONSOLE_ENABLE
39void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); } 37void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); }
40#endif
41 38
42 39
43bool spi_start_adv(void) { 40bool spi_start_adv(void) {
@@ -172,9 +169,7 @@ bool pmw_check_signature(void) {
172 169
173report_pmw_t pmw_read_burst(void) { 170report_pmw_t pmw_read_burst(void) {
174 if (!_inBurst) { 171 if (!_inBurst) {
175#ifdef CONSOLE_ENABLE
176 dprintf("burst on"); 172 dprintf("burst on");
177#endif
178 spi_write_adv(REG_Motion_Burst, 0x00); 173 spi_write_adv(REG_Motion_Burst, 0x00);
179 _inBurst = true; 174 _inBurst = true;
180 } 175 }
@@ -199,14 +194,12 @@ report_pmw_t pmw_read_burst(void) {
199 194
200 spi_stop(); 195 spi_stop();
201 196
202#ifdef CONSOLE_ENABLE
203 print_byte(data.motion); 197 print_byte(data.motion);
204 print_byte(data.dx); 198 print_byte(data.dx);
205 print_byte(data.mdx); 199 print_byte(data.mdx);
206 print_byte(data.dy); 200 print_byte(data.dy);
207 print_byte(data.mdy); 201 print_byte(data.mdy);
208 dprintf("\n"); 202 dprintf("\n");
209#endif
210 203
211 data.isMotion = (data.motion & 0x80) != 0; 204 data.isMotion = (data.motion & 0x80) != 0;
212 data.isOnSurface = (data.motion & 0x08) == 0; 205 data.isOnSurface = (data.motion & 0x08) == 0;