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
--- a/SimpleDMA.h	Tue Jan 27 14:30:18 2015 +0000
+++ b/SimpleDMA.h	Fri May 12 10:26:15 2017 +0000
@@ -117,36 +117,10 @@
 *
 * @param function - function to call upon completion (may be a member function)
 */
-void attach(void (*function)(void)) {
-    _callback.attach(function);
+void attach(Callback<void(int)> func) {
+    _callback = func;
     }
     
-template<typename T>
-    void attach(T *object, void (T::*member)(void)) {
-        _callback.attach(object, member);
-    }
-
-#ifdef RTOS_H
-/**
-* Start a DMA transfer similar to start, however block current Thread
-* until the transfer is finished
-*
-* When using this function only the current Thread is halted.
-* The Thread is moved to Waiting state: other Threads will continue
-* to run normally. 
-*
-* This function is only available if you included rtos.h before 
-* including SimpleDMA.h.
-*
-* @param length - number of BYTES to be moved by the DMA
-*/
-void wait(int length) {
-    id = Thread::gettid();
-    this->attach(this, &SimpleDMA::waitCallback);
-    this->start(length);
-    Thread::signal_wait(0x1);
-}
-#endif
 
 protected:
 int _channel;
@@ -161,7 +135,7 @@
 bool auto_channel;
 
 //IRQ handlers
-FunctionPointer _callback;
+Callback<void(int)> _callback;
 void irq_handler(void);
 
 static SimpleDMA *irq_owner[DMA_CHANNELS];
@@ -177,11 +151,6 @@
 //Keep searching until we find a non-busy channel, start with lowest channel number
 int getFreeChannel(void);
 
-#ifdef RTOS_H
-osThreadId id;
-void waitCallback(void) {
-    osSignalSet(id, 0x1);    
-}
-#endif
+
 };
 #endif
\ No newline at end of file