2Chx3dof Magnetrometer supported M-Series Random Sequence Generator Servo Control

Dependencies:   mbed

Sampling Frequency

Sampling Frequency in main.cpp

#define SampleFreq     200   // [Hz]

Auto Stop Setting

Auto-stop Timer 15sec after

    // auto-stop when 15sec after
    if(smpl_cnt>3000){stop_dump();}

The number of 3000 means Sample Count. The number is given by SampleFreq[Hz] * Auto-Stop Time [sec].

M-Series Random Sequence

M-series Random Update Term in main.cpp

// M-series update flag
#define  M_TERM  200;

Unit is sample count.

cf.) 200 equals to 200 [samples] which equals to 1 [second] where SampleFreq = 200 [Hz}.

See above.

M-Series Random Servo Control

Branch:
MPU-9250-MagSensServo
Revision:
9:b32312aacbba
Parent:
8:07c3cb01a5b6
--- a/M-Series.h	Tue Feb 02 17:12:57 2021 +0000
+++ b/M-Series.h	Tue Feb 02 17:24:02 2021 +0000
@@ -54,47 +54,26 @@
         // Maximum-Length Tap Position and Number of taps
         // http://www5b.biglobe.ne.jp/~pisan/radio-Msequence.htm
         //
-        H[0] = 1; 
+        H[0] = 1;
         H[1] = 0;
         H[2] = 1;
         H[3] = 0;
-        
-        H[4] = 0; 
+
+        H[4] = 0;
         H[5] = 0;
         H[6] = 0;
         H[7] = 0;
-        
-        H[8]  = 0; 
+
+        H[8]  = 0;
         H[9]  = 0;
         H[10] = 0;
         H[11] = 1;
-        
+
         H[12] = 0;
         H[13] = 0;
         H[14] = 0;
         H[15] = 1;
-        //
-//        
-//        // 0806(HEX) = [latest] 0001 1111 0101 0000 (2) [oldest]
-//        H[0] = 0; // 0000 (oldest)
-//        H[1] = 0;
-//        H[2] = 0;
-//        H[3] = 0;
-//        
-//        H[4] = 1; // 0101
-//        H[5] = 0;
-//        H[6] = 1;
-//        H[7] = 0;
-//        
-//        H[8]  = 1; // 1111 
-//        H[9]  = 1;
-//        H[10] = 1;
-//        H[11] = 1;
-//        
-//        H[12] = 1; // 0001 
-//        H[13] = 0;
-//        H[14] = 0;
-//        H[15] = 0;
+
     }
 
     uint8_t update(void)
@@ -117,7 +96,12 @@
         // store the latest value at the last
         M[MSeries_N - 1] = Mtmp;
 
-        return Mtmp;
+        return get();
+    }
+
+    uint8_t get(void)
+    {
+        return M[15];
     }
 };