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.
Dependencies: mbed CROTUS_XBee mbed-rtos Crotus_Com
Diff: Magneto.cpp
- Revision:
- 1:3591e7df4ff4
- Parent:
- 0:28d5622d1a3e
- Child:
- 5:8142f455454b
diff -r 28d5622d1a3e -r 3591e7df4ff4 Magneto.cpp --- a/Magneto.cpp Sun Mar 12 14:58:06 2017 +0000 +++ b/Magneto.cpp Tue Mar 14 12:32:59 2017 +0000 @@ -56,7 +56,7 @@ LocalFileSystem local("local"); void _LoadCalibration(){ - FILE *fp = fopen("/local/magneto.cfg", "r"); // Open "out.txt" on the local file system for writing + FILE *fp = fopen("/local/magneto.cfg", "r"); // File doesn't exist if (fp == 0){ printf("File doesn't exist!!\r\n"); @@ -70,7 +70,7 @@ } void _SaveCalibration(){ - FILE *fp = fopen("/local/magneto.cfg", "w"); // Open "out.txt" on the local file system for writing + FILE *fp = fopen("/local/magneto.cfg", "w"); fprintf(fp, "%04X %04X %04X %04X", minX & 0xFFFF, maxX & 0xFFFF, minY & 0xFFFF, maxY & 0xFFFF); fclose(fp); } @@ -82,10 +82,10 @@ _LoadCalibration(); // Every 10 minutes - calibrationTicker.attach(_SaveCalibration, 6); + calibrationTicker.attach(_SaveCalibration, 600); } -bool Magneto::Test(){ +bool Magneto::TestDeviceConnection(){ cmd[0] = MAGNETO_RA_ID_A; _i2c->write(MAGNETO_ADDRESS, cmd, 1, true);