Impedance Fast Circuitry Software

Dependencies:   mbed-dsp mbed

Fork of DSP_200kHz by Mazzeo Research Group

Revision:
46:a015ebf4663b
Parent:
45:d591d138cdeb
Child:
47:54fafe151669
--- a/main.cpp	Sat Jan 31 07:25:52 2015 +0000
+++ b/main.cpp	Sat Jan 31 08:13:33 2015 +0000
@@ -20,13 +20,10 @@
 extern uint16_t sample_array0[];
 extern uint16_t sample_array1[];
 extern uint16_t angle_array[];
-extern DigitalIn AMT20_A; // input for quadrature encoding from angle encoder
-extern DigitalIn AMT20_B; // input for quadrature encoding from angle encoder
 
-
+bool switcher = false;
 // Declaration of functions
 
-int rotary_count = 0;
 using namespace std;
  
 int main() {
@@ -42,17 +39,12 @@
     dma_init();
     pdb_init();
     
+    led_green = 1;
     
     pc.printf("\r\n\r\n\r\n");
     
     while(1) {
-        
-        rotary_count++;
-        if(rotary_count & 0x01) AMT20_A.mode(PullUp);
-        else AMT20_A.mode(PullDown);
-        if((rotary_count>>1) & 0x01) AMT20_B.mode(PullUp);
-        else AMT20_B.mode(PullDown);
-        
+        pc.printf("PDB0: %i\r",switcher);
         if(pc.readable() > 0) {
             char temp = pc.getc();
             
@@ -62,19 +54,20 @@
                     pc.printf("Quad Cnt: %i\r\n", quad_read());
                     break;
                 case 'A':
-                case 'a':
+                case 'a': // needs debugging
                     adc_start();
                     for(int i = 0; i < 1500; i++) asm("nop");
                     adc_stop();
                     // then proceed to 's' to display the array
                 case 'S':
                 case 's':
-                    for(int i = 0; i < len; i++) pc.printf("%i: %f\t %f\t %i%i\r\n",i,sample_array0[i]*3.3/65535,sample_array1[i]*3.3/65535, (angle_array[i]>>1)&0x01, angle_array[i]&0x01);
+                    for(int i = 0; i < len; i++) pc.printf("%i: %f\t %f\t %i\r\n",i,sample_array0[i]*3.3/65535,sample_array1[i]*3.3/65535, angle_array[i]);
                     pc.printf("\r\n");
                     break;
                 case 'D':
                 case 'd':
                     adc_single_sample();
+                    DMA_TCD2_CSR |= DMA_CSR_START_MASK;
                     break;
                 case 'F':
                 case 'f':