example project to explain how to write a class library
Diff: test_LM75B.h
- Revision:
- 0:6ecb302da815
- Child:
- 1:239684cd8ae9
diff -r 000000000000 -r 6ecb302da815 test_LM75B.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test_LM75B.h Mon Nov 03 00:06:50 2014 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" + +// LM75B I2C slave address +#define ADDRESS_LM75B 0x90 + +// LM75B registers +#define LM75B_Conf 0x01 +#define LM75B_Temp 0x00 +#define LM75B_Tos 0x03 +#define LM75B_Thyst 0x02 + +class test_LM75B +{ +public: + test_LM75B( PinName sda, PinName scl ); + ~test_LM75B(); + void init( void ); + float read( void ); +private: + I2C i2c; +};