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.
Dependents: TestBenchSerenity-proto_F429ZI TestBenchFlow HSPFLOW1 TestBenchFlow1 ... more
Diff: keller_pressure.cpp
- Revision:
- 7:6bca43eedca6
- Parent:
- 6:deb4008b136e
- Child:
- 8:0d45e94faf0f
--- a/keller_pressure.cpp Wed Feb 28 15:28:03 2018 +0000 +++ b/keller_pressure.cpp Thu Apr 05 16:04:45 2018 +0000 @@ -127,6 +127,26 @@ } //=========================================================================== +// Read pressure only. Return 1 if error, 0 if OK. +// Byte 1: status, Bytes 2-3: pressure +char KELLER_PRESSURE::readP() +//=========================================================================== +{ + char error = 0; + char data[3]; + + error |= _read_multibyte(KELLER_PRESSURE_REQUEST_MEASUREMENT, data, 3); + status = data[0]; + pressure = (data[1] << 8) | data[2]; + + pressureBAR = ((pressure - 16384)*(pmax-pmin))/32768+pmin; + pressurePSI = pressureBAR*14.5038; + pressureKPA = pressureBAR*100; + + return error; +} + +//=========================================================================== char KELLER_PRESSURE::readUserInfo() //=========================================================================== {