Exemplo n.º 1
0
void imu_impl_init( void )
{
  /////////////////////////////////////////////////////////////////////
  // MPU-60X0
  mpu60x0_i2c_init(&imu_krooz.mpu, &(IMU_KROOZ_I2C_DEV), MPU60X0_ADDR);
  // change the default configuration
  imu_krooz.mpu.config.smplrt_div = KROOZ_SMPLRT_DIV;
  imu_krooz.mpu.config.dlpf_cfg = KROOZ_LOWPASS_FILTER;
  imu_krooz.mpu.config.gyro_range = KROOZ_GYRO_RANGE;
  imu_krooz.mpu.config.accel_range = KROOZ_ACCEL_RANGE;
  imu_krooz.mpu.config.drdy_int_enable = TRUE;

  hmc58xx_init(&imu_krooz.hmc, &(IMU_KROOZ_I2C_DEV), HMC58XX_ADDR);

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

  RATES_ASSIGN(imu_krooz.rates_sum, 0, 0, 0);
  VECT3_ASSIGN(imu_krooz.accel_sum, 0, 0, 0);
  imu_krooz.meas_nb = 0;

  imu_krooz.gyr_valid = FALSE;
  imu_krooz.acc_valid = FALSE;
  imu_krooz.mag_valid = FALSE;

  imu_krooz_sd_arch_init();
}
Exemplo n.º 2
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;
}
Exemplo n.º 3
0
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
}
Exemplo n.º 4
0
void imu_impl_init(void)
{
  max1168_init();

  /////////////////////////////////////////////////////////////////////
  // HMC58XX
  hmc58xx_init(&imu_hbmini.hmc, &(IMU_HBMINI_I2C_DEV), HMC58XX_ADDR);
}
Exemplo n.º 5
0
void imu_impl_init(void)
{
    mpu60x0_spi_init(&imu_mpu_hmc.mpu, &IMU_MPU_SPI_DEV, IMU_MPU_SPI_SLAVE_IDX);
    // change the default configuration
    imu_mpu_hmc.mpu.config.smplrt_div = IMU_MPU_SMPLRT_DIV;
    imu_mpu_hmc.mpu.config.dlpf_cfg = IMU_MPU_LOWPASS_FILTER;
    imu_mpu_hmc.mpu.config.gyro_range = IMU_MPU_GYRO_RANGE;
    imu_mpu_hmc.mpu.config.accel_range = IMU_MPU_ACCEL_RANGE;

    /* initialize mag and set default options */
    hmc58xx_init(&imu_mpu_hmc.hmc, &IMU_HMC_I2C_DEV, HMC58XX_ADDR);
}
Exemplo n.º 6
0
/**
 * Navstik IMU initializtion of the MPU-60x0 and HMC58xx
 */
