Updated i2c interface to work correctly with mBed and Hexiwear

Dependents:   Hexi_Click_IRThermo_Example

Fork of MLX90614 by Hikaru Sugiura

mlx90614.h

Committer:
daveyclk
Date:
2016-10-27
Revision:
5:8f8aedd25609
Parent:
4:dcd4fe76bd13

File content as of revision 5:8f8aedd25609:

#include "mbed.h"

//Melexis Infrared Thermometer MLX90614 Library

//*****************************************************************
//  Build : 27/10/16 Dave Clarke
//          Only read thermo data.
//
//  This program does not check CRC.
//  If you want to check CRC, please do it your self :)
//****************************************************************//

/**An Interface for MLX90614
* 
* @code
* //Print temperature data
* #include "mbed.h"
* #include "mlx90614.h"
*
* I2C i2c(p28,p27);   //sda,scl
* MLX90614 thermometer(&i2c);
* float temp;
*
* void main(void){
*   if(thermometer.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,uint8_t 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:
       I2C* i2c;
       int i2caddress;

       

};