some cleaning of imu
[protos/imu.git] / MadgwickAHRS.h
index 18e19fa..018f34a 100644 (file)
@@ -1,6 +1,25 @@
-//=====================================================================================================\r
+/*\r
+ * Copyright (c) 2014, Olivier MATZ <zer0@droids-corp.org>\r
+ * Copyright (c) 2011, SOH Madgwick\r
+ *\r
+ *  This program is free software: you can redistribute it and/or modify\r
+ *  it under the terms of the GNU General Public License as published by\r
+ *  the Free Software Foundation, either version 3 of the License, or\r
+ *  (at your option) any later version.\r
+ *\r
+ *  This program is distributed in the hope that it will be useful,\r
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ *  GNU General Public License for more details.\r
+ *\r
+ *  You should have received a copy of the GNU General Public License\r
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
+ *\r
+ */\r
+\r
+//=============================================================================\r
 // MadgwickAHRS.h\r
-//=====================================================================================================\r
+//=============================================================================\r
 //\r
 // Implementation of Madgwick's IMU and AHRS algorithms.\r
 // See: http://www.x-io.co.uk/node/8#open_source_ahrs_and_imu_algorithms\r
 // 29/09/2011  SOH Madgwick    Initial release\r
 // 02/10/2011  SOH Madgwick    Optimised for reduced CPU load\r
 //\r
-//=====================================================================================================\r
+//=============================================================================\r
+\r
 #ifndef MadgwickAHRS_h\r
 #define MadgwickAHRS_h\r
 \r
-//----------------------------------------------------------------------------------------------------\r
-// Variable declaration\r
+#include "imu.h"\r
 \r
-extern volatile float beta;                            // algorithm gain\r
-extern volatile float q0, q1, q2, q3;  // quaternion of sensor frame relative to auxiliary frame\r
+extern volatile float beta;  // algorithm gain\r
 \r
-//---------------------------------------------------------------------------------------------------\r
-// Function declarations\r
+/* update quaternion structure using the new IMU infos */\r
+void MadgwickAHRSupdate(const struct imu_info *imu, struct quaternion *quat);\r
 \r
-void MadgwickAHRSupdate(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz);\r
-void MadgwickAHRSupdateIMU(float gx, float gy, float gz, float ax, float ay, float az);\r
-void Mad_f32_init(void);\r
-void MadgwickAHRSupdateIMU_f32(float gx, float gy, float gz, float ax, float ay, float az);\r
+/* update quaternion structure using the new IMU infos, without using magneto */\r
+void MadgwickAHRSupdateIMU(const struct imu_info *imu, struct quaternion *quat);\r
 \r
 #endif\r
-//=====================================================================================================\r
-// End of file\r
-//=====================================================================================================\r