avnish aggarwal
/
Bootcamp-dma-serial
ok see #define to of code uses MODSERIAL - buffered serial
Revision 0:6bd2bff61284, committed 2014-03-19
- Comitter:
- avnisha
- Date:
- Wed Mar 19 04:15:19 2014 +0000
- Commit message:
- ok
Changed in this revision
diff -r 000000000000 -r 6bd2bff61284 MODDMA.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODDMA.lib Wed Mar 19 04:15:19 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/avnisha/code/MODDMA/#0c13ac53e36d
diff -r 000000000000 -r 6bd2bff61284 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 19 04:15:19 2014 +0000 @@ -0,0 +1,42 @@ + +// +// needed for backward code compatibility !!!! +// + +#define _uidx _serial.index + +#include "mbed.h" +#include "MODDMA.h" +#include "MODSERIAL.h" + + +/* + * Uses DMA to send data to buffer attached to a serial device + */ + + +DigitalOut led1(LED1); +DigitalOut led4(LED4); +MODSERIAL pc(USBTX, USBRX); +MODDMA dma; + +class FOO { +public: + void dmaCallback(MODSERIAL_IRQ_INFO *q) { led4 = 1; } +}; + +FOO foo; + +int main() { + char s[] = "This is a DMA transfer test\n\r"; + pc.baud( 9600 ); + pc.MODDMA( &dma ); + pc.attach_dmaSendComplete( &foo, &FOO::dmaCallback ); + pc.dmaSend( s, sizeof(s) ); + + while(1) { + led1 = !led1; + wait(0.2); + pc.dmaSend( s, sizeof(s) ); + } +}
diff -r 000000000000 -r 6bd2bff61284 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 19 04:15:19 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1 \ No newline at end of file