
HelloWorld program showing SimpleDMA with mainly UART stuff
Dependencies: SimpleDMA mbed-rtos mbed
Revision 1:418889681f13, committed 2014-01-04
- Comitter:
- Sissors
- Date:
- Sat Jan 04 14:58:41 2014 +0000
- Parent:
- 0:cf18a31facd6
- Commit message:
- LPC1768 support added
;
Changed in this revision
diff -r cf18a31facd6 -r 418889681f13 SimpleDMA.lib --- a/SimpleDMA.lib Thu Dec 26 16:32:59 2013 +0000 +++ b/SimpleDMA.lib Sat Jan 04 14:58:41 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/Sissors/code/SimpleDMA/#c3a84c6c432c +http://mbed.org/users/Sissors/code/SimpleDMA/#d9f46ef80e20
diff -r cf18a31facd6 -r 418889681f13 main.cpp --- a/main.cpp Thu Dec 26 16:32:59 2013 +0000 +++ b/main.cpp Sat Jan 04 14:58:41 2014 +0000 @@ -3,7 +3,7 @@ #include "SimpleDMA.h" DigitalOut led1(LED1); -SimpleDMA dma; +SimpleDMA dma(0); RawSerial pc(USBTX, USBRX); void callback(void) { @@ -41,10 +41,16 @@ //Now to UART, enable DMA in UART, destination is now //a fixed address, so address pointer should not be incremented, //thus second argument is false. Also set trigger to UART0_RX. - //This sends a new value to the UART as soon as it is possible + //This sends a new value to the UART as soon as it is possible + #ifdef TARGET_LPC1768 + LPC_UART0->FCR |= 1<<3; + dma.destination(&LPC_UART0->THR, false); + #endif + #ifdef TARGET_KL25Z UART0->C5 |= (1<<7) | (1<<5); + dma.destination(&UART0->D, false); + #endif dma.source(characters2, true); - dma.destination(&UART0->D, false); dma.trigger(Trigger_UART0_TX); dma.start(10); @@ -65,7 +71,13 @@ Thread thread(led_thread); thread.set_priority(osPriorityLow); + #ifdef TARGET_LPC1768 + dma.source(&LPC_UART0->THR, false); + #endif + #ifdef TARGET_KL25Z dma.source(&UART0->D, false); + #endif + //Trigger is now the receiving on the UART dma.trigger(Trigger_UART0_RX);
diff -r cf18a31facd6 -r 418889681f13 mbed-rtos.lib --- a/mbed-rtos.lib Thu Dec 26 16:32:59 2013 +0000 +++ b/mbed-rtos.lib Sat Jan 04 14:58:41 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#ee87e782d34f +http://mbed.org/users/mbed_official/code/mbed-rtos/#29007aef10a4