Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: PCT2075_Hello Brushless_STM3_ESC_2019_10 Alternator2020_06
PCT2075.h
00001 /** PCT2075 and LM75B component class library 00002 * PCT2075 と LM75B 用のコンポーネント・クラス・ライブラリです 00003 * 00004 * This is new NXP PCT2075 and classic LM75B component class library 00005 * This works for both PCT2075 and LM75B 00006 * 00007 * @author Tedd OKANO 00008 * @version 1.0 00009 * @date 05-Mar-2015 00010 * 00011 * Released under the Apache 2 license License 00012 * 00013 * For the details of PCT2075 and LM75B.. 00014 * PCT2075 and LM75Bの詳細は.. 00015 * http://i2c_sda.nxp.com/documents/data_sheet/PCT2075.pdf 00016 * http://i2c_sda.nxp.com/documents/data_sheet/LM75B.pdf 00017 */ 00018 00019 #ifndef MBED_PCT2075_H 00020 #define MBED_PCT2075_H 00021 00022 #include "mbed.h" 00023 #include "I2CTempSensor.h" 00024 00025 /** PCT2075 & LM75B class library / PCT2075 & LM75B クラスライブラリ 00026 * 00027 * Class library provides very simple interface to read sensor value 00028 * クラスライブラリはセンサの値を読む非常にシンプルなインターフェースを提供します 00029 * 00030 * Example / コード例: 00031 * @code 00032 * #include "mbed.h" 00033 * #include "PCT2075.h" // or #include "LM75B.h" 00034 * 00035 * PCT2075 temp_sensor( p28, p27 ); // or LM75B temp_sensor( p28, p27 ); 00036 * 00037 * int main() 00038 * { 00039 * while(1) { 00040 * printf( "temp = %7.3f\r\n", (float)temp_sensor ); 00041 * wait( 1 ); 00042 * } 00043 * } 00044 * @endcode 00045 */ 00046 class PCT2075 : I2CTempSensor 00047 { 00048 public: 00049 /** Create a PCT2075 instance connected to specified I2C pins with specified address 00050 * I2Cピンとスレーブアドレスを指定し,インスタンスを作成します 00051 * 00052 * @param i2c_sda I2C-bus SDA pin 00053 * @param i2c_scl I2C-bus SCL pin 00054 * @param i2c_address (option) I2C-bus slave address (default: 0x90) 00055 */ 00056 PCT2075( PinName i2c_sda, PinName i2c_scl, char i2c_address = DEFAULT_I2C_SLAVE_ADDRESS ); 00057 00058 /** Create a PCT2075 instance with I2C instance and specified address 00059 * I2Cオブジェクトとスレーブアドレスを指定し,インスタンスを作成します 00060 * 00061 * @param i2c_obj I2C object (instance) 00062 * @param i2c_address (option) I2C-bus slave address (default: 0x90) 00063 */ 00064 PCT2075( I2C &i2c_obj, char i2c_address = DEFAULT_I2C_SLAVE_ADDRESS ); 00065 00066 /** デストラクタ 00067 */ 00068 virtual ~PCT2075(); 00069 00070 /** Read temperature / 温度の読み出し 00071 * 00072 * @return Returns temperature in Celsius (float) / 摂氏温度を返します(float型) 00073 */ 00074 virtual float read( void ); 00075 00076 /** Read temperature / 温度の読み出し 00077 * 00078 * @return To make the object returns the value / オブジェクトが読みだした値を返すようにしています 00079 */ 00080 virtual operator float( void ); 00081 00082 private: 00083 /** デフォルト・スレーブアドレス */ 00084 enum { 00085 DEFAULT_I2C_SLAVE_ADDRESS = 0x90 00086 }; 00087 }; 00088 00089 #endif // MBED_PCT2075_H 00090
Generated on Wed Jul 13 2022 08:50:39 by
1.7.2