lib for working with ltc2991s

Dependents:   ece495_firmware

Fork of ltc2991_test by Logan Rooper

Revision:
8:c0ae66611a12
Parent:
5:8aa0f4e6788c
--- a/LTC2991.cpp	Wed Dec 14 07:01:13 2016 +0000
+++ b/LTC2991.cpp	Thu Jan 19 02:55:42 2017 +0000
@@ -71,7 +71,7 @@
 #include "LTC2991.h"
 #include "mbed.h"
 
-Serial pc2(USBTX, USBRX, 9600);
+//Serial pc2(USBTX, USBRX, 115200);
 
 LTC2991::LTC2991() {
     lti2c = new LT_I2C();
@@ -108,7 +108,7 @@
   uint8_t reg_data;
   uint16_t timer_count;  // Timer count for data_valid
 
-  for (timer_count = 0; timer_count < timeout; timer_count++)
+  for (timer_count = 0; timer_count < 2000; timer_count++)
   {
     //pc2.printf("status_bit: %d\n", status_bit);
     
@@ -134,13 +134,13 @@
       break;
     }
 
-    wait_ms(1);
+    wait_us(50);
   }
 
   ack |= LTC2991_adc_read(i2c_address, msb_register_address, &(*adc_code), &(*data_valid));   //! 2) It's either valid or it's timed out, we read anyways
   if (*data_valid  !=1)
   {
-    pc2.printf("Data not valid: 0x%X\n", *data_valid);
+    //pc2.printf("Data not valid: 0x%X\n", *data_valid);
     return (1);
   }