diff --git a/Arduino Examples/PMW3389DM-polling/PMW3389DM-polling.ino b/Arduino Examples/PMW3389DM-polling/PMW3389DM-polling.ino index 484a3d8..b9dc334 100644 --- a/Arduino Examples/PMW3389DM-polling/PMW3389DM-polling.ino +++ b/Arduino Examples/PMW3389DM-polling/PMW3389DM-polling.ino @@ -203,8 +203,8 @@ void UpdatePointer(void){ adns_write_reg(Motion, 0x01); adns_read_reg(Motion); - xydat[0] = (int)adns_read_reg(Delta_X_L); - xydat[1] = (int)adns_read_reg(Delta_Y_L); + xydat[0] = (int)adns_read_reg(Delta_X_L) | (int)adns_read_reg(Delta_X_H) << 8; + xydat[1] = (int)adns_read_reg(Delta_Y_L) | (int)adns_read_reg(Delta_Y_H) << 8; movementflag=1; } @@ -237,8 +237,8 @@ void dispRegisters(void){ int convTwosComp(int b){ //Convert from 2's complement - if(b & 0x80){ - b = -1 * ((b ^ 0xff) + 1); + if(b & 0x8000){ + b = -1 * ((b ^ 0xffff) + 1); } return b; }