diff options
Diffstat (limited to 'keyboards/ploopyco/pmw3360.h')
-rw-r--r-- | keyboards/ploopyco/pmw3360.h | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/keyboards/ploopyco/pmw3360.h b/keyboards/ploopyco/pmw3360.h deleted file mode 100644 index c1d5e3bad..000000000 --- a/keyboards/ploopyco/pmw3360.h +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | /* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> | ||
2 | * Copyright 2019 Sunjun Kim | ||
3 | * Copyright 2020 Ploopy Corporation | ||
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 | #include "spi_master.h" | ||
22 | |||
23 | // Registers | ||
24 | #define REG_Product_ID 0x00 | ||
25 | #define REG_Revision_ID 0x01 | ||
26 | #define REG_Motion 0x02 | ||
27 | #define REG_Delta_X_L 0x03 | ||
28 | #define REG_Delta_X_H 0x04 | ||
29 | #define REG_Delta_Y_L 0x05 | ||
30 | #define REG_Delta_Y_H 0x06 | ||
31 | #define REG_SQUAL 0x07 | ||
32 | #define REG_Raw_Data_Sum 0x08 | ||
33 | #define REG_Maximum_Raw_data 0x09 | ||
34 | #define REG_Minimum_Raw_data 0x0A | ||
35 | #define REG_Shutter_Lower 0x0B | ||
36 | #define REG_Shutter_Upper 0x0C | ||
37 | #define REG_Control 0x0D | ||
38 | #define REG_Config1 0x0F | ||
39 | #define REG_Config2 0x10 | ||
40 | #define REG_Angle_Tune 0x11 | ||
41 | #define REG_Frame_Capture 0x12 | ||
42 | #define REG_SROM_Enable 0x13 | ||
43 | #define REG_Run_Downshift 0x14 | ||
44 | #define REG_Rest1_Rate_Lower 0x15 | ||
45 | #define REG_Rest1_Rate_Upper 0x16 | ||
46 | #define REG_Rest1_Downshift 0x17 | ||
47 | #define REG_Rest2_Rate_Lower 0x18 | ||
48 | #define REG_Rest2_Rate_Upper 0x19 | ||
49 | #define REG_Rest2_Downshift 0x1A | ||
50 | #define REG_Rest3_Rate_Lower 0x1B | ||
51 | #define REG_Rest3_Rate_Upper 0x1C | ||
52 | #define REG_Observation 0x24 | ||
53 | #define REG_Data_Out_Lower 0x25 | ||
54 | #define REG_Data_Out_Upper 0x26 | ||
55 | #define REG_Raw_Data_Dump 0x29 | ||
56 | #define REG_SROM_ID 0x2A | ||
57 | #define REG_Min_SQ_Run 0x2B | ||
58 | #define REG_Raw_Data_Threshold 0x2C | ||
59 | #define REG_Config5 0x2F | ||
60 | #define REG_Power_Up_Reset 0x3A | ||
61 | #define REG_Shutdown 0x3B | ||
62 | #define REG_Inverse_Product_ID 0x3F | ||
63 | #define REG_LiftCutoff_Tune3 0x41 | ||
64 | #define REG_Angle_Snap 0x42 | ||
65 | #define REG_LiftCutoff_Tune1 0x4A | ||
66 | #define REG_Motion_Burst 0x50 | ||
67 | #define REG_LiftCutoff_Tune_Timeout 0x58 | ||
68 | #define REG_LiftCutoff_Tune_Min_Length 0x5A | ||
69 | #define REG_SROM_Load_Burst 0x62 | ||
70 | #define REG_Lift_Config 0x63 | ||
71 | #define REG_Raw_Data_Burst 0x64 | ||
72 | #define REG_LiftCutoff_Tune2 0x65 | ||
73 | |||
74 | #ifdef CONSOLE_ENABLE | ||
75 | void print_byte(uint8_t byte); | ||
76 | #endif | ||
77 | |||
78 | typedef struct { | ||
79 | int8_t motion; | ||
80 | bool isMotion; // True if a motion is detected. | ||
81 | bool isOnSurface; // True when a chip is on a surface | ||
82 | int16_t dx; // displacement on x directions. Unit: Count. (CPI * Count = Inch value) | ||
83 | int8_t mdx; | ||
84 | int16_t dy; // displacement on y directions. | ||
85 | int8_t mdy; | ||
86 | } report_pmw_t; | ||
87 | |||
88 | |||
89 | |||
90 | bool spi_start_adv(void); | ||
91 | void spi_stop_adv(void); | ||
92 | spi_status_t spi_write_adv(uint8_t reg_addr, uint8_t data); | ||
93 | uint8_t spi_read_adv(uint8_t reg_addr); | ||
94 | bool pmw_spi_init(void); | ||
95 | void pmw_set_cpi(uint16_t cpi); | ||
96 | void pmw_upload_firmware(void); | ||
97 | bool pmw_check_signature(void); | ||
98 | report_pmw_t pmw_read_burst(void); | ||
99 | |||
100 | |||
101 | #define degToRad(angleInDegrees) ((angleInDegrees)*M_PI / 180.0) | ||
102 | #define radToDeg(angleInRadians) ((angleInRadians)*180.0 / M_PI) | ||
103 | #define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt))) | ||