Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: MLX90620.cpp
- Revision:
- 2:82782c73251e
- Parent:
- 1:fd536ebc7eaf
diff -r fd536ebc7eaf -r 82782c73251e MLX90620.cpp
--- a/MLX90620.cpp Thu Jul 21 23:09:24 2016 +0000
+++ b/MLX90620.cpp Tue Jul 26 19:52:23 2016 +0000
@@ -24,7 +24,7 @@
_i2c.stop(); //initialize with a stop
mlxDev = MLXtype; //user select device 620 or 621
}
-
+
//--------------------------------------------------------------------------------------------------------------------------------------//
//copy contents of EEPROM inside the MLX9062x into a local buffer. Data is used for lookup tables and parameters
@@ -37,20 +37,20 @@
//clear out buffer first
for(int i = 0; i < 256; i++) Pntr.MLXEEbuf[i] = 0; //clear out entire EEMPROM buffer
-
- //load the entire EEPROM
- Pntr.MLXEEbuf[0] = 0; //start at address 0 of EEPROM
+
+//the following code addition of a 1 byte I2C fetch is due to a bug in the F746NG which can only transfer 255 bytes at a time. grrr!!!....
+#if defined(TARGET_DISCO_F746NG)
+#warning "TARGET_DISCO_F746NG i2c bug, 255 byte limit!!!"
+ Pntr.MLXEEbuf[0] = 255;
+ if(!_i2c.write(MLX_EEPADDR, Pntr.MLXEEbuf, 1, true)) {
+ _i2c.read((MLX_EEPADDR + 1), Pntr.MLXEEbuf, 1, false);
+ Pntr.MLXEEbuf[255] = Pntr.MLXEEbuf[0];
+ Pntr.MLXEEbuf[0] = 0;
+ _i2c.write(MLX_EEPADDR, Pntr.MLXEEbuf, 1, true);
+ _i2c.read((MLX_EEPADDR + 1), Pntr.MLXEEbuf, 255, false); //s/b 256 if F746NG bug wasn't there
+#else
if(!_i2c.write(MLX_EEPADDR, Pntr.MLXEEbuf, 1, true)) { //send command, 0 returned is ok
-
-#ifdef MLX_EEP_EASY_LOAD
- _i2c.read((MLX_EEPADDR + 1), Pntr.MLXEEbuf, 256);//**** this command does not work with the KL25Z and v63 of mbed.lbr !!!!
-#else
- _i2c.start();
- _i2c.write(MLX_EEPADDR + 1);
- for(int i = 0; i < 256; i++) {
- Pntr.MLXEEbuf[i] = _i2c.read(1);
- }
- _i2c.stop();
+ _i2c.read((MLX_EEPADDR + 1), Pntr.MLXEEbuf, 256, false);
#endif
} else {
@@ -658,3 +658,4 @@
}
+