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/
SimpleDMA_common.cpp
- Committer:
- wkleunen
- Date:
- 2017-05-12
- Revision:
- 9:f7345d41b076
- Parent:
- 5:d9f46ef80e20
File content as of revision 9:f7345d41b076:
#include "SimpleDMA.h" void SimpleDMA::channel(int chan) { if (chan == -1) { auto_channel = true; _channel = 0; } else { auto_channel = false; if (chan >= 0 && chan < DMA_CHANNELS) _channel = chan; else _channel = DMA_CHANNELS-1; } } int SimpleDMA::getFreeChannel(void) { int retval = 0; while(1) { if (!isBusy(retval)) return retval; retval++; if (retval >= DMA_CHANNELS) retval = 0; } }