void imu_navstik_init(void)
{
  /* MPU-60X0 */
  mpu60x0_i2c_init(&imu_navstik.mpu, &(NAVSTIK_MPU_I2C_DEV), MPU60X0_ADDR_ALT);
  imu_navstik.mpu.config.smplrt_div = NAVSTIK_SMPLRT_DIV;
  imu_navstik.mpu.config.dlpf_cfg = NAVSTIK_LOWPASS_FILTER;
  imu_navstik.mpu.config.gyro_range = NAVSTIK_GYRO_RANGE;
  imu_navstik.mpu.config.accel_range = NAVSTIK_ACCEL_RANGE;

  /* HMC58XX */
  hmc58xx_init(&imu_navstik.hmc, &(NAVSTIK_MAG_I2C_DEV), HMC58XX_ADDR);
}
Exemplo n.º 7
0
void imu_impl_init(void)
{
  /* MPU is on spi1 and CS is SLAVE2 */
  mpu60x0_spi_init(&imu_px4fmu.mpu, &spi1, SPI_SLAVE2);
  // change the default configuration
  imu_px4fmu.mpu.config.smplrt_div = PX4FMU_SMPLRT_DIV;
  imu_px4fmu.mpu.config.dlpf_cfg = PX4FMU_LOWPASS_FILTER;
  imu_px4fmu.mpu.config.gyro_range = PX4FMU_GYRO_RANGE;
  imu_px4fmu.mpu.config.accel_range = PX4FMU_ACCEL_RANGE;

  /* initialize mag on i2c2 and set default options */
  hmc58xx_init(&imu_px4fmu.hmc, &i2c2, HMC58XX_ADDR);
}
Exemplo n.º 8
0
void imu_impl_init(void)
{
  /////////////////////////////////////////////////////////////////////
  // ITG3200
  itg3200_init();

  /////////////////////////////////////////////////////////////////////
  // ADXL345
  adxl345_init();

  /////////////////////////////////////////////////////////////////////
  // HMC58XX
  hmc58xx_init();
}
Exemplo n.º 9
0
void imu_impl_init(void)
{

  max1168_init();

  /////////////////////////////////////////////////////////////////////
  // HMC58XX
  hmc58xx_init(&imu_hbmini.hmc, &(IMU_HBMINI_I2C_DEV), HMC58XX_ADDR);

  imu_hbmini.gyr_valid = FALSE;
  imu_hbmini.acc_valid = FALSE;
  imu_hbmini.mag_valid = FALSE;

}
Exemplo n.º 10
0
void imu_impl_init(void) {

  max1168_init();
#if defined IMU_B2_MAG_TYPE && IMU_B2_MAG_TYPE == IMU_B2_MAG_MS2100
  ms2100_init(&ms2100, &(MS2100_SPI_DEV), MS2100_SLAVE_IDX);
#elif defined IMU_B2_MAG_TYPE && IMU_B2_MAG_TYPE == IMU_B2_MAG_AMI601
  ami601_init();
#elif defined IMU_B2_MAG_TYPE && IMU_B2_MAG_TYPE == IMU_B2_MAG_HMC5843
  hmc5843_init();
#elif defined IMU_B2_MAG_TYPE && IMU_B2_MAG_TYPE == IMU_B2_MAG_HMC58XX
  hmc58xx_init(&imu_b2.mag_hmc, &(IMU_B2_I2C_DEV), HMC58XX_ADDR);
#endif

}
Exemplo n.º 11
0
void imu_impl_init(void)
{
  /////////////////////////////////////////////////////////////////////
  // MPU-60X0
  mpu60x0_i2c_init(&imu_krooz.mpu, &(IMU_KROOZ_I2C_DEV), MPU60X0_ADDR);
  // change the default configuration
  imu_krooz.mpu.config.smplrt_div = KROOZ_SMPLRT_DIV;
  imu_krooz.mpu.config.dlpf_cfg = KROOZ_LOWPASS_FILTER;
  imu_krooz.mpu.config.gyro_range = KROOZ_GYRO_RANGE;
  imu_krooz.mpu.config.accel_range = KROOZ_ACCEL_RANGE;
  imu_krooz.mpu.config.drdy_int_enable = true;

  hmc58xx_init(&imu_krooz.hmc, &(IMU_KROOZ_I2C_DEV), HMC58XX_ADDR);

  // Init median filters
#if IMU_KROOZ_USE_ACCEL_MEDIAN_FILTER
  InitMedianFilterVect3Int(median_accel);
#endif
  InitMedianFilterVect3Int(median_mag);

  RATES_ASSIGN(imu_krooz.rates_sum, 0, 0, 0);
  VECT3_ASSIGN(imu_krooz.accel_sum, 0, 0, 0);
  imu_krooz.meas_nb = 0;

  imu_krooz.hmc_eoc = false;
  imu_krooz.mpu_eoc = false;

  imu_krooz.ad7689_trans.slave_idx     = IMU_KROOZ_SPI_SLAVE_IDX;
  imu_krooz.ad7689_trans.select        = SPISelectUnselect;
  imu_krooz.ad7689_trans.cpol          = SPICpolIdleLow;
  imu_krooz.ad7689_trans.cpha          = SPICphaEdge1;
  imu_krooz.ad7689_trans.dss           = SPIDss8bit;
  imu_krooz.ad7689_trans.bitorder      = SPIMSBFirst;
  imu_krooz.ad7689_trans.cdiv          = SPIDiv16;
  imu_krooz.ad7689_trans.output_length = sizeof(imu_krooz.ad7689_spi_tx_buffer);
  imu_krooz.ad7689_trans.output_buf    = (uint8_t *) imu_krooz.ad7689_spi_tx_buffer;
  imu_krooz.ad7689_trans.input_length  = sizeof(imu_krooz.ad7689_spi_rx_buffer);
  imu_krooz.ad7689_trans.input_buf     = (uint8_t *) imu_krooz.ad7689_spi_rx_buffer;
  imu_krooz.ad7689_trans.before_cb     = NULL;
  imu_krooz.ad7689_trans.after_cb      = NULL;
  axis_cnt = 0;
  axis_nb = 2;

  imu_krooz_sd_arch_init();
}
Exemplo n.º 12
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;
}
Exemplo n.º 13
0
void imu_impl_init(void)
{
  /* MPU-60X0 */
  mpu60x0_i2c_init(&imu_drotek2.mpu, &(DROTEK_2_I2C_DEV), DROTEK_2_MPU_I2C_ADDR);
  // change the default configuration
  imu_drotek2.mpu.config.smplrt_div = DROTEK_2_SMPLRT_DIV;
  imu_drotek2.mpu.config.dlpf_cfg = DROTEK_2_LOWPASS_FILTER;
  imu_drotek2.mpu.config.gyro_range = DROTEK_2_GYRO_RANGE;
  imu_drotek2.mpu.config.accel_range = DROTEK_2_ACCEL_RANGE;

  /* HMC5883 magnetometer */
  hmc58xx_init(&imu_drotek2.hmc, &(DROTEK_2_I2C_DEV), DROTEK_2_HMC_I2C_ADDR);

  /* mag is declared as slave to call the configure function,
   * regardless if it is an actual MPU slave or passthrough
   */
  imu_drotek2.mpu.config.nb_slaves = 1;
  /* set callback function to configure mag */
  imu_drotek2.mpu.config.slaves[0].configure = &imu_drotek2_configure_mag_slave;

  // use hmc mag via passthrough
  imu_drotek2.mpu.config.i2c_bypass = true;
}
Exemplo n.º 14
0
void imu_impl_init(void)
{
  imu_aspirin.accel_valid = FALSE;
  imu_aspirin.gyro_valid = FALSE;
  imu_aspirin.mag_valid = FALSE;

  /* Set accel configuration */
  adxl345_spi_init(&imu_aspirin.acc_adxl, &(ASPIRIN_SPI_DEV), ASPIRIN_SPI_SLAVE_IDX);
  // 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;

  /* Gyro configuration and initalization */
  itg3200_init(&imu_aspirin.gyro_itg, &(ASPIRIN_I2C_DEV), ITG3200_ADDR);
  /* change the default config */
  // Aspirin sample rate divider defaults to 533Hz
  imu_aspirin.gyro_itg.config.smplrt_div = ASPIRIN_GYRO_SMPLRT_DIV;
  // aspirin defaults to 8kHz internal with 256Hz low pass
  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

#if ASPIRIN_ARCH_INDEP
TODO("Arch dependent functions (accel and gyro eoc interrupt) not used for aspirin!")
#else
  imu_aspirin_arch_init();
#endif
}
Exemplo n.º 15
0
void mag_hmc58xx_module_init(void) {
  hmc58xx_init(&mag_hmc58xx, &(MAG_HMC58XX_I2C_DEV), HMC58XX_ADDR);
}