Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Config.cpp@0:d60c26d5fddc, 2016-09-14 (annotated)
- Committer:
- youle1119
- Date:
- Wed Sep 14 08:55:41 2016 +0000
- Revision:
- 0:d60c26d5fddc
tiz
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| youle1119 | 0:d60c26d5fddc | 1 | #include "Config.h" |
| youle1119 | 0:d60c26d5fddc | 2 | |
| youle1119 | 0:d60c26d5fddc | 3 | Config::Config(char *filename) |
| youle1119 | 0:d60c26d5fddc | 4 | { |
| youle1119 | 0:d60c26d5fddc | 5 | FILE *fp = fopen(filename, "r+"); |
| youle1119 | 0:d60c26d5fddc | 6 | if(!fp) |
| youle1119 | 0:d60c26d5fddc | 7 | { |
| youle1119 | 0:d60c26d5fddc | 8 | raise_error(ERROR_CONFIG); |
| youle1119 | 0:d60c26d5fddc | 9 | } |
| youle1119 | 0:d60c26d5fddc | 10 | strcpy(this->__filename, filename); |
| youle1119 | 0:d60c26d5fddc | 11 | fclose(fp); |
| youle1119 | 0:d60c26d5fddc | 12 | } |
| youle1119 | 0:d60c26d5fddc | 13 | |
| youle1119 | 0:d60c26d5fddc | 14 | void Config::write() |
| youle1119 | 0:d60c26d5fddc | 15 | { |
| youle1119 | 0:d60c26d5fddc | 16 | FILE *fp = fopen(this->__filename, "w+"); |
| youle1119 | 0:d60c26d5fddc | 17 | if(!fp) |
| youle1119 | 0:d60c26d5fddc | 18 | { |
| youle1119 | 0:d60c26d5fddc | 19 | raise_error(ERROR_CONFIG); |
| youle1119 | 0:d60c26d5fddc | 20 | } |
| youle1119 | 0:d60c26d5fddc | 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]); |
| youle1119 | 0:d60c26d5fddc | 22 | fclose(fp); |
| youle1119 | 0:d60c26d5fddc | 23 | } |