MDテスト用プログラム

Dependencies:   FastPWM GMD_template_lib mbed

Fork of NewMD2 by tarou yamada

Revision:
6:004e6174445a
Parent:
5:9d1b1948a9b6
Child:
7:9671d3ae163e
--- a/main.cpp	Sun Jul 03 03:15:31 2016 +0000
+++ b/main.cpp	Sun Jul 10 13:17:14 2016 +0000
@@ -35,11 +35,13 @@
             case I2CSlave::WriteAddressed:
                 i2c.read(&buf, 1);
                 
+                /*
                 float p = (buf & 0x80) ? -1.0f : 1.0f;
                 p *= (buf & 0x7F);
                 p *= 1.0f / 0x7F;
+                */
                 
-                md.set(p);
+                md.set(static_cast<int8_t>(buf) / 127.0f);
                 break;
                 
             case I2CSlave::NoData: