tiz

Dependencies:   TextLCD X_NUCLEO_IKS01A1 func mbed-src mbed

Fork of mas by esproj

func/Config.cpp

Committer:
herenvarno
Date:
2015-12-10
Revision:
1:1df80fe13928

File content as of revision 1:1df80fe13928:

#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);
}