CalLib.h
Go to the documentation of this file.
00001 
00002 //
00003 //  This file is part of MPU9150Lib
00004 //
00005 //  Copyright (c) 2013 Pansenti, LLC
00006 //
00007 //  Permission is hereby granted, free of charge, to any person obtaining a copy of 
00008 //  this software and associated documentation files (the "Software"), to deal in 
00009 //  the Software without restriction, including without limitation the rights to use, 
00010 //  copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 
00011 //  Software, and to permit persons to whom the Software is furnished to do so, 
00012 //  subject to the following conditions:
00013 //
00014 //  The above copyright notice and this permission notice shall be included in all 
00015 //  copies or substantial portions of the Software.
00016 //
00017 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
00018 //  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
00019 //  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
00020 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
00021 //  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
00022 //  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023 
00024 #ifndef _CALLIB_H_
00025 #define _CALLIB_H_
00026 
00027 #include <Arduino.h>
00028 
00029 #define CALLIB_DATA_VALID         0x15fc
00030 #define CALLIB_DATA_VALID_LOW     0xfc // pattern to detect valid config - low byte
00031 #define CALLIB_DATA_VALID_HIGH    0x15 // pattern to detect valid config - high byte
00032 
00033 #ifdef __SAM3X8E__
00034 #define CALLIB_START  ((uint32_t *)(IFLASH1_ADDR + IFLASH1_SIZE - IFLASH1_PAGE_SIZE))
00035 #endif
00036 
00037 typedef struct
00038 {
00039   short valid;                        // should contain the valid pattern if a good config
00040   short magValid;                     // true if mag data valid
00041   short magMinX;                      // mag min x value
00042   short magMaxX;                      // mag max x value
00043   short magMinY;                      // mag min y value
00044   short magMaxY;                      // mag max y value
00045   short magMinZ;                      // mag min z value
00046   short magMaxZ;                      // mag max z value 
00047   short accelValid;                   // true if accel data valid
00048   short accelMinX;                    // mag min x value
00049   short accelMaxX;                    // mag max x value
00050   short accelMinY;                    // mag min y value
00051   short accelMaxY;                    // mag max y value
00052   short accelMinZ;                    // mag min z value
00053   short accelMaxZ;                    // mag max z value
00054   short unused;                       // must be multiple of 32 bits for Due
00055 } CALLIB_DATA;
00056 
00057 //  calLibErase() erases any current data in the EEPROM
00058 
00059 void calLibErase(byte device);
00060 
00061 //  calLibWrite() writes new data to the EEPROM
00062 
00063 void calLibWrite(byte device, CALLIB_DATA * calData);
00064 
00065 //  calLibRead() reads existing data and returns true if valid else false in not.
00066 
00067 boolean calLibRead(byte device, CALLIB_DATA * calData);
00068 
00069 #endif // _CALLIB_H_


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:49