Library for the MAX11300

Dependents:   MAXREFDES130_131_Demo MAXREFDES130_Demo MAX11300_test

Files at this revision

API Documentation at this revision

Comitter:
j3
Date:
Sun Jul 31 22:00:30 2016 +0000
Parent:
5:c75c615f95b2
Commit message:
added counter for num samples in read adc

Changed in this revision

MAX11300.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r c75c615f95b2 -r 09a5c5c8081c MAX11300.cpp
--- a/MAX11300.cpp	Sun Jul 31 05:17:10 2016 +0000
+++ b/MAX11300.cpp	Sun Jul 31 22:00:30 2016 +0000
@@ -181,9 +181,16 @@
     
     if(((port_config_design_vals[port] & 0xF000) >> 12) == MAX11300::MODE_7)
     {
-        m_cnvt = 0;
-        wait_us(1);
-        m_cnvt = 1;
+        uint8_t num_samples = ((port_config_design_vals[port] & port_cfg_00_funcprm_nsamples) >> 5);
+        num_samples = (1 << num_samples);
+        
+        while(num_samples--)
+        {
+            m_cnvt = 0;
+            wait_us(1);
+            m_cnvt = 1;
+            wait_us(100);
+        }
         data = read_register(static_cast<MAX11300RegAddress_t>(adc_data_port_00 + port));
         
         result = MAX11300::Success;