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
main.cpp
- Committer:
- bmazzeo
- Date:
- 2016-02-16
- Revision:
- 54:1697dc574b96
- Parent:
- 53:83a90a47c1fd
- Child:
- 55:2526b3317bc8
File content as of revision 54:1697dc574b96:
#include "mbed.h" // Sampling #include "DMA_sampling/adc.h" #include "DMA_sampling/dac.h" // for debug purposes Serial pc(USBTX, USBRX); DigitalOut led_red(LED_RED); DigitalOut led_green(LED_GREEN); DigitalOut led_blue(LED_BLUE); // defined in dma.cpp extern int len; extern uint16_t sample_array0[]; extern uint16_t sample_array1[]; extern uint16_t static_input_array0[]; extern uint16_t static_input_array1[]; using namespace std; int main() { led_blue = 1; led_green = 1; led_red = 1; pc.baud(230400); pc.printf("Starting\r\n"); dac_init(); // initializes DAC adc_init(); // always initialize adc before dma pc.printf("ADC Initialized\r\n"); dma_init(); // initializes DMAs led_green = 1; pc.printf("\r\n\r\n\r\n"); while(1) { //DMA_TCD2_CSR //int counter = 0; //pc.printf("Sample_array0[1]:%d\r\n",sample_array0[counter]); //ADC0_SC1A = 0x0C; //AIEN = 0, DIFF = 0, Channel = AD12 (PTB2) //ADC1_SC1A = 0x0E; //AIEN = 0, DIFF = 0, Channel = AD14 (PTB10) //while( (ADC0_SC1A&ADC_SC1_COCO_MASK)) {} //while( (ADC1_SC1A&ADC_SC1_COCO_MASK)) {} //pc.printf("ADC0_RA:%d\r\n", ADC0_RA); //pc.printf("ADC1_RA:%d\r\n", ADC1_RA); //for(int i = 0; i < len; i++) pc.printf("A%i: %d\t %d\r\n",i,sample_array0[i],sample_array1[i]); //for(int i = 0; i < len; i++) pc.printf("B%i: %d\t %d\r\n",i,static_input_array0[i],static_input_array1[i]); //wait_ms(1000); int store_var = DMA_TCD2_CSR; if (store_var == 0x220) { DAC0_DAT0H = 0x0F; wait_us(10); //DMA_TCD0_CSR = 0x260; } if (store_var == 0x260) { DAC0_DAT0H = 0x00; wait_us(10); } //int store_var = DMA_TCD0_CSR; pc.printf("DMA0: %x\r\n", DMA_TCD0_CSR); pc.printf("DMA1: %x\r\n", DMA_TCD1_CSR); pc.printf("DMA2: %x\r\n", DMA_TCD2_CSR); pc.printf("DMA3: %x\r\n", DMA_TCD3_CSR); //wait_us(100); } }