Updated i2c interface to work correctly with mBed and Hexiwear
Dependents: Hexi_Click_IRThermo_Example
Fork of MLX90614 by
mlx90614.h
00001 #include "mbed.h" 00002 00003 //Melexis Infrared Thermometer MLX90614 Library 00004 00005 //***************************************************************** 00006 // Build : 27/10/16 Dave Clarke 00007 // Only read thermo data. 00008 // 00009 // This program does not check CRC. 00010 // If you want to check CRC, please do it your self :) 00011 //****************************************************************// 00012 00013 /**An Interface for MLX90614 00014 * 00015 * @code 00016 * //Print temperature data 00017 * #include "mbed.h" 00018 * #include "mlx90614.h" 00019 * 00020 * I2C i2c(p28,p27); //sda,scl 00021 * MLX90614 thermometer(&i2c); 00022 * float temp; 00023 * 00024 * void main(void){ 00025 * if(thermometer.getTemp(&temp)){ 00026 * printf("Temperature : %f \r\n",temp); 00027 * } 00028 * wait(0.5); 00029 * 00030 * } 00031 * @endcode 00032 */ 00033 00034 00035 class MLX90614{ 00036 00037 public: 00038 /** Create MLX90614 interface, initialize with selected I2C port and address. 00039 * 00040 * @param i2c I2C device pointer 00041 * @param addr Device address(default=0xB4) 00042 */ 00043 MLX90614(I2C* i2c,uint8_t addr=0xB4); 00044 00045 /** Get Temperature data from MLX90614. 00046 * 00047 * @param temp_val return valiable pointer 00048 * @return 0 on success (ack), or non-0 on failure (nack) 00049 */ 00050 bool getTemp(float* temp_val); 00051 00052 private: 00053 I2C* i2c; 00054 int i2caddress; 00055 00056 00057 00058 };
Generated on Fri Jul 15 2022 02:23:28 by 1.7.2