00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _TemperatureSensor_H_
00023 #define _TemperatureSensor_H_
00024
00025 #include <config.h>
00026 #include <c++/Sensor.H>
00027
00028 #if defined(CONF_DSENSOR)
00029
00053 class TemperatureSensor : public Sensor {
00054 public:
00062 TemperatureSensor(const Sensor::Port port) : Sensor(port, false) {}
00063
00067 ~TemperatureSensor() {}
00068
00074 float C() const {
00075 return 93.8136 - 0.122241 * static_cast<float>(get() >> 6);
00076 }
00077
00083 float F() const {return C() * 1.8 + 32;}
00084
00090 int tenths() const {return static_cast<int>(C() * 10.);}
00091
00097 int degrees() const {return static_cast<int>(C());}
00098 };
00099
00100 #else // CONF_DSENSOR
00101 #warning Enable CONF_DSENSOR to use TemperatureSensor.H
00102 #endif // CONF_DSENSOR
00103 #endif // _TemperatureSensor_H_