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.
Dependencies: mbed MODSERIAL FATFileSystem
Diff: omegaPX209/omegaPX209.hpp
- Revision:
- 14:85b64a4d08e8
- Parent:
- 10:085ab7328054
- Child:
- 17:7c16b5671d0e
--- a/omegaPX209/omegaPX209.hpp Mon Oct 30 21:09:19 2017 +0000
+++ b/omegaPX209/omegaPX209.hpp Tue Oct 31 17:06:52 2017 +0000
@@ -1,27 +1,37 @@
/*
-Matthew Kelly
-October 24th, 2013
-The purpose of this class is to define a a data structure with all of the necessary information and member functions...
-to fully describe a single ultrasonic transducer for use in a relative positioning system.
+This class wraps an Omega pressure transducer.
+Author: Matthew, October 24th, 2013
+Modified: Dan, 2017-10-30
*/
#include "mbed.h"
-#define density_of_water_g_cc 1.00 // g/cm^3 (or 1.03 g/cm^3)
+#define water_density_kg_m3 1000 // fresh water density [kg/m^3] (1029 for sea water)
+#define grav_m_s2 9.80665 // gravitational constant [m/s^2]
+
+#define m2ft 3.28084 // convert m to ft
+#define psi2Pa 6894.76 // convert psi to Pa
+
+#define OVERSAMPLE 20 // number of oversamples
class omegaPX209 {
public:
omegaPX209(PinName pin);
- void initialize();
-
- float getPsi(); // returns pressure [psi]
- float getDepth(); // returns water depth [ft]
-
+ void init();
+ float tare(); // tares reading to ambient pressure
+
+ float getPsi(); // returns pressure [psi]
+ float getDepthFt(); // returns water depth [ft]
+
+ void setZero(float zeroPsi); // lets user set a different ambient pressure [psi] ... tare, effectively
+ float getZero(); // returns the internal ambient pressure [psi]
+
private:
- AnalogIn depthP;
- Ticker pulse;
-
- float P; // Pressure [psi]
- float cal; // Volts per psi
- float multiplier; // Maximum voltage in (of ADC system)
+ AnalogIn _adc;
+
+ float _psi; // pressure [psi]
+ float _zeroPsi; // atmospheric pressure at sea level [psi]
+ float _adcVoltage; // voltage of mbed ADC system [V]
+ float _fullscale; // maximum pressure of the sensor [psi]
+ float _cal; // psi per volt calibration [psi/V]
};