![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Dependencies: FastPWM GMD_template_lib mbed
Diff: main.cpp
- Revision:
- 13:7fac7b2f8fae
- Parent:
- 12:78fa1247aec4
--- 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; } }