lib for working with ltc2991s

Dependents:   ece495_firmware

Fork of ltc2991_test by Logan Rooper

Files at this revision

API Documentation at this revision

Comitter:
bdk9
Date:
Thu Jan 19 02:55:42 2017 +0000
Parent:
7:832fd12d477b
Commit message:
Final Code

Changed in this revision

LTC2991.cpp Show annotated file Show diff for this revision Revisions of this file
LT_I2C.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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);
   }
 
--- a/LT_I2C.cpp	Wed Dec 14 07:01:13 2016 +0000
+++ b/LT_I2C.cpp	Thu Jan 19 02:55:42 2017 +0000
@@ -89,7 +89,6 @@
 #ifndef F_CPU
 #define F_CPU 16000000UL
 #endif
-Serial pc1(USBTX, USBRX, 9600);
 
 
 LT_I2C::LT_I2C() {