trying to make telnetserver repo public
Fork of MODDMA by
Diff: example3.h
- Revision:
- 14:15939b260dfa
- Parent:
- 13:846c8b6ffb7f
- Child:
- 15:e01144bae101
--- a/example3.h Sun Mar 13 23:54:06 2011 +0000 +++ b/example3.h Mon Mar 14 00:11:56 2011 +0000 @@ -29,13 +29,14 @@ bool dmaTransferComplete; MODDMA dma; -MODDMA_Config *conf; +MODDMA_Config *conf, conf_copy; void TC0_callback(void); void ERR0_callback(void); int main() { - + volatile int life_counter = 0; + // Macros defined in iomacros.h, saves messing with DigitalIn p30_AS_INPUT; p30_MODE( PIN_PULLUP ); // P0.4 p29_AS_INPUT; p29_MODE( PIN_PULLUP ); // P0.5 @@ -82,8 +83,11 @@ // Begin. LPC_TIM1->TCR = 1; - while (1) { - led1 = !led1; // Show some sort of life. + while (1) { + if (life_counter++ > 1000000) { + led1 = !led1; // Show some sort of life. + life_counter = 0; + } if (dmaTransferComplete) { dmaTransferComplete = false; @@ -95,8 +99,7 @@ // Schedule another grab. if (dma.Setup( conf )) { - dma.Enable( conf ); - LPC_TIM1->TCR = 1; + dma.Enable( conf ); } } } @@ -107,10 +110,7 @@ // Just show sample sequence grab complete. led3 = !led3; - - // Disable firing timer. - LPC_TIM1->TCR = 0; - + // Get configuration pointer. MODDMA_Config *config = dma.getConfig();