This is a test program for the ADS1256 ADC transducer together with the DISCO-L475G STM32 board.

Dependencies:   mbed ADS1256

Revision:
3:d9b97ff44d28
Parent:
2:4b6ca4d9c0c7
--- a/main.cpp	Wed Aug 21 11:02:36 2019 +0000
+++ b/main.cpp	Wed Aug 21 11:04:11 2019 +0000
@@ -7,9 +7,6 @@
 #define CHIP_SLCT D9
 #define CHANNEL_NUM 4
 
-
-//#define DRTYPE 0 // 0 - readDataSync, 1 - readDataMux
-//#define SINGLE_CHANNEL 0 //1 - single channel, 0 - multiple channel
 #define NO_OF_SENSORS  4 // 1- 1 sensor, 2- 2 sensors, 3- 3 sensors, 4- 4 sensors
 
 DigitalIn ndrdy =  D10;
@@ -20,48 +17,11 @@
 SPI spi(SPI_MOSI, SPI_MISO, SPI_SCLK);
 ADS1256 ads(&spi, &ndrdy, &cs);
 
-//extern uint8_t ads.channel;            /* The current channel*/
 int32_t ads_sum = 0;
 
-//#if SINGLE_CHANNEL
-//    /*
-//        @brief: Read Data from a single channel
-//    */
-//    void readDataSingleChannel()
-//    {
-//        ads.readSingleChannel();
-//        pc.printf("The value read is %d\n", ads.adcNow[ads.channel]); // Specifically for channel 0.
-//        wait_us(1000);
-//    }
-//#else 
-    /*
-        @brief: Read data from multiple channels
-    */
-//    #if !DRTYPE
-//    /* 
-//        @brief: Settling time using Synchronization. 
-//    */
-//    void readDataSync()
-//    {
-//        for(int i=ads.channel;i<CHANNEL_NUM;i++)
-//        {
-//            ads.channel = i;
-//            ads.waitDRDY();
-//            ads.isr();
-//        }
-//        ads.channel = 0;
-//        for (int i=0; i<CHANNEL_NUM; i++)
-//        {
-//            ads_sum+= ads.adcNow[i];
-//        }
-//        pc.printf("The total value read is %d\n", ads_sum);
-//        ads_sum=0;
-//        wait_us(1000);
-//    }
-//    #else
-//    /* 
-//        @brief: Settling time using the Input Multiplexer.
-//    */
+/* 
+    @brief: Settling time using the Input Multiplexer.
+*/
 #if NO_OF_SENSORS == 1
     void readDataMux()
     {
@@ -121,23 +81,15 @@
             pc.printf("INVALID NUMBER OF SENSORS INITIALIZED\n");
        }
 #endif
-    
-//    #endif
-//#endif
+
 void process(void)
 {
-//    #if SINGLE_CHANNEL 
-//        readDataSingleChannel();
-//    #else 
-//        #if !DRTYPE
-//        readDataSync();
-//        #else
+
     readDataMux();
     pc.printf("The total value read is %d\n", ads_sum);
     ads_sum=0;
     wait_us(1000);
-//        #endif
-//    #endif
+
     pc.printf("The value in adcNow[0] is %d\n", ads.adcNow[0]);
     pc.printf("The value in adcNow[1] is %d\n", ads.adcNow[1]);
     pc.printf("The value in adcNow[2] is %d\n", ads.adcNow[2]);