DMA library for the KL25Z

Dependents:   SimpleDMA_HelloWorld RTOS_SPI spiDMAtest Pinscape_Controller_v1 ... more

Introduction

SimpleDMA is a standard library for different DMA peripherals. Currently the LPC1768, KL46Z and KL25Z are supported. It provided one set of functions for different peripherals. It does not allow for usage of all the advanced functions, partially because the goal was to provide a simple interface, and partially because they are different for different microcontrollers.

Examples

Helloworld: http://mbed.org/users/Sissors/code/SimpleDMA_HelloWorld/

Example in a library (SPI): http://mbed.org/users/Sissors/code/RTOS_SPI/

Revision:
9:f7345d41b076
Parent:
8:876f3b55e6f5
diff -r 876f3b55e6f5 -r f7345d41b076 SimpleDMA_KL25_46.cpp
--- a/SimpleDMA_KL25_46.cpp	Tue Jan 27 14:30:18 2015 +0000
+++ b/SimpleDMA_KL25_46.cpp	Fri May 12 10:26:15 2017 +0000
@@ -1,11 +1,12 @@
 #if defined TARGET_KL25Z || defined TARGET_KL46Z
 #include "SimpleDMA.h"
 
-
+static void donothing(int) { }
 
 SimpleDMA *SimpleDMA::irq_owner[4] = {NULL};
 
 SimpleDMA::SimpleDMA(int channel) {
+    _callback = donothing;
     this->channel(channel);
        
     //Enable DMA
@@ -76,12 +77,15 @@
     return (DMA0->DMA[channel].DSR_BCR & 0xFFFFFF);
 }
 
-
 /*****************************************************************/
 void SimpleDMA::irq_handler(void) {
+    Callback<void(int)> func = _callback;
+    _callback = donothing;
+    
     DMAMUX0->CHCFG[_channel] = 0;
     DMA0->DMA[_channel].DSR_BCR |= DMA_DSR_BCR_DONE_MASK ; 
-    _callback.call();
+    
+    func(_channel);    
 }
 
 void SimpleDMA::irq_handler0( void ) {