Beispiel #1
0
/**
  * @brief EXTI line detection callbacks
  * @param GPIO_Pin: Specifies the pins connected EXTI line
  * @retval None
  */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  if (GPIO_Pin == GPIO_PIN_13)
  {
	    int32_t d1, d2, d3, d4, d5, d6, d7, d8;
	    int32_t data[3];
	    int32_t gdata[6];

	    if(BSP_HUM_TEMP_isInitialized()) {
	        BSP_HUM_TEMP_GetHumidity((float *)&HUMIDITY_Value);
	        BSP_HUM_TEMP_GetTemperature((float *)&TEMPERATURE_Value);
	        floatToInt(HUMIDITY_Value, &d1, &d2, 2);
	        float tempF = celsius2fahrenheit(TEMPERATURE_Value);
	        floatToInt(tempF, &d3, &d4, 2);
            sprintf(dataOut, "HUM: %d.%02d rH     TEMP: %d.%02d (f)\n\r", (int)d1, (int)d2, (int)d3, (int)d4);
	        printf(dataOut);
	    }

	    if(BSP_PRESSURE_isInitialized())
	    {
	        BSP_PRESSURE_GetPressure((float *)&PRESSURE_Value);
	        BSP_PRESSURE_GetTemperature((float *)&TEMPERATURE2_Value);
	        floatToInt(PRESSURE_Value, &d5, &d6, 2);
	        float tempF2 = celsius2fahrenheit(TEMPERATURE2_Value);
	        floatToInt(tempF2, &d7, &d8, 2);
            sprintf(dataOut, "PRESS: %d.%02d hPa     TEMP: %d.%02d (f)\n\r", (int)d5, (int)d6, (int)d7, (int)d8);
	        printf(dataOut);
	    }

	    if(BSP_MAGNETO_isInitialized())
	    {
	        BSP_MAGNETO_M_GetAxesRaw((AxesRaw_TypeDef *)&MAG_Value);
            data[0] = MAG_Value.AXIS_X;
            data[1] = MAG_Value.AXIS_Y;
            data[2] = MAG_Value.AXIS_Z;

            sprintf(dataOut, "MAG_X: %d, MAG_Y: %d, MAG_Z: %d\n\r", (int)data[0], (int)data[1], (int)data[2]);
	        printf(dataOut);
	    }


	    if(BSP_IMU_6AXES_isInitialized()) {
	        BSP_IMU_6AXES_X_GetAxesRaw((AxesRaw_TypeDef *)&ACC_Value);
	        BSP_IMU_6AXES_G_GetAxesRaw((AxesRaw_TypeDef *)&GYR_Value);
            gdata[0] = ACC_Value.AXIS_X;
            gdata[1] = ACC_Value.AXIS_Y;
            gdata[2] = ACC_Value.AXIS_Z;
            gdata[3] = GYR_Value.AXIS_X;
            gdata[4] = GYR_Value.AXIS_Y;
            gdata[5] = GYR_Value.AXIS_Z;

            sprintf(dataOut, "ACC_X: %d, ACC_Y: %d, ACC_Z: %d\n\r", (int)gdata[0], (int)gdata[1], (int)gdata[2]);
	        printf(dataOut);
            sprintf(dataOut, "GYR_X: %d, GYR_Y: %d, GYR_Z: %d\n\r", (int)gdata[3], (int)gdata[4], (int)gdata[5]);
	        printf(dataOut);

	    }
  }
}
Beispiel #2
0
/*init hts221*/
void hum_temp_monitor_init(void)
{
    /* Initialize the HUM temp */
    while(BSP_HUM_TEMP_isInitialized() != 1) {
        HAL_Delay(10);
        BSP_HUM_TEMP_Init();
    }

}