Matthias Grob
/
FlyBed2
My fully self designed first stable working Quadrocopter Software.
Embed:
(wiki syntax)
Show/hide line numbers
L3G4200D.h
00001 // based on http://mbed.org/users/shimniok/code/L3G4200D/ 00002 00003 #ifndef L3G4200D_H 00004 #define L3G4200D_H 00005 00006 #include "mbed.h" 00007 #include "I2C_Sensor.h" 00008 00009 #define L3G4200D_I2C_ADDRESS 0xD0 00010 00011 // register addresses 00012 #define L3G4200D_WHO_AM_I 0x0F 00013 00014 #define L3G4200D_CTRL_REG1 0x20 00015 #define L3G4200D_CTRL_REG2 0x21 00016 #define L3G4200D_CTRL_REG3 0x22 00017 #define L3G4200D_CTRL_REG4 0x23 00018 #define L3G4200D_CTRL_REG5 0x24 00019 #define L3G4200D_REFERENCE 0x25 00020 #define L3G4200D_OUT_TEMP 0x26 00021 #define L3G4200D_STATUS_REG 0x27 00022 00023 #define L3G4200D_OUT_X_L 0x28 00024 #define L3G4200D_OUT_X_H 0x29 00025 #define L3G4200D_OUT_Y_L 0x2A 00026 #define L3G4200D_OUT_Y_H 0x2B 00027 #define L3G4200D_OUT_Z_L 0x2C 00028 #define L3G4200D_OUT_Z_H 0x2D 00029 00030 #define L3G4200D_FIFO_CTRL_REG 0x2E 00031 #define L3G4200D_FIFO_SRC_REG 0x2F 00032 00033 #define L3G4200D_INT1_CFG 0x30 00034 #define L3G4200D_INT1_SRC 0x31 00035 #define L3G4200D_INT1_THS_XH 0x32 00036 #define L3G4200D_INT1_THS_XL 0x33 00037 #define L3G4200D_INT1_THS_YH 0x34 00038 #define L3G4200D_INT1_THS_YL 0x35 00039 #define L3G4200D_INT1_THS_ZH 0x36 00040 #define L3G4200D_INT1_THS_ZL 0x37 00041 #define L3G4200D_INT1_DURATION 0x38 00042 00043 class L3G4200D : public I2C_Sensor { 00044 public: 00045 L3G4200D(PinName sda, PinName scl); // constructor, uses I2C_Sensor class 00046 void read(); // read all axis from register to array data 00047 float offset[3]; // offset that's subtracted from every measurement 00048 void calibrate(int times, float separation_time); // calibration from 'times' measurements with 'separation_time' time between (get an offset while not moving) 00049 int readTemp(); // read temperature from sensor 00050 00051 private: 00052 void readraw(); 00053 }; 00054 00055 #endif
Generated on Thu Jul 14 2022 18:09:09 by 1.7.2