Update RetroJoystickAdapter_WiiClassicController.ino

This commit is contained in:
mcgurk 2016-10-09 22:50:54 +03:00 committed by GitHub
parent 2167908636
commit a1d9b3a77f
1 changed files with 12 additions and 3 deletions

View File

@ -198,6 +198,10 @@ void setup() {
void loop() { void loop() {
#ifdef DEBUG
unsigned long t = micros();
#endif
Wire.requestFrom(ADDRESS, 6); //request data from wii classic Wire.requestFrom(ADDRESS, 6); //request data from wii classic
/*Serial.print(Wire.read(), HEX);Serial.print(" "); /*Serial.print(Wire.read(), HEX);Serial.print(" ");
Serial.print(Wire.read(), HEX);Serial.print(" "); Serial.print(Wire.read(), HEX);Serial.print(" ");
@ -215,7 +219,7 @@ void loop() {
} }
//detect if init is needed //detect if init is needed
if (i < 5) { if (i < 6) {
delay(100); delay(100);
sendByte(0x55, 0xF0); sendByte(0x55, 0xF0);
sendByte(0x00, 0xFB); sendByte(0x00, 0xFB);
@ -224,7 +228,10 @@ void loop() {
#endif #endif
delay(100); delay(100);
} else sendByte(0x00, 0x00); } else sendByte(0x00, 0x00);
#ifdef DEBUG
Serial.println(micros()-t);
#endif
/*for (uint8_t i = 0; i < 6; i++) { /*for (uint8_t i = 0; i < 6; i++) {
Joystick[0].data[i] = Wire.read(); Joystick[0].data[i] = Wire.read();
@ -284,6 +291,8 @@ void loop() {
Joystick[0].updateState(); Joystick[0].updateState();
Joystick[0].sendState(); Joystick[0].sendState();
//delay(100); // used to see changes in the serial monitor easier. #ifdef DEBUG
delay(100); // used to see changes in the serial monitor easier.
#endif
delayMicroseconds(1000); delayMicroseconds(1000);
} }