Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Impedance_Fast_Circuitry by
Diff: main.cpp
- Revision:
- 51:43143a3fc2d7
- Parent:
- 50:33524a27e08c
- Child:
- 52:5a40cc58c4c2
--- a/main.cpp Sat Jan 31 19:46:00 2015 +0000 +++ b/main.cpp Sat Jan 31 20:17:58 2015 +0000 @@ -10,17 +10,16 @@ DigitalOut led_red(LED_RED); DigitalOut led_green(LED_GREEN); DigitalOut led_blue(LED_BLUE); +DigitalOut quadA(PTC17); +DigitalOut quadB(PTC16); AngleEncoder angle_encoder(PTD2, PTD3, PTD1, PTD0, 8, 0, 1000000); // mosi, miso, sclk, cs, bit_width, mode, hz -DigitalOut quadA(PTC17); -DigitalOut quadB(PTC16); + extern int len; extern uint16_t sample_array0[]; extern uint16_t sample_array1[]; extern uint16_t angle_array[]; -bool switcher = false; - using namespace std; int main() { @@ -33,10 +32,10 @@ pc.baud(230400); pc.printf("Starting\r\n"); - quad_init(); + quad_init(); // initialize FTM2 to quadrature decoder adc_init(); // always initialize adc before dma - dma_init(); - pdb_init(); + dma_init(); // initializes DMAs + pdb_init(); // initialize PDB0 as the timer for ADCs and DMA2 led_green = 1; @@ -56,13 +55,6 @@ case 'g': pc.printf("Quad Cnt: %i\r\n", quad_read()); break; - /* - case 'A': - case 'a': // needs debugging - adc_start(); - for(int i = 0; i < 1500; i++) asm("nop"); - adc_stop(); - // then proceed to 's' to display the array*/ case 'F': // clear the samples case 'f': for(int i = 0; i < len; i++) {sample_array0[i] = 0; sample_array1[i] = 0; angle_array[i] = 0;} @@ -73,19 +65,8 @@ for(int i = 0; i < len; i++) pc.printf("%i: %f\t %f\t %i\r\n",i,sample_array0[i]*3.3/65535,sample_array1[i]*3.3/65535, angle_array[i]); pc.printf("\r\n"); break; - /* - case 'D': - case 'd': - adc_single_sample(); // trigger ADCs, which trigger DMA - DMA_TCD2_CSR |= DMA_CSR_START_MASK; // trigger encoder DMA - break;*/ - - - - - // Programmable Delay Block debug case 'B': case 'b':