| | |
| | | } |
| | | u8 BMP390_Init(void) |
| | | { |
| | | delay_ms(10); |
| | | u8 BMP390_ID; |
| | | u8 BMP390_ID,temp; |
| | | // IIC_Start(); |
| | | // IIC_Send_Byte(BMP390_Write); |
| | | // IIC_Send_Byte(0xB6); |
| | |
| | | BMP390_Write_Byte(PWR_CTRL_Addr,0x33);//Set Working mode and state of sensor |
| | | // BMP390_Write_Byte(IF_CONF_Addr,0x00);//Serial interface settings |
| | | BMP390_Write_Byte(INT_CTRL_Addr,0x02);//Set interrupt config |
| | | BMP390_Write_Byte(OSR_Addr,0x15);//Set the PM-RATE and PM-PRC,Set the TMPI-RATE and TMP-PRC |
| | | BMP390_Write_Byte(ODR_Addr,0x05);//Set the configuration of the output data rates by means of setting the subdivision/subsampling. |
| | | BMP390_Write_Byte(CONFIG_Addr,0);//IIR filter coeffcients |
| | | |
| | | temp = BMP3_OVERSAMPLING_2X<<3|BMP3_OVERSAMPLING_32X; |
| | | BMP390_Write_Byte(OSR_Addr,temp);//Set the PM-RATE and PM-PRC,Set the TMPI-RATE and TMP-PRC |
| | | temp = BMP3_ODR_6_25_HZ; |
| | | BMP390_Write_Byte(ODR_Addr,temp);//Set the configuration of the output data rates by means of setting the subdivision/subsampling. |
| | | temp = BMP3_IIR_FILTER_COEFF_3<<1; |
| | | BMP390_Write_Byte(CONFIG_Addr,temp);//IIR filter coeffcients |
| | | return BMP390_ID; |
| | | } |
| | | |
| | |
| | | Correcting_Temp = Correcting_Temperature(Temperature,Temperature_Para); |
| | | Correcting_Press = Correcting_Pressure(Pressure,Pressure_Para,Correcting_Temp)+Offest_Pressure; |
| | | Altitude = 44330*(1-pow(Correcting_Press/101325.0,1.0/5.255)); |
| | | Correcting_Press = Correcting_Press/100; |
| | | // Correcting_Press = Correcting_Press/100; |
| | | if(Correcting_Press==0) |
| | | Altitude = 0; |
| | | |