Component class library for PCT2075 and LM75B. 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.

Dependents:   PCT2075_Hello Brushless_STM3_ESC_2019_10 Alternator2020_06

Committer:
okano
Date:
Thu Mar 05 06:14:19 2015 +0000
Revision:
1:0cdfb3ea5969
Parent:
0:ae0333775d7e
comment added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okano 0:ae0333775d7e 1 /** PCT2075 and LM75B component class library
okano 0:ae0333775d7e 2 * PCT2075 と LM75B 用のコンポーネント・クラス・ライブラリです
okano 0:ae0333775d7e 3 *
okano 0:ae0333775d7e 4 * This is new NXP PCT2075 and classic LM75B component class library
okano 0:ae0333775d7e 5 * This works for both PCT2075 and LM75B
okano 0:ae0333775d7e 6 *
okano 0:ae0333775d7e 7 * @author Tedd OKANO
okano 0:ae0333775d7e 8 * @version 1.0
okano 0:ae0333775d7e 9 * @date 05-Mar-2015
okano 0:ae0333775d7e 10 *
okano 1:0cdfb3ea5969 11 * Released under the Apache 2 license License
okano 1:0cdfb3ea5969 12 *
okano 0:ae0333775d7e 13 * For the details of PCT2075 and LM75B..
okano 0:ae0333775d7e 14 * PCT2075 and LM75Bの詳細は..
okano 0:ae0333775d7e 15 * http://i2c_sda.nxp.com/documents/data_sheet/PCT2075.pdf
okano 0:ae0333775d7e 16 * http://i2c_sda.nxp.com/documents/data_sheet/LM75B.pdf
okano 0:ae0333775d7e 17 */
okano 0:ae0333775d7e 18
okano 0:ae0333775d7e 19 #ifndef MBED_PCT2075_H
okano 0:ae0333775d7e 20 #define MBED_PCT2075_H
okano 0:ae0333775d7e 21
okano 0:ae0333775d7e 22 #include "mbed.h"
okano 0:ae0333775d7e 23 #include "I2CTempSensor.h"
okano 0:ae0333775d7e 24
okano 0:ae0333775d7e 25 /** PCT2075 & LM75B class library / PCT2075 & LM75B クラスライブラリ
okano 0:ae0333775d7e 26 *
okano 0:ae0333775d7e 27 * Class library provides very simple interface to read sensor value
okano 0:ae0333775d7e 28 * クラスライブラリはセンサの値を読む非常にシンプルなインターフェースを提供します
okano 0:ae0333775d7e 29 *
okano 0:ae0333775d7e 30 * Example / コード例:
okano 0:ae0333775d7e 31 * @code
okano 0:ae0333775d7e 32 * #include "mbed.h"
okano 0:ae0333775d7e 33 * #include "PCT2075.h" // or #include "LM75B.h"
okano 0:ae0333775d7e 34 *
okano 0:ae0333775d7e 35 * PCT2075 temp_sensor( p28, p27 ); // or LM75B temp_sensor( p28, p27 );
okano 0:ae0333775d7e 36 *
okano 0:ae0333775d7e 37 * int main()
okano 0:ae0333775d7e 38 * {
okano 0:ae0333775d7e 39 * while(1) {
okano 0:ae0333775d7e 40 * printf( "temp = %7.3f\r\n", (float)temp_sensor );
okano 0:ae0333775d7e 41 * wait( 1 );
okano 0:ae0333775d7e 42 * }
okano 0:ae0333775d7e 43 * }
okano 0:ae0333775d7e 44 * @endcode
okano 0:ae0333775d7e 45 */
okano 0:ae0333775d7e 46 class PCT2075 : I2CTempSensor
okano 0:ae0333775d7e 47 {
okano 0:ae0333775d7e 48 public:
okano 0:ae0333775d7e 49 /** Create a PCT2075 instance connected to specified I2C pins with specified address
okano 0:ae0333775d7e 50 * I2Cピンとスレーブアドレスを指定し,インスタンスを作成します
okano 0:ae0333775d7e 51 *
okano 0:ae0333775d7e 52 * @param i2c_sda I2C-bus SDA pin
okano 0:ae0333775d7e 53 * @param i2c_scl I2C-bus SCL pin
okano 0:ae0333775d7e 54 * @param i2c_address (option) I2C-bus slave address (default: 0x90)
okano 0:ae0333775d7e 55 */
okano 0:ae0333775d7e 56 PCT2075( PinName i2c_sda, PinName i2c_scl, char i2c_address = DEFAULT_I2C_SLAVE_ADDRESS );
okano 0:ae0333775d7e 57
okano 0:ae0333775d7e 58 /** Create a PCT2075 instance with I2C instance and specified address
okano 0:ae0333775d7e 59 * I2Cオブジェクトとスレーブアドレスを指定し,インスタンスを作成します
okano 0:ae0333775d7e 60 *
okano 0:ae0333775d7e 61 * @param i2c_obj I2C object (instance)
okano 0:ae0333775d7e 62 * @param i2c_address (option) I2C-bus slave address (default: 0x90)
okano 0:ae0333775d7e 63 */
okano 0:ae0333775d7e 64 PCT2075( I2C &i2c_obj, char i2c_address = DEFAULT_I2C_SLAVE_ADDRESS );
okano 0:ae0333775d7e 65
okano 0:ae0333775d7e 66 /** デストラクタ
okano 0:ae0333775d7e 67 */
okano 0:ae0333775d7e 68 virtual ~PCT2075();
okano 0:ae0333775d7e 69
okano 0:ae0333775d7e 70 /** Read temperature / 温度の読み出し
okano 0:ae0333775d7e 71 *
okano 0:ae0333775d7e 72 * @return Returns temperature in Celsius (float) / 摂氏温度を返します(float型)
okano 0:ae0333775d7e 73 */
okano 0:ae0333775d7e 74 virtual float read( void );
okano 0:ae0333775d7e 75
okano 0:ae0333775d7e 76 /** Read temperature / 温度の読み出し
okano 0:ae0333775d7e 77 *
okano 0:ae0333775d7e 78 * @return To make the object returns the value / オブジェクトが読みだした値を返すようにしています
okano 0:ae0333775d7e 79 */
okano 0:ae0333775d7e 80 virtual operator float( void );
okano 0:ae0333775d7e 81
okano 0:ae0333775d7e 82 private:
okano 0:ae0333775d7e 83 /** デフォルト・スレーブアドレス */
okano 0:ae0333775d7e 84 enum {
okano 0:ae0333775d7e 85 DEFAULT_I2C_SLAVE_ADDRESS = 0x90
okano 0:ae0333775d7e 86 };
okano 0:ae0333775d7e 87 };
okano 0:ae0333775d7e 88
okano 0:ae0333775d7e 89 #endif // MBED_PCT2075_H
okano 0:ae0333775d7e 90