3 channel_MUX

Dependencies:   BufferedSerial MAX30003 max32630fthr1 DS1307

Files at this revision

API Documentation at this revision

Comitter:
coreyharris
Date:
Mon Aug 28 20:57:10 2017 +0000
Parent:
4:06e258ff0b97
Child:
6:86ac850c718d
Commit message:
update the FIFO interrupt flag

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Aug 28 16:09:51 2017 +0000
+++ b/main.cpp	Mon Aug 28 20:57:10 2017 +0000
@@ -45,12 +45,12 @@
         // Read back ECG samples from the FIFO 
         if( ecgFIFOIntFlag ) {
             
+            ecgFIFOIntFlag = 0; 
             status = ecgAFE.readRegister( MAX30003::STATUS );      // Read the STATUS register
              
             // Check if EINT interrupt asserted
             if ( ( status & EINT_STATUS_MASK ) == EINT_STATUS_MASK ) {     
             
-                ecgFIFOIntFlag = 0; 
                 readECGSamples = 0;                        // Reset sample counter
                 
                 do {
@@ -120,6 +120,7 @@
     
     //Enable interrupts register setting
     MAX30003::EnableInterrupts_u EN_INT_r;
+    EN_INT_r.all = 0;
     EN_INT_r.bits.en_eint = 1;              // Enable EINT interrupt
     EN_INT_r.bits.en_rrint = 0;             // Disable R-to-R interrupt
     EN_INT_r.bits.intb_type = 3;            // Open-drain NMOS with internal pullup
@@ -130,8 +131,13 @@
     MAX30003::ManageDynamicModes_u MNG_DYN_r;
     MNG_DYN_r.bits.fast = 0;                // Fast recovery mode disabled
     ecgAFE.writeRegister( MAX30003::MNGR_DYN , MNG_DYN_r.all);
+    
+    // MUX Config
+    MAX30003::MuxConfiguration_u CNFG_MUX_r;
+    CNFG_MUX_r.bits.openn = 0;          // Connect ECGN to AFE channel
+    CNFG_MUX_r.bits.openp = 0;          // Connect ECGP to AFE channel
+    ecgAFE.writeRegister( MAX30003::CNFG_EMUX , CNFG_MUX_r.all);
        
-    
     return;
 }