Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix includes for pmw3360 driver #13108

Merged
merged 1 commit into from
Jun 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions keyboards/handwired/dactyl_manuform/5x6_right_trackball/pmw3360.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

#ifdef POINTING_DEVICE_ENABLE

#include "wait.h"
#include "debug.h"
#include "print.h"
#include "pmw3360.h"
#include "pmw3360_firmware.h"

#ifdef CONSOLE_ENABLE
# include "print.h"
#endif
bool _inBurst = false;

#ifndef PMW_CPI
Expand All @@ -36,10 +36,7 @@ bool _inBurst = false;
# define ROTATIONAL_TRANSFORM_ANGLE 0x00
#endif

#ifdef CONSOLE_ENABLE
void 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')); }
#endif


bool spi_start_adv(void) {
bool status = spi_start(SPI_SS_PIN, false, 3, SPI_DIVISOR);
Expand Down Expand Up @@ -173,9 +170,7 @@ bool pmw_check_signature(void) {

report_pmw_t pmw_read_burst(void) {
if (!_inBurst) {
#ifdef CONSOLE_ENABLE
dprintf("burst on");
#endif
spi_write_adv(REG_Motion_Burst, 0x00);
_inBurst = true;
}
Expand All @@ -200,14 +195,12 @@ report_pmw_t pmw_read_burst(void) {

spi_stop();

#ifdef CONSOLE_ENABLE
print_byte(data.motion);
print_byte(data.dx);
print_byte(data.mdx);
print_byte(data.dy);
print_byte(data.mdy);
dprintf("\n");
#endif

data.isMotion = (data.motion & 0x80) != 0;
data.isOnSurface = (data.motion & 0x08) == 0;
Expand Down
13 changes: 3 additions & 10 deletions keyboards/ploopyco/pmw3360.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


#include "wait.h"
#include "debug.h"
#include "print.h"
#include "pmw3360.h"
#include "pmw3360_firmware.h"

#ifdef CONSOLE_ENABLE
# include "print.h"
#endif
bool _inBurst = false;

#ifndef PMW_CPI
Expand All @@ -35,9 +34,7 @@ bool _inBurst = false;
# define ROTATIONAL_TRANSFORM_ANGLE 0x00
#endif

#ifdef CONSOLE_ENABLE
void 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')); }
#endif


bool spi_start_adv(void) {
Expand Down Expand Up @@ -172,9 +169,7 @@ bool pmw_check_signature(void) {

report_pmw_t pmw_read_burst(void) {
if (!_inBurst) {
#ifdef CONSOLE_ENABLE
dprintf("burst on");
#endif
spi_write_adv(REG_Motion_Burst, 0x00);
_inBurst = true;
}
Expand All @@ -199,14 +194,12 @@ report_pmw_t pmw_read_burst(void) {

spi_stop();

#ifdef CONSOLE_ENABLE
print_byte(data.motion);
print_byte(data.dx);
print_byte(data.mdx);
print_byte(data.dy);
print_byte(data.mdy);
dprintf("\n");
#endif

data.isMotion = (data.motion & 0x80) != 0;
data.isOnSurface = (data.motion & 0x08) == 0;
Expand Down