upgrade ds1621 to report fp temp's
[fw/sdcc] / device / examples / ds390 / i2c390 / pcf8591.c
index 7b1352cfa5099a1bfbd2060f10197fc94434efe6..4d86e8e7cb63ffc37da034628b665af59a43d51c 100644 (file)
@@ -1,16 +1,21 @@
 #include "i2clole.h"
 #include "pcf8591.h"
 
+#if 0 || FIND_OPERATOR_PRECEDING_INCONSISTANCY
+#undef PCF8591_ID
+#define PCF8591_ID 0x90;
+#endif
+
 unsigned char ReadPCF8591(char address, char channel) {
   
-  unsigned char id=PCF8591_ID + address<<1;
+  unsigned char id=PCF8591_ID+address<<1;
   
   while (!I2CReset()) {
     //fprintf (stderr, "I2C bus busy, retrying.\n");
   }
   
-  i2cTransmitBuffer[0]=channel&0x03 + 0x40; //output enable, not autoincrement
-  //i2cTransmitBuffer[1]=0; // dac output
+  // set output enable, no autoincrement
+  i2cTransmitBuffer[0]=channel&0x03+0x40;
 
   // read 2 bytes, since the first one is the old value
   if (I2CSendReceive(id, 1, 2))