Advertisement
Guest User

Untitled

a guest
Dec 28th, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. float BMP180_ReadTemperature()
  2. {
  3. /* Start temperature conversion */
  4. TM_BMP180_StartTemperature(&BMP180);
  5.  
  6. /* Wait delay */
  7. Delay(BMP180.Delay);
  8.  
  9. /* Read temperature first */
  10. TM_BMP180_ReadTemperature(&BMP180);
  11.  
  12. return BMP180.Temperature-1.3;
  13. }
  14.  
  15. float BMP180_ReadPressure()
  16. {
  17. /* Start temperature conversion */
  18. TM_BMP180_StartTemperature(&BMP180);
  19.  
  20. /* Wait delay */
  21. Delay(BMP180.Delay);
  22.  
  23. /* Read temperature first */
  24. TM_BMP180_ReadTemperature(&BMP180);
  25.  
  26. /* Start pressure conversion at ultra high resolution */
  27. TM_BMP180_StartPressure(&BMP180, TM_BMP180_Oversampling_HighResolution);
  28. Delay(BMP180.Delay);
  29.  
  30. /* Read pressure value */
  31. TM_BMP180_ReadPressure(&BMP180);
  32.  
  33. // Auf mBar Meereshöhe umrechnen
  34. double pressure_normal = (double)BMP180.Pressure / 100;
  35.  
  36. if ((pressure_normal < MIN_PRES) || (pressure_normal > MAX_PRES))
  37. return 1013.0;
  38.  
  39. float foo = pressure_normal / pow(1-(0.0065 * HOEHE_ORT) / 288.15, 5.255);
  40.  
  41. return foo;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement