Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed FastIO FastPWM USBDevice
Diff: SimpleDMA/SimpleDMA_common.cpp
- Revision:
- 45:c42166b2878c
diff -r b5ac89b9cd5d -r c42166b2878c SimpleDMA/SimpleDMA_common.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SimpleDMA/SimpleDMA_common.cpp Mon Feb 15 20:30:32 2016 +0000 @@ -0,0 +1,25 @@ +#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; + } +} \ No newline at end of file