tiz
Dependencies: TextLCD X_NUCLEO_IKS01A1 func mbed-src mbed
Fork of mas by
func/Config.cpp@5:100310ea8fba, 2016-08-23 (annotated)
- Committer:
- herenvarno
- Date:
- Tue Aug 23 15:59:59 2016 +0000
- Revision:
- 5:100310ea8fba
- Parent:
- 1:1df80fe13928
final
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
herenvarno | 1:1df80fe13928 | 1 | #include "Config.h" |
herenvarno | 1:1df80fe13928 | 2 | |
herenvarno | 1:1df80fe13928 | 3 | Config::Config(char *filename) |
herenvarno | 1:1df80fe13928 | 4 | { |
herenvarno | 1:1df80fe13928 | 5 | FILE *fp = fopen(filename, "r+"); |
herenvarno | 1:1df80fe13928 | 6 | if(!fp) |
herenvarno | 1:1df80fe13928 | 7 | { |
herenvarno | 1:1df80fe13928 | 8 | raise_error(ERROR_CONFIG); |
herenvarno | 1:1df80fe13928 | 9 | } |
herenvarno | 1:1df80fe13928 | 10 | strcpy(this->__filename, filename); |
herenvarno | 1:1df80fe13928 | 11 | fclose(fp); |
herenvarno | 1:1df80fe13928 | 12 | } |
herenvarno | 1:1df80fe13928 | 13 | |
herenvarno | 1:1df80fe13928 | 14 | void Config::write() |
herenvarno | 1:1df80fe13928 | 15 | { |
herenvarno | 1:1df80fe13928 | 16 | FILE *fp = fopen(this->__filename, "w+"); |
herenvarno | 1:1df80fe13928 | 17 | if(!fp) |
herenvarno | 1:1df80fe13928 | 18 | { |
herenvarno | 1:1df80fe13928 | 19 | raise_error(ERROR_CONFIG); |
herenvarno | 1:1df80fe13928 | 20 | } |
herenvarno | 1:1df80fe13928 | 21 | 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]); |
herenvarno | 1:1df80fe13928 | 22 | fclose(fp); |
herenvarno | 1:1df80fe13928 | 23 | } |