SCIboard(TM): mbed base board data logger - Altimeter: MPL3115A2 - Accelerometer: LSM303DLHC - Gyro: L3G4200D - 4 High Current MOSFET switches
SCIboard_MPL3115A2.h
00001 /* SCIboard(TM) MPL3115A2.h 00002 Copyright (c) 2013 K. Andres 00003 00004 Permission is hereby granted, free of charge, to any person obtaining a copy 00005 of this software and associated documentation files (the "Software"), to deal 00006 in the Software without restriction, including without limitation the rights 00007 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00008 copies of the Software, and to permit persons to whom the Software is 00009 furnished to do so, subject to the following conditions: 00010 00011 The above copyright notice and this permission notice shall be included in 00012 all copies or substantial portions of the Software. 00013 00014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00019 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00020 THE SOFTWARE. 00021 */ 00022 00023 #ifndef __SCIboard_MPL3115A2_H 00024 #define __SCIboard_MPL3115A2_H 00025 00026 #include "mbed.h" 00027 #include "SCIboard_I2C.h" 00028 00029 // Freescale Semiconductor www.freescale.com - I2C Precision Altimeter 00030 // Data sheet Rev 2.2 07/2012 00031 #define MPL3115A2_I2C_ADDR (0x60<<1) 00032 00033 // Altimeter registers 00034 #define ALTREG_STATUS 0x00 00035 #define ALTREG_OUT_P_MSB 0x01 00036 #define ALTREG_OUT_T_MSB 0x04 00037 #define ALTREG_DR_STATUS 0x06 00038 #define ALTREG_WHO_AM_I 0x0C 00039 #define ALTREG_SYSMOD 0x11 00040 #define ALTREG_PT_DATA_CFG 0x13 00041 #define ALTREG_CTRL_REG1 0x26 00042 #define ALTREG_CTRL_REG2 0x26 00043 #define ALTREG_CTRL_REG3 0x28 00044 #define ALTREG_CTRL_REG4 0x29 00045 #define ALTREG_CTRL_REG5 0x2A 00046 00047 // Altimeter oversampling value and minimum time between sample - Ratio x 4 ms + 2 ms 00048 // Min time between samples 00049 #define OS1 0 // 6 ms 00050 #define OS2 1 // 10 ms 00051 #define OS4 2 // 18 ms 00052 #define OS8 3 // 34 ms 00053 #define OS16 4 // 66 ms 00054 #define OS32 5 // 130 ms 00055 #define OS64 6 // 258 ms 00056 #define OS128 7 // 512 ms 00057 00058 // Altimter modes 00059 #define ALT_MODE 1 00060 #define BAR_MODE 0 00061 00062 class SCIboard_MPL3115A2 00063 { 00064 public: 00065 SCIboard_MPL3115A2(SCIboard_I2C *ptr_I2C); 00066 unsigned char getDeviceID(void); 00067 void setMode(unsigned char mode, unsigned char overSampling); 00068 void OST(void); 00069 bool bDataAvailable(void); 00070 unsigned char getDrStatus(void); 00071 unsigned char getSysmod(void); 00072 void getData(float *rtn); 00073 00074 private: 00075 SCIboard_I2C *pI2C; 00076 unsigned char recallMode; 00077 }; 00078 00079 #endif
Generated on Wed Jul 13 2022 05:45:34 by 1.7.2