Updated i2c interface to work correctly with mBed and Hexiwear
Dependents: Hexi_Click_IRThermo_Example
Fork of MLX90614 by
Revision 2:01d333d06727, committed 2011-06-09
- Comitter:
- aquahika
- Date:
- Thu Jun 09 13:28:50 2011 +0000
- Parent:
- 1:4a60d3f1e91e
- Child:
- 3:eb618e916622
- Commit message:
- add class description
Changed in this revision
| mlx90614.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mlx90614.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/mlx90614.cpp Thu Jun 09 13:07:40 2011 +0000
+++ b/mlx90614.cpp Thu Jun 09 13:28:50 2011 +0000
@@ -1,6 +1,9 @@
#include "mlx90614.h"
+
+
+
MLX90614::MLX90614(I2C* i2c,int addr){
this->i2caddress = addr;
--- a/mlx90614.h Thu Jun 09 13:07:40 2011 +0000
+++ b/mlx90614.h Thu Jun 09 13:28:50 2011 +0000
@@ -13,10 +13,44 @@
// If you want to check CRC, please do it your self :)
//****************************************************************//
+/**************************************
+**An Interface for MLX90614
+* Sample Code
+*
+*@code
+* //Print temperature data
+* #include "mbed.h"
+* #include "mlx90614.h"
+*
+* I2C i2c(p28,p27); //sda,scl
+* MLX90614 thermometer(&i2c);
+*
+* void main(void){
+* if(thermo.getTemp(&temp)){
+* printf("Temperature : %f \r\n",temp);
+* }
+* wait(0.5);
+*
+* }
+*@endcode
+**************************************/
+
+
class MLX90614{
public:
+ /** Create MLX90614 interface, initialize with selected I2C port and address.
+ *
+ * @param i2c I2C device pointer
+ * @param addr Device address(default=0xB4)
+ */
MLX90614(I2C* i2c,int addr=0xB4);
+
+ /** Get Temperature data from MLX90614.
+ *
+ * @param temp_val return valiable pointer
+ * @return 0 on success (ack), or non-0 on failure (nack)
+ */
bool getTemp(float* temp_val);
private:
