Rolling Buffer without comments

Dependencies:   mbed

Revision:
1:9a22f8a52c4d
Parent:
0:4d13e7f795b0
Child:
2:2606e81db012
--- a/main.cpp	Sat Jul 04 08:04:12 2015 +0000
+++ b/main.cpp	Mon Jul 06 07:02:01 2015 +0000
@@ -188,7 +188,7 @@
     
 void write_data(void);
 
-     void poll(void){    
+void poll(void){    
         while(1){
         x=IRQ;
 //     cout<<"in While Loop"<<ENDL;
@@ -219,14 +219,9 @@
         return 0;
         }
   */  
+
 void write_data(void){
-//    cout<<"3"<<ENDL;
-//    cout<<"irq detected"<<ENDL;
-//    src = irq_src();
-//    wait_ms(5);
-//    t.detach();
-//    wait_us(1);
-//    t.attach_us(&poll,45000);
+
     CS=0;
     adf.write(0x0B);//IRQ_SOURCE_Random write //To read CMD = 2B 36 FF FF
     adf.write(0x36);//Address : 0x336
@@ -234,11 +229,6 @@
     CS=1;
 //    wait_us(80);
     CS=0;
-    
-    
-    CS=0;
-    k=0;
-    
     if(!j){
         adf.write(0x18);
         adf.write(0x20);
@@ -250,7 +240,7 @@
         
          }       
     
-    else if(j<=sizeof(data)/122){
+    else if(j<=sizeof(data)/112){
 //                if(src == 1){
                 if(j%2){  //src==  Buffer Half Full src == 1
                 adf.write(0x18);
@@ -265,7 +255,7 @@
             
             
             while(k<=111){
-                adf.write(data[(j+1)*112+k]);
+                adf.write(data[(k]);
                 k++;
                         
             }
@@ -319,19 +309,15 @@
     adf.write(0xFF);
     CS=1;
     wait_us(20);
-    poll();    
+//    poll();    
 //    t.attach_us(&poll,45000);
 //    int x = IRQ;
 /*        */
-//     IRQ.rise(&write_data);
-
-     
+     IRQ.rise(&write_data);
      } 
      int main()
 {   
-
-//    IRQ.mode(PullDown);
-    cout<<"in MAin"<<ENDL;
+    IRQ.mode(PullUp);
     adf.format(8,0);
     adf.frequency(1000000);
     bbram_write();