Dependencies:   FastPWM GMD_template_lib mbed

Files at this revision

API Documentation at this revision

Comitter:
inst
Date:
Mon Sep 05 01:46:26 2016 +0000
Parent:
12:78fa1247aec4
Commit message:
timeout ?????

Changed in this revision

GMD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/GMD.lib	Thu Aug 25 00:39:37 2016 +0000
+++ b/GMD.lib	Mon Sep 05 01:46:26 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/inst/code/GMD_template_lib/#0d8dbe2671cd
+https://developer.mbed.org/users/inst/code/GMD_template_lib/#2fa9eeafd727
--- a/main.cpp	Thu Aug 25 00:39:37 2016 +0000
+++ b/main.cpp	Mon Sep 05 01:46:26 2016 +0000
@@ -29,6 +29,11 @@
     timer.start();
     
     while (true){
+        if (timer.read_ms() > timeout_ms) {
+            // I2Cの通信がタイムアウトしたなら開放
+            md.release();
+        }
+        
         char buf;
         switch (i2c.receive()){
             case I2CSlave::ReadAddressed:
@@ -46,10 +51,6 @@
                 break;
                 
             case I2CSlave::NoData:
-                if (timer.read_ms() > timeout_ms) {
-                    // I2Cの通信がタイムアウトしたなら開放
-                    md.release();
-                }
                 break;
         }
     }