Hello world code for PCT2075 and LM75B component class library. The PCT2075 is a temperature-to-digital converter featuring +/-1 degree-C accuracy over -25 degree-C to +100 degree-C range. It uses an on-chip band gap temperature sensor and Sigma-Delta A-to-D conversion technique with an overtemperature detection output that is a drop-in replacement for other LM75 series thermal sensors.
Diff: PCT2075/base_class/I2CTempSensor.h
- Revision:
- 1:5398b0799e20
- Parent:
- 0:3c3d4c5ac8e9
--- a/PCT2075/base_class/I2CTempSensor.h Fri Feb 27 10:47:24 2015 +0000
+++ b/PCT2075/base_class/I2CTempSensor.h Fri Feb 27 12:35:30 2015 +0000
@@ -1,5 +1,3 @@
-
-
/** PCT2075 and LM75B component class library
* PCT2075 と LM75B 用のコンポーネント・クラス・ライブラリです
*
@@ -16,6 +14,9 @@
* http://www.nxp.com/documents/data_sheet/LM75B.pdf
*/
+#ifndef MBED_I2CTempSensor_H
+#define MBED_I2CTempSensor_H
+
#include "mbed.h"
/** I2CTempSensor class library クラスライブラリ
@@ -27,9 +28,12 @@
class I2CTempSensor
{
+public:
+ virtual float read( void ) = 0;
+ virtual operator float( void ) = 0;
+
protected:
-
/** LM75Bのレジスタ名とアドレス */
enum command_reg {
LM75B_Temp = 0x00,
@@ -65,10 +69,13 @@
*
* @return 摂氏温度を返します(float型)
*/
- short read( void );
+ short read16( void );
private:
I2C *i2c_p;
I2C &i2c;
char adr;
};
+
+#endif // MBED_I2CTempSensor_H
+