tiz

Dependents:   mas

Revision:
0:d60c26d5fddc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Config.cpp	Wed Sep 14 08:55:41 2016 +0000
@@ -0,0 +1,23 @@
+#include "Config.h"
+
+Config::Config(char *filename)
+{
+    FILE *fp = fopen(filename, "r+");
+    if(!fp)
+    {
+        raise_error(ERROR_CONFIG);
+    }
+    strcpy(this->__filename, filename);
+    fclose(fp);
+}
+
+void Config::write()
+{
+    FILE *fp = fopen(this->__filename, "w+");
+    if(!fp)
+    {
+        raise_error(ERROR_CONFIG);
+    }
+    fprintf(fp, "%d %d %d\n%d %d %d\n%d %d %d", this->__acc_offset[0], __acc_offset[1], __acc_offset[2], this->__gyo_offset[0], this->__gyo_offset[1], this->__gyo_offset[2], this->__mag_offset[0], this->__mag_offset[1], this->__mag_offset[2]);
+    fclose(fp);
+}
\ No newline at end of file