Esempio n. 1
0
void imu_impl_init(void)
{
  /////////////////////////////////////////////////////////////////////
  // ITG3200
  itg3200_init(&imu_navgo.itg, &(IMU_NAVGO_I2C_DEV), ITG3200_ADDR_ALT);
  // change the default configuration
  imu_navgo.itg.config.smplrt_div = NAVGO_GYRO_SMPLRT_DIV;  // 500Hz sample rate since internal is 1kHz
  imu_navgo.itg.config.dlpf_cfg = NAVGO_GYRO_LOWPASS;

  /////////////////////////////////////////////////////////////////////
  // ADXL345
  adxl345_i2c_init(&imu_navgo.adxl, &(IMU_NAVGO_I2C_DEV), ADXL345_ADDR_ALT);
  // change the default data rate
  imu_navgo.adxl.config.rate = NAVGO_ACCEL_RATE;

  /////////////////////////////////////////////////////////////////////
  // HMC58XX
  hmc58xx_init(&imu_navgo.hmc, &(IMU_NAVGO_I2C_DEV), HMC58XX_ADDR);

#if NAVGO_USE_MEDIAN_FILTER
  // Init median filters
  InitMedianFilterRatesInt(median_gyro);
  InitMedianFilterVect3Int(median_accel);
  InitMedianFilterVect3Int(median_mag);
#endif

  imu_navgo.gyr_valid = FALSE;
  imu_navgo.acc_valid = FALSE;
  imu_navgo.mag_valid = FALSE;
}
void imu_impl_init(void)
{
  imu_aspirin.accel_valid = FALSE;
  imu_aspirin.gyro_valid = FALSE;
  imu_aspirin.mag_valid = FALSE;

  /* Set accel configuration */
  adxl345_i2c_init(&imu_aspirin.acc_adxl, &(ASPIRIN_I2C_DEV), ADXL345_ADDR);
  // set the data rate
  imu_aspirin.acc_adxl.config.rate = ASPIRIN_ACCEL_RATE;
  /// @todo drdy int handling for adxl345
  //imu_aspirin.acc_adxl.config.drdy_int_enable = TRUE;

  // With CS tied high to VDD I/O, the ADXL345 is in I2C mode
  GPIO_ARCH_SET_SPI_CS_HIGH();

  /* Gyro configuration and initalization */
  itg3200_init(&imu_aspirin.gyro_itg, &(ASPIRIN_I2C_DEV), ITG3200_ADDR);
  /* change the default config */
  // Aspirin sample rate divider
  imu_aspirin.gyro_itg.config.smplrt_div = ASPIRIN_GYRO_SMPLRT_DIV;
  // digital low pass filter
  imu_aspirin.gyro_itg.config.dlpf_cfg = ASPIRIN_GYRO_LOWPASS;

  /// @todo eoc interrupt for itg3200, polling for now (including status reg)
  /* interrupt on data ready, idle high, latch until read any register */
  //itg_conf.int_cfg = (0x01 | (0x1<<4) | (0x1<<5) | 0x01<<7);

  /* initialize mag and set default options */
  hmc58xx_init(&imu_aspirin.mag_hmc, &(ASPIRIN_I2C_DEV), HMC58XX_ADDR);
#ifdef IMU_ASPIRIN_VERSION_1_0
  imu_aspirin.mag_hmc.type = HMC_TYPE_5843;
#endif
}
Esempio n. 3
0
void imu_impl_init(void)
{
  /////////////////////////////////////////////////////////////////////
  // ITG3200
  itg3200_init(&imu_umarim.itg, &(IMU_UMARIM_I2C_DEV), ITG3200_ADDR_ALT);
  // change the default configuration
  imu_umarim.itg.config.smplrt_div = UMARIM_GYRO_SMPLRT_DIV;
  imu_umarim.itg.config.dlpf_cfg = UMARIM_GYRO_LOWPASS;

  /////////////////////////////////////////////////////////////////////
  // ADXL345
  adxl345_i2c_init(&imu_umarim.adxl, &(IMU_UMARIM_I2C_DEV), ADXL345_ADDR_ALT);
  // change the default data rate
  imu_umarim.adxl.config.rate = UMARIM_ACCEL_RATE;
  imu_umarim.adxl.config.range = UMARIM_ACCEL_RANGE;
}
Esempio n. 4
0
void imu_impl_init(void)
{
  /* Set accel configuration */
  adxl345_i2c_init(&imu_ppzuav.acc_adxl, &(IMU_PPZUAV_I2C_DEV), ADXL345_ADDR);
  /* set the data rate */
  imu_ppzuav.acc_adxl.config.rate = IMU_PPZUAV_ACCEL_RATE;

  /* Gyro configuration and initalization */
  itg3200_init(&imu_ppzuav.gyro_itg, &(IMU_PPZUAV_I2C_DEV), ITG3200_ADDR);
  /* change the default config */
  imu_ppzuav.gyro_itg.config.smplrt_div = IMU_PPZUAV_GYRO_SMPLRT_DIV;
  imu_ppzuav.gyro_itg.config.dlpf_cfg = IMU_PPZUAV_GYRO_LOWPASS;

  /* initialize mag and set default options */
  hmc58xx_init(&imu_ppzuav.mag_hmc, &(IMU_PPZUAV_I2C_DEV), HMC58XX_ADDR);
  /* set the type to the old HMC5843 */
  imu_ppzuav.mag_hmc.type = HMC_TYPE_5843;
}