![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ok see #define to of code uses MODSERIAL - buffered serial
Diff: main.cpp
- Revision:
- 0:6bd2bff61284
--- /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) ); + } +}