NIT Fukui / Serial6050Yaw

Dependents:   R1Arobo_Maika_B 2021Arobo_UMAPYOI 2021Arobo_YUMIPYOI

Revision:
4:413d60ebdcf2
Parent:
3:601cfc41e50a
diff -r 601cfc41e50a -r 413d60ebdcf2 Serial6050.cpp
--- a/Serial6050.cpp	Wed Apr 17 07:57:05 2019 +0000
+++ b/Serial6050.cpp	Wed Sep 18 07:52:24 2019 +0000
@@ -3,13 +3,17 @@
 Serial6050::Serial6050(PinName tx, PinName rx, PinName resetPin)
     : serial(tx, rx, 38400), rst(resetPin), Deg(0), Bias(0)
 {
+    if (resetPin == NC) useResetPin = false;
+    else useResetPin = true;
 }
 
 void Serial6050::init()
 {
-    rst = 1;
-    wait(0.5);
-    rst = 0;
+    if (useResetPin) {
+        rst = 1;
+        wait(0.1);
+        rst = 0;
+    }
     while(1) {
         serial.putc(100);
         if(serial.readable()) {
@@ -17,7 +21,7 @@
         }
     }
     serial.attach(this, &Serial6050::intReceive, RawSerial::RxIrq);
-    wait(0.1);
+    wait(1);
     reset();
 }