minor change to support non-Wi-Go platforms

Fork of Wi-Go_eCompass_Lib_V3 by Frank Vannieuwkerke

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers eCompass_Lib_V3.h Source File

eCompass_Lib_V3.h

00001 /************************************************************************************************
00002 * File       : eCompass.h
00003 * Date       : 18/07/2013 
00004 * Purpose    : Wi-Go eCompass interface and hardware peripherals definition 
00005 * Author     : Frank Vannieuwkerke
00006 * Description: ported from Avnet Wi-Go code
00007 *              For additional information on Wi-Go please visit
00008 *                    www.em.avnet.com/wi-go
00009 *              Additional info on the Freescale eCompass software is available at
00010 *                    http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=E-Compass
00011 ************************************************************************************************/
00012 #ifndef ECOMPASS_H__
00013 #define ECOMPASS_H__
00014 
00015 //#include "common.h"
00016 //#include "Wi-Go_eCompass_Lib_V3.ar"
00017 
00018 #ifdef  __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 typedef short int16;
00023 typedef unsigned short uint16;
00024 typedef unsigned int uint32;
00025 typedef unsigned char byte;
00026 
00027 extern void run_eCompass(void);
00028 extern void init_eCompass(void);
00029 extern void calibrate_eCompass(void);
00030 
00031 #define NED_COMPASS     1
00032 #define ANDROID_COMPASS 2
00033 #define WINDOWS_COMPASS 3
00034 
00035 //  Macros for constants used in fractional decimal conversion routine.
00036 //  FRAC_2d1 = 2^-1 = 0.5
00037 //  FRAC_2d2 = 2^-2 = 0.25 etc...
00038 #define FRAC_2d1              5000
00039 #define FRAC_2d2              2500
00040 #define FRAC_2d3              1250
00041 #define FRAC_2d4               625  
00042 
00043 // sensor scaling constants
00044 #define FCOUNTSPERUT 10.0F              // sensor specific: MAG3110 provide 10 counts / uT 
00045 #define FCOUNTSPERG 4096.0F             // sensor specific: MMA8451 provide 4096 counts / g in 2g mode
00046 
00047 typedef struct  {
00048     // Always 1
00049        uint16              packet_id;
00050     // Light sensor
00051        int16               light;
00052     // Counts at a 0.020MS interval when sensor data is processed
00053        uint32              timestamp;
00054     // Ineeger data from accelerometer
00055        int16               acc_x, acc_y, acc_z;
00056     // Integer data from Magnetometer
00057        int16               mag_x, mag_y, mag_z;
00058      // Roll, Pitch, Yaw and Compass from the eCompass algorithm
00059        int16               roll, pitch, yaw, compass;
00060     // Altitude and temperature
00061        int16               alt, temp;
00062     // Data from Accelerometer converted to floating point
00063        float               fax, fay, faz;
00064     // Accelerometer data converted to G's
00065        float               fGax, fGay, fGaz;
00066     // Data from Magnetometer converted to floating point
00067        float               fmx, fmy, fmz;
00068     // Magnetometer data converted to UT's
00069        float               fUTmx, fUTmy, fUTmz;
00070        float               q0, q1, q2, q3;
00071     
00072 } axis6_t;
00073 
00074 #ifdef  __cplusplus
00075 }
00076 #endif
00077 
00078 #endif