Skip to content
New issue

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

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

Already on GitHub? # to your account

Can't get past initialize state #8

Open
vance opened this issue Feb 28, 2017 · 1 comment
Open

Can't get past initialize state #8

vance opened this issue Feb 28, 2017 · 1 comment

Comments

@vance
Copy link

vance commented Feb 28, 2017

In initialize, it never gets past write(0xff) only prints "try write". I think the pin never goes low, so it gets stuck in the loop:

while (digitalRead(_clock_pin)) {;}

Any advice?

Also, may want to change to include Arduino.h instead of WConstants or whatever.

void PS2Mouse::initialize() {
  Serial.println("initialize");
  pull_high(_clock_pin);
  pull_high(_data_pin);
  delay(20);
  Serial.println("try write");
  write(0xff); // Send Reset to the mouse
  Serial.println("end write");
  read_byte();  // Read ack byte 
  delay(20); // Not sure why this needs the delay
  read_byte();  // blank 
  read_byte();  // blank
  delay(20); // Not sure why this needs the delay
  if (_mode == REMOTE) {
    set_remote_mode();
  } else {
    enable_data_reporting(); // Tell the mouse to start sending data again
  }
  delayMicroseconds(100);
  _initialized = 1;

  Serial.println("done");
}
@kristopher
Copy link
Owner

kristopher commented Feb 28, 2017 via email

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants