Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Moved I2C reply to request handler

A comment in the Wire.cpp file states that Wire.send() "must be called
in: slave tx event callback" (line 128-129) so the reply has been moved
to the request handler function (reqHandler).
  • Loading branch information...
commit d6f1efa65e40f3849532bcd016d904f9c4fdf232 1 parent ee09c3b
András Veres-Szentkirályi authored August 21, 2010

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  hack2o.pde
2  hack2o.pde
@@ -68,6 +68,7 @@ void recHandler(int numBytes) {
68 68
 }
69 69
 
70 70
 void reqHandler() {
  71
+	Wire.send(i2cmd);
71 72
 	letgo = 1;
72 73
 }
73 74
 
@@ -102,7 +103,6 @@ void loop() {
102 103
 	if (letgo) {
103 104
 		Serial.print("Received request CMD = ");
104 105
 		Serial.println(i2cmd, DEC);
105  
-		Wire.send(i2cmd);
106 106
 		if (i2cmd != 0) flow();
107 107
 		letgo = 0;
108 108
 	}

0 notes on commit d6f1efa

Please sign in to comment.
Something went wrong with that request. Please try again.