example project to explain how to write a class library
test_LM75B Class Reference
test_LM75Bクラスライブラリ More...
#include <test_LM75B.h>
Public Member Functions | |
test_LM75B (PinName sda, PinName scl, char address=ADDRESS_LM75B) | |
I2Cピンとスレーブアドレスを指定し,インスタンスを作成します | |
test_LM75B (I2C &i2c_obj, char address=ADDRESS_LM75B) | |
I2Cオブジェクトとスレーブアドレスを指定し,インスタンスを作成します | |
~test_LM75B () | |
デストラクタ | |
void | init (void) |
初期化 | |
float | read (void) |
温度の読み出し | |
operator float (void) | |
温度の読み出し |
Detailed Description
test_LM75Bクラスライブラリ
クラスライブラリは非常にシンプルなインターフェースを提供します
コード例:
#include "mbed.h" #include "test_LM75B.h" test_LM75B temp0( p28, p27 ); I2C i2c( p28, p27 ); test_LM75B temp1( i2c ); int main() { float t0; float t1; i2c.frequency( 400 * 1000 ); while(1) { t0 = temp0; t1 = temp1; printf( "temp = %7.3f, %7.3f\r\n", t0, t1 ); wait( 1 ); } }
Definition at line 57 of file test_LM75B.h.
Constructor & Destructor Documentation
test_LM75B | ( | PinName | sda, |
PinName | scl, | ||
char | address = ADDRESS_LM75B |
||
) |
I2Cピンとスレーブアドレスを指定し,インスタンスを作成します
- Parameters:
-
sda I2C-bus SDAピン scl I2C-bus SCLピン address (オプション) I2C-bus スレーブアドレス (デフォルト: 0x90)
Definition at line 3 of file test_LM75B.cpp.
test_LM75B | ( | I2C & | i2c_obj, |
char | address = ADDRESS_LM75B |
||
) |
I2Cオブジェクトとスレーブアドレスを指定し,インスタンスを作成します
- Parameters:
-
i2c_obj I2C オブジェクト (インスタンス) address (オプション) I2C-bus スレーブアドレス (デフォルト: 0x90)
Definition at line 9 of file test_LM75B.cpp.
~test_LM75B | ( | ) |
デストラクタ
Definition at line 15 of file test_LM75B.cpp.
Member Function Documentation
void init | ( | void | ) |
初期化
Definition at line 21 of file test_LM75B.cpp.
operator float | ( | void | ) |
float read | ( | void | ) |
Generated on Fri May 17 2024 16:10:41 by 1.7.2