Test
Revision 18:e7d62a489a83, committed 2019-04-25
- Comitter:
- ktseng
- Date:
- Thu Apr 25 19:20:22 2019 +0000
- Parent:
- 17:97a16bf2ff43
- Commit message:
- Test;
Changed in this revision
example3.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 97a16bf2ff43 -r e7d62a489a83 example3.h --- a/example3.h Sat Mar 02 19:27:12 2013 +0000 +++ b/example3.h Thu Apr 25 19:20:22 2019 +0000 @@ -16,7 +16,7 @@ // Value is in microseconds. (500000 is half a second). #define SAMPLE_PERIOD 500000 -#define NUM_OF_SAMPLES 5 +#define NUM_OF_SAMPLES 16 Serial pc(USBTX, USBRX); @@ -37,19 +37,15 @@ 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 - p8_AS_INPUT; p8_MODE( PIN_PULLUP ); // P0.6 - p7_AS_INPUT; p7_MODE( PIN_PULLUP ); // P0.7 + // Sets bits 4-7 on port 0 to pulled down outputs. + p30_AS_OUTPUT; p30_MODE( PIN_PULLDOWN ); // P0.4 + p29_AS_OUTPUT; p29_MODE( PIN_PULLDOWN ); // P0.5 + p8_AS_OUTPUT; p8_MODE( PIN_PULLDOWN ); // P0.6 + p7_AS_OUTPUT; p7_MODE( PIN_PULLDOWN ); // P0.7 // Clear the buffer. memset(buffer, 0, sizeof(buffer)); - // Setup the serial port to print out results. - pc.baud(115200); - pc.printf("Starting up...\n"); - // Set-up timer1 as a periodic timer. LPC_SC->PCONP |= (1UL << 2); // TIM1 On LPC_SC->PCLKSEL0 |= (3UL << 4); // CCLK/8 = 12MHz @@ -61,10 +57,10 @@ conf = new MODDMA_Config; conf ->channelNum ( MODDMA::Channel_0 ) - ->srcMemAddr ( (uint32_t)&LPC_GPIO0->FIOPIN ) - ->dstMemAddr ( (uint32_t)&buffer[0] ) + ->srcMemAddr ( (uint32_t)&buffer[0] ) //Buffer data to be transferred + ->dstMemAddr ( (uint32_t)&LPC_GPIO0->FIOPIN ) //GPIO to be transferred ->transferSize ( NUM_OF_SAMPLES ) - ->transferType ( MODDMA::g2m ) // pseudo transfer code MODDMA understands. + ->transferType ( MODDMA::m2g ) // pseudo transfer code MODDMA understands. ->transferWidth ( MODDMA::word ) ->srcConn ( MODDMA::MAT1_0 ) ->dmacSync ( MODDMA::MAT1_0 )