temperature_sensor.hpp
Go to the documentation of this file.
1 /*
2  * SocialLedge.com - Copyright (C) 2013
3  *
4  * This file is part of free software framework for embedded processors.
5  * You can use it and/or distribute it as long as this copyright header
6  * remains unmodified. The code is free for personal use and requires
7  * permission to use in a commercial product.
8  *
9  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
10  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
12  * I SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
13  * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
14  *
15  * You can reach the author of this software at :
16  * p r e e t . w i k i @ g m a i l . c o m
17  */
18 
23 #ifndef TEMPERATURE_SENSOR_HPP_
24 #define TEMPERATURE_SENSOR_HPP_
25 
26 #include "singleton_template.hpp"
27 #include "i2c2_device.hpp" // I2C Device base class
28 
29 
33 class I2C_Temp : private i2c2_device
34 {
35  public:
36  I2C_Temp(char addr) : i2c2_device(addr), mOffsetCelcius(0) {}
37  bool init();
38 
39  float getCelsius();
40  float getFarenheit();
42 };
43 
49 class TemperatureSensor : public I2C_Temp, public SingletonTemplate<TemperatureSensor>
50 {
51  public:
52  /* API is at I2C_Temp */
53 
54  private:
57  {
58  }
59 
61 };
62 
63 
64 #endif /* TEMPERATURE_SENSOR_HPP_ */
I2C_Temp(char addr)
Definition: temperature_sensor.hpp:36
Definition: i2c2_device.hpp:39
Definition: temperature_sensor.hpp:33
float getCelsius()
Definition: io_source.cpp:378
Definition: i2c2.hpp:57
float getFarenheit()
Definition: io_source.cpp:396
float mOffsetCelcius
Temperature offset.
Definition: temperature_sensor.hpp:41
bool init()
Definition: io_source.cpp:366
Definition: singleton_template.hpp:55
Definition: temperature_sensor.hpp:49