Пример #1
0
/*init hts221*/
static void hum_temp_monitor_init(void)
{
    BSP_HUM_TEMP_Init();
    /* Initialize the HUM temp */
    while(BSP_HUM_TEMP_isInitialized() != 1) {
        BSP_HUM_TEMP_Init();
        HAL_Delay(10);
    }
}
Пример #2
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);
  }
}