Library for the Sensirion SHT3X-ARP Analog Humidity & Temperature Sensor.
Fork of SHT3XA by
SHT3XA.cpp@0:f0757a25e239, 2015-09-13 (annotated)
- Committer:
- ClosedCube
- Date:
- Sun Sep 13 20:39:47 2015 +0000
- Revision:
- 0:f0757a25e239
SHT3x-ARP sensor library added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ClosedCube | 0:f0757a25e239 | 1 | /* |
ClosedCube | 0:f0757a25e239 | 2 | Copyright (c) 2015 ClosedCube Limited |
ClosedCube | 0:f0757a25e239 | 3 | |
ClosedCube | 0:f0757a25e239 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
ClosedCube | 0:f0757a25e239 | 5 | and associated documentation files (the "Software"), to deal in the Software without restriction, |
ClosedCube | 0:f0757a25e239 | 6 | including without limitation the rights to use, copy, modify, merge, publish, distribute, |
ClosedCube | 0:f0757a25e239 | 7 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
ClosedCube | 0:f0757a25e239 | 8 | furnished to do so, subject to the following conditions: |
ClosedCube | 0:f0757a25e239 | 9 | |
ClosedCube | 0:f0757a25e239 | 10 | The above copyright notice and this permission notice shall be included in all copies or |
ClosedCube | 0:f0757a25e239 | 11 | substantial portions of the Software. |
ClosedCube | 0:f0757a25e239 | 12 | |
ClosedCube | 0:f0757a25e239 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
ClosedCube | 0:f0757a25e239 | 14 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
ClosedCube | 0:f0757a25e239 | 15 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
ClosedCube | 0:f0757a25e239 | 16 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
ClosedCube | 0:f0757a25e239 | 17 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
ClosedCube | 0:f0757a25e239 | 18 | */ |
ClosedCube | 0:f0757a25e239 | 19 | |
ClosedCube | 0:f0757a25e239 | 20 | #include "SHT3XA.h" |
ClosedCube | 0:f0757a25e239 | 21 | |
ClosedCube | 0:f0757a25e239 | 22 | #define SHT3XA_RH_FORMULA(x) -12.5f+125.0f*x |
ClosedCube | 0:f0757a25e239 | 23 | #define SHT3XA_TEMPC_FORMULA(x) -66.875f+218.75f*x |
ClosedCube | 0:f0757a25e239 | 24 | #define SHT3XA_TEMPF_FORMULA(x) -88.375f+393.75f*x |
ClosedCube | 0:f0757a25e239 | 25 | |
ClosedCube | 0:f0757a25e239 | 26 | SHT3XA::SHT3XA(PinName pinRH,PinName pinT) : _pinRH(pinRH),_pinT(pinT) |
ClosedCube | 0:f0757a25e239 | 27 | { |
ClosedCube | 0:f0757a25e239 | 28 | } |
ClosedCube | 0:f0757a25e239 | 29 | |
ClosedCube | 0:f0757a25e239 | 30 | float SHT3XA::readRH() |
ClosedCube | 0:f0757a25e239 | 31 | { |
ClosedCube | 0:f0757a25e239 | 32 | return SHT3XA_RH_FORMULA(_pinRH.read()); |
ClosedCube | 0:f0757a25e239 | 33 | } |
ClosedCube | 0:f0757a25e239 | 34 | |
ClosedCube | 0:f0757a25e239 | 35 | float SHT3XA::readTempC() |
ClosedCube | 0:f0757a25e239 | 36 | { |
ClosedCube | 0:f0757a25e239 | 37 | return SHT3XA_TEMPC_FORMULA(_pinT.read()); |
ClosedCube | 0:f0757a25e239 | 38 | } |
ClosedCube | 0:f0757a25e239 | 39 | |
ClosedCube | 0:f0757a25e239 | 40 | float SHT3XA::readTempF() |
ClosedCube | 0:f0757a25e239 | 41 | { |
ClosedCube | 0:f0757a25e239 | 42 | return SHT3XA_TEMPF_FORMULA(_pinT.read()); |
ClosedCube | 0:f0757a25e239 | 43 | } |
ClosedCube | 0:f0757a25e239 | 44 |