SCIboard(TM): mbed base board data logger - Altimeter: MPL3115A2 - Accelerometer: LSM303DLHC - Gyro: L3G4200D - 4 High Current MOSFET switches

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SCIboard_L3G4200DTR.h Source File

SCIboard_L3G4200DTR.h

00001 /* SCIboard(TM) L3G4200DTR.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_L3G4200DTR_H
00024 #define __SCIboard_L3G4200DTR_H
00025 
00026 #include "mbed.h"
00027 #include "SCIboard_I2C.h"
00028 
00029 // STMicroelectronics www.st.com - Ultra-stable three-axis digital output gyroscope
00030 // Preliminary data 12/2010
00031 #define L3G4200DTR_I2C_ADDR (0x69<<1)
00032 
00033 // Gyro registers
00034 #define GYRREG_WHO_AM_I             0x0F
00035 #define GYRREG_CTRL_REG1            0x20
00036 #define GYRREG_CTRL_REG2            0x21
00037 #define GYRREG_CTRL_REG3            0x22
00038 #define GYRREG_CTRL_REG4            0x23
00039 #define GYRREG_CTRL_REG5            0x24
00040 #define GYRREG_REFERENCE            0x25
00041 #define GYRREG_OUT_TEMP             0x26
00042 #define GYRREG_STATUS               0x27
00043 #define GYRREG_OUT_X_L              0x28
00044 
00045 // Output Data Rate (DR)
00046 #define GYR_DR_100HZ                0
00047 #define GYR_DR_200HZ                1
00048 #define GYR_DR_400HZ                2
00049 #define GYR_DR_800HZ                3
00050 
00051 // Bandwidth
00052 #define GYR_BW_0                    0
00053 #define GYR_BW_1                    1
00054 #define GYR_BW_2                    2
00055 #define GYR_BW_3                    3
00056 
00057 // Full Scale
00058 #define GYR_FS_250DPS               0
00059 #define GYR_FS_500DPS               1
00060 #define GYR_FS_2000DPS              2
00061 
00062 // STATUS_REG
00063 #define STATUS_REG_ZYXDA            0x08
00064 
00065 class SCIboard_L3G4200DTR
00066 {
00067 public:
00068     SCIboard_L3G4200DTR(SCIboard_I2C *ptr_I2C, int iDR, int iBW, int iFS);
00069     unsigned char getDeviceID(void);
00070     unsigned char getStatus(void);
00071     void getData(float *rtn);
00072     void getTemp(float *rtn);
00073     
00074 private:
00075     SCIboard_I2C *pI2C;
00076     float gyrSF;
00077 };
00078 
00079 #endif