Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed_main by
Barometer.h
00001 #ifndef Barometer_H 00002 #define Barometer_H 00003 #include "mbed.h" 00004 00005 00006 enum Barometer_oss { 00007 Barometer_oss1 = 0, ///< ultra low power (1 time) 00008 Barometer_oss2 = 1, ///< standard (2 times) 00009 Barometer_oss4 = 2, ///< high resolution (4 times) 00010 Barometer_oss8 = 3 ///< ultra high resolution (8 times) 00011 }; 00012 00013 00014 class Barometer { 00015 public: 00016 Barometer(PinName p_sda, PinName p_scl, Barometer_oss p_oss = Barometer_oss8); 00017 Barometer(I2C& p_i2c, Barometer_oss p_oss = Barometer_oss8); 00018 00019 float get_temperature(); 00020 float get_pressure(); 00021 float get_altitude_m(); 00022 void update(); 00023 00024 protected: 00025 void init(Barometer_oss); 00026 unsigned short twi_readshort (int, int); 00027 unsigned long twi_readlong (int, int); 00028 void twi_writechar (int, int, int); 00029 00030 I2C i2c; 00031 float temperature; 00032 float pressure; 00033 float altitude; 00034 00035 private: 00036 00037 short ac1, ac2, ac3, b1, b2, mb, mc, md, oss; 00038 unsigned short ac4, ac5, ac6; 00039 }; 00040 00041 #endif
Generated on Thu Jul 21 2022 15:06:12 by
1.7.2
