void MLX90621::initialise(int refrate) { refreshRate = refrate; Wire.begin(I2C_MASTER, 0, I2C_PINS_18_19, I2C_PULLUP_INT, I2C_RATE_100); delay(5); readEEPROM(); writeTrimmingValue(); setConfiguration(); }
void MLX90621::measure() { if (checkConfig()) { readEEPROM(); writeTrimmingValue(); setConfiguration(); } readPTAT(); readIR(); calculateTA(); readCPIX(); calculateTO(); }
void Thermal_init(){ I2C_init(THERMAL_I2C_ID,I2C_CLOCK_FREQ); count = 0; readEeprom(); writeTrimmingValue(); writeConfigReg(); readConfigReg(); configCalculationData(); Timer_new(TIMER_THERMAL,READ_DELAY); }
//Read the 256 bytes from the MLX EEPROM and setup the various constants (*lots* of math) //Note: The EEPROM on the MLX has a different I2C address from the MLX. I've never seen this before. void read_EEPROM_MLX90620() { i2c_start_wait(MLX90620_EEPROM_WRITE); i2c_write(0x00); //EEPROM info starts at location 0x00 i2c_rep_start(MLX90620_EEPROM_READ); //Read all 256 bytes from the sensor's EEPROM for(int i = 0 ; i <= 255 ; i++) eepromData[i] = i2c_readAck(); i2c_stop(); //We're done talking varInitialization(eepromData); //Calculate a bunch of constants from the EEPROM data writeTrimmingValue(eepromData[OSC_TRIM_VALUE]); }