3 channel_MUX

Dependencies:   BufferedSerial MAX30003 max32630fthr1 DS1307

Files at this revision

API Documentation at this revision

Comitter:
parthsagar2010
Date:
Wed Aug 05 04:33:07 2020 +0000
Parent:
7:cf0855a0450a
Child:
9:24ecf16eab0f
Commit message:
To MH Egypt Team

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Dec 14 21:42:36 2017 +0000
+++ b/main.cpp	Wed Aug 05 04:33:07 2020 +0000
@@ -1,49 +1,15 @@
-/*******************************************************************************
- * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
- * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of Maxim Integrated
- * Products, Inc. shall not be used except as stated in the Maxim Integrated
- * Products, Inc. Branding Policy.
- *
- * The mere transfer of this software does not imply any licenses
- * of trade secrets, proprietary technology, copyrights, patents,
- * trademarks, maskwork rights, or any other form of intellectual
- * property whatsoever. Maxim Integrated Products, Inc. retains all
- * ownership rights.
- *******************************************************************************
- */
- 
 
-
+#include "MAX30003.h"
 #include "mbed.h"
 #include "max32630fthr.h"
-#include "MAX30003.h"
+
 
 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
 
 void ecg_config(MAX30003 &ecgAFE);
 
-/* ECG FIFO nearly full callback */
 volatile bool ecgFIFOIntFlag = 0; 
-void ecgFIFO_callback()  {
+void ecgFIFO_callback_1()  { // Triggered when the ECG FIFO is about to be full
     
     ecgFIFOIntFlag = 1;
 
@@ -58,20 +24,19 @@
     const int FIFO_VALID_SAMPLE_MASK =  0x0;
     const int FIFO_FAST_SAMPLE_MASK =  0x1;
     const int ETAG_BITS_MASK = 0x7;
+    DigitalOut rLed(LED1, LED_OFF);
     
-    // Ports and serial connections
     Serial pc(USBTX, USBRX);            // Use USB debug probe for serial link
     pc.baud(115200);                    // Baud rate = 115200
     
-    DigitalOut rLed(LED1, LED_OFF);      // Debug LEDs
-    
     InterruptIn ecgFIFO_int(P5_4);          // Config P5_4 as int. in for the
-    ecgFIFO_int.fall(&ecgFIFO_callback);    // ecg FIFO almost full interrupt
+    ecgFIFO_int.fall(&ecgFIFO_callback_1);    // ecg FIFO interrupt at falling edge
     
     SPI spiBus(SPI2_MOSI, SPI2_MISO, SPI2_SCK);     // SPI bus, P5_1 = MOSI, 
                                                     // P5_2 = MISO, P5_0 = SCK
     
     MAX30003 ecgAFE(spiBus, P5_3);          // New MAX30003 on spiBus, CS = P5_3 
+    
     ecg_config(ecgAFE);                    // Config ECG