Library Fork

Fork of MODSERIAL by Andy K

Revision:
17:6c9b57c14868
Parent:
16:8b1dbf4cce4e
Child:
18:21ef26402365
--- a/MODSERIAL.h	Sat Feb 12 08:59:03 2011 +0000
+++ b/MODSERIAL.h	Tue Mar 08 01:42:25 2011 +0000
@@ -820,6 +820,8 @@
     
 #ifdef MODDMA_H
 
+    MODDMA_Config *config;
+    
     /**
      * Set the "void pointer" moddma_p to be a pointer to a
      * MODDMA controller class instance. Used to manage the
@@ -855,7 +857,7 @@
             case 3: conn = MODDMA::UART3_Tx; break;
         }
         
-        MODDMA_Config *config = new MODDMA_Config;
+        config = new MODDMA_Config;
         config
          ->channelNum    ( (MODDMA::CHANNELS)(dmaSendChannel & 0x7) )
          ->srcMemAddr    ( (uint32_t) buffer )
@@ -867,7 +869,7 @@
         ; // config end
         
         // Setup the configuration.
-        if (dma->Setup(config) != MODDMA::Ok) {
+        if (dma->Setup(config) == 0) { 
             return -1;
         }
         
@@ -920,6 +922,7 @@
         if (dma->irqType() == MODDMA::ErrIrq) dma->clearErrIrq();
         dmaSendChannel = -1;
         _isrDmaSendComplete.call();
+        delete(config);
     }
     
 #endif // MODDMA_H