Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * IMU3000.h
- *
- * Created on: 27 mai 2012
- * Author: blackswords
- *
- * Update time : 493ยตs
- */
- #ifndef IMU3000_H_
- #define IMU3000_H_
- #include "WProgram.h"
- #include "MyLib.h"
- #include <HardWire.h>
- class IMU3000 {
- public:
- IMU3000();
- virtual ~IMU3000();
- void Init(uint8 I2CPort, uint8 flags = 0);
- void Update();
- void GetGyro();
- void GetAcc();
- void SetFullScaleRange(fullScale new_fs);
- void SetLowPassFilter(LPFilter new_lp);
- void Calibration();
- axes gyro, acc, calib;
- private:
- fullScale FS;
- LPFilter LP;
- void WriteReg(uint8_t address, uint8_t reg, uint8_t value);
- uint8_t ReadReg(uint8_t address, uint8_t reg);
- void BurstWrite(uint8_t address, uint8_t first_reg, uint8_t nbytes, uint8_t *buff);
- void BurstRead(uint8_t address, uint8_t first_reg, uint8_t nbytes, uint8_t *buff);
- };
- //#define AUTO_CALIB
- /*** I2C Address and port ***/
- #define IMU3000_ADDR 0b1101000
- #define ADXL345_ADDR 0x53
- /*** Values ***/
- #define FS_RANGE 2000.0
- /*** Registers ***/
- // IMU3000
- #define WHO_AM_I 0x00
- #define X_OFFS_USRH 0x0C
- #define X_OFFS_USRL 0x0D
- #define Y_OFFS_USRH 0x0E
- #define Y_OFFS_USRL 0x0F
- #define Z_OFFS_USRH 0x10
- #define Z_OFFS_USRL 0x11
- #define FIFO_EN 0x12
- #define AUX_VDDIO 0x13
- #define AUX_SLV_ADDR 0x14
- #define SMPLRT_DIV 0x15
- #define DLPF_FS 0x16
- #define INT_CFG 0x17
- #define AUX_BURST_AD 0x18
- #define INT_STATUS R 0x1A
- #define TEMP_OUT_H 0x1B
- #define TEMP_OUT_L 0x1C
- #define GYRO_XOUT_H 0x1D
- #define GYRO_XOUT_L 0x1E
- #define GYRO_YOUT_H 0x1F
- #define GYRO_YOUT_L 0x20
- #define GYRO_ZOUT_H 0x21
- #define GYRO_ZOUT_L 0x22
- #define AUX_XOUT_H 0x23
- #define AUX_XOUT_L 0x24
- #define AUX_YOUT_H 0x25
- #define AUX_YOUT_L 0x26
- #define AUX_ZOUT_H 0x27
- #define AUX_ZOUT_L 0x28
- #define DMP_REG1 0x35
- #define DMP_REG2 0x36
- #define DMP_REG3 0x37
- #define DMP_REG4 0x38
- #define DMP_REG5 0x39
- #define FIFO_COUNT_H 0x3A
- #define FIFO_COUNT_L 0x3B
- #define FIFO_R 0x3C
- #define USER_CTRL 0x3D
- #define PWR_MGM 0x3E
- #define IMU3000_BURST_R_ADDR GYRO_XOUT_H
- // ADXL345
- #define DEVID 0x00
- #define THRESH_TAP 0x1D
- #define OFSX 0x1E
- #define OFSY 0x1F
- #define OFSZ 0x20
- #define DUR 0x21
- #define Latent 0x22
- #define Window 0x23
- #define THRESH_ACT 0x24
- #define THRESH_INACT 0x25
- #define TIME_INACT 0x26
- #define ACT_INACT_CTL 0x27
- #define THRESH_FF 0x28
- #define TIME_FF 0x29
- #define TAP_AXES 0x2A
- #define ACT_TAP_STATUS 0x2B
- #define BW_RATE 0x2C
- #define POWER_CTL 0x2D
- #define INT_ENABLE 0x2E
- #define INT_MAP 0x2F
- #define INT_SOURCE 0x30
- #define DATA_FORMAT 0x31
- #define DATAX0 0x32
- #define DATAX1 0x33
- #define DATAY0 0x34
- #define DATAY1 0x35
- #define DATAZ0 0x36
- #define DATAZ1 0x37
- #define FIFO_CTL 0x38
- #define FIFO_STATUS 0x39
- #define ADXL345_BURST_R_ADDR DATAX0
- extern IMU3000 IMU;
- #endif /* IMU3000_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement