Changed MCP3221 I2C read from two 1-byte reads to one 2-byte read

Dependents:   DISCO-F746NG_LCD_TS_ADC

Fork of MCP3221 by David Styles

Revision:
1:2921687d299e
Parent:
0:db4e3d0374fe
diff -r db4e3d0374fe -r 2921687d299e MCP3221.cpp
--- a/MCP3221.cpp	Wed Oct 31 21:43:28 2012 +0000
+++ b/MCP3221.cpp	Thu Feb 02 06:10:38 2017 +0000
@@ -28,13 +28,15 @@
 
 
   //  char data[2];
-
+/*
     i2c.start();
     int acknowledged = i2c.write(MCP3221_CONVERSE); //send a byte to start the conversation. It should be acknowledged.
     _data[0] = i2c.read(1);  //read a byte. acknowledge when we have it.
     _data[1] = i2c.read(0);  //read the second byte. (n)acknowledge when we have it to stop the flow.
     i2c.stop();
- 
+*/
+    // PA20170202 in the DISCO-F746NG the above does not return the LS byte, however this works
+    i2c.read(MCP3221_CONVERSE, _data, 2);
     //convert to 12 bit.
     short res;
     int _12_bit_var; // 2 bytes