Exemple #1
0
/*init lsm6ds3*/
static void lsm6ds3_6_axis_init(void)
{
    BSP_IMU_6AXES_Init();
    while(BSP_IMU_6AXES_isInitialized() != 1)	{
        BSP_IMU_6AXES_Init();
        HAL_Delay(10);
    }
}
Exemple #2
0
void imuInit(void)
{
	if(isInit)
		return;

	// Wait for sensors to startup
	while (xTaskGetTickCount() < M2T(IMU_STARTUP_TIME_MS));


	/* Initialize the IMU 6-axes */
	BSP_IMU_6AXES_Init();
	BSP_IMU_6AXES_X_Set_ODR(500.0f);
	BSP_IMU_6AXES_X_Set_FS(8.0f);
	BSP_IMU_6AXES_G_Set_ODR(500.0f);
	BSP_IMU_6AXES_G_Set_FS(2000.0f);
	BSP_MAGNETO_Init();
	BSP_PRESSURE_Init();


	imuBiasInit(&gyroBias);
#ifdef IMU_TAKE_ACCEL_BIAS
	imuBiasInit(&accelBias);
#endif
	varianceSampleTime = -GYRO_MIN_BIAS_TIMEOUT_MS + 1;
	imuAccLpfAttFactor = IMU_ACC_IIR_LPF_ATT_FACTOR;


	isInit = true;

}
Exemple #3
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /* This sample code shows how to use GPIO HAL API to toggle LED2 IOs
    in an infinite loop. */

  /* STM32F0xx HAL library initialization:
       - Configure the Flash prefetch
       - Systick timer is configured by default as source of time base, but user 
         can eventually implement his proper time base source (a general purpose 
         timer for example or other time source), keeping in mind that Time base 
         duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
         handled in milliseconds basis.
       - Low Level Initialization
     */
  HAL_Init();

  /* Configure the system clock to 48 MHz */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_I2C1_Init();
  MX_USART2_UART_Init();

  printf("\n\r\n\rDuvitech 2015\n\r");
  printf("George Vigelette\n\r");
  printf("[email protected]\n\r\n\r");

  printf("initializing temperature sensor...\n\r");
  if(BSP_HUM_TEMP_Init() != HUM_TEMP_OK ||
		  BSP_HUM_TEMP_CheckID() != HUM_TEMP_OK)
  {
	  printf("problem with temperature sensor\n\r");
  }

  printf("initializing pressure sensor...\n\r");
  if(BSP_PRESSURE_Init() != PRESSURE_OK ||
		  BSP_PRESSURE_CheckID() != PRESSURE_OK)
  {
	  printf("problem with pressure sensor\n\r");
  }

  printf("initializing magnetometer sensor...\n\r");
  if(BSP_MAGNETO_Init() != MAGNETO_OK ||
		  BSP_MAGNETO_Check_M_ID() != MAGNETO_OK)
  {
	  printf("problem with magnetometer sensor\n\r");
  }

  printf("initializing imu sensor...\n\r");
    if(BSP_IMU_6AXES_Init() != IMU_6AXES_OK ||
    		BSP_IMU_6AXES_Check_XG_ID() != IMU_6AXES_OK)
    {
  	  printf("problem with imu sensor\n\r");
    }

  printf("Running...\n\r");
  while (1)
  {
    HAL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);
    /* Insert delay 100 ms */
    HAL_Delay(100);
  }
}