change code by hasegawa

Dependents:   haseomni_main

Files at this revision

API Documentation at this revision

Comitter:
LVRhase01
Date:
Tue Sep 29 13:25:52 2020 +0000
Parent:
2:a93909601341
Commit message:
Add 0-point setting for Yaw axis and 6-axis mode code

Changed in this revision

jy901.cpp Show annotated file Show diff for this revision Revisions of this file
jy901.h Show annotated file Show diff for this revision Revisions of this file
--- a/jy901.cpp	Wed Aug 23 06:14:28 2017 +0000
+++ b/jy901.cpp	Tue Sep 29 13:25:52 2020 +0000
@@ -27,6 +27,18 @@
     char calibrationRegistar[3]= {CALSW,0x00,0x00};
     write(IICADDR,calibrationRegistar,3,false);
 }
+//ここより下は長谷川が追加しました。不必要な場合は教えてください。2020/09/29
+void JY901::yawcalibrate()
+{
+    char calibrationRegistar[3]= {0x01,0x04,0x00};
+    write(IICADDR,calibrationRegistar,3,false);
+}
+
+void JY901::algorithmtrasition()
+{
+    char calibrationRegistar[3]= {0x24,0x01,0x00};
+    write(IICADDR,calibrationRegistar,3,false);
+}
 
 void JY901::calibrateAll(int time)
 {
@@ -37,6 +49,11 @@
     calibrateHeight();
     wait_ms(time);
     endCalibrate();
+    wait_ms(time);
+    algorithmtrasition();
+    wait_ms(time);
+    yawcalibrate();
+    
 }
 
 float JY901::getXaxisAcceleration()
@@ -120,3 +137,4 @@
     read(IICADDR,data,2,false);
     return data;
 }
+
--- a/jy901.h	Wed Aug 23 06:14:28 2017 +0000
+++ b/jy901.h	Tue Sep 29 13:25:52 2020 +0000
@@ -39,6 +39,12 @@
     /** calibrate Gyroscope, Accelerometer and Magnetic
      *  set height to 0
      */
+    void yawcalibrate();
+    // reset yawaxis 
+    
+    void algorithmtrasition();
+    //change 6 axis
+    
     void calibrateAll(int time);
 
     /** return XaxisAcceleration