Jared Baxter
/
Impedance_Fast_Circuitry
Impedance Fast Circuitry Software
Fork of DSP_200kHz by
main.cpp@53:83a90a47c1fd, 2016-02-09 (annotated)
- Committer:
- bmazzeo
- Date:
- Tue Feb 09 15:11:08 2016 +0000
- Revision:
- 53:83a90a47c1fd
- Parent:
- 52:5a40cc58c4c2
- Child:
- 54:1697dc574b96
ADC initialization and calibration up and running.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:bb128f0e952f | 1 | #include "mbed.h" |
timmey9 | 22:523e316cbe70 | 2 | |
timmey9 | 52:5a40cc58c4c2 | 3 | // Sampling |
bmazzeo | 53:83a90a47c1fd | 4 | #include "DMA_sampling/adc.h" |
timmey9 | 22:523e316cbe70 | 5 | |
timmey9 | 22:523e316cbe70 | 6 | // for debug purposes |
timmey9 | 18:b17ddeeb1c09 | 7 | Serial pc(USBTX, USBRX); |
timmey9 | 18:b17ddeeb1c09 | 8 | DigitalOut led_red(LED_RED); |
timmey9 | 18:b17ddeeb1c09 | 9 | DigitalOut led_green(LED_GREEN); |
timmey9 | 18:b17ddeeb1c09 | 10 | DigitalOut led_blue(LED_BLUE); |
timmey9 | 51:43143a3fc2d7 | 11 | |
timmey9 | 52:5a40cc58c4c2 | 12 | // defined in dma.cpp |
timmey9 | 45:d591d138cdeb | 13 | extern int len; |
timmey9 | 45:d591d138cdeb | 14 | extern uint16_t sample_array0[]; |
timmey9 | 45:d591d138cdeb | 15 | extern uint16_t sample_array1[]; |
timmey9 | 41:3e0623d81b9a | 16 | |
timmey9 | 22:523e316cbe70 | 17 | using namespace std; |
timmey9 | 17:2f978f823020 | 18 | |
emilmont | 7:65188f4a8c25 | 19 | int main() { |
timmey9 | 22:523e316cbe70 | 20 | led_blue = 1; |
timmey9 | 35:df40c4566826 | 21 | led_green = 1; |
timmey9 | 18:b17ddeeb1c09 | 22 | led_red = 1; |
timmey9 | 34:44cc9b76a507 | 23 | |
timmey9 | 18:b17ddeeb1c09 | 24 | pc.baud(230400); |
timmey9 | 34:44cc9b76a507 | 25 | pc.printf("Starting\r\n"); |
timmey9 | 27:8c2b30c855d1 | 26 | |
timmey9 | 45:d591d138cdeb | 27 | adc_init(); // always initialize adc before dma |
bmazzeo | 53:83a90a47c1fd | 28 | |
bmazzeo | 53:83a90a47c1fd | 29 | pc.printf("ADC Initialized\r\n"); |
bmazzeo | 53:83a90a47c1fd | 30 | |
timmey9 | 51:43143a3fc2d7 | 31 | dma_init(); // initializes DMAs |
timmey9 | 45:d591d138cdeb | 32 | |
timmey9 | 46:a015ebf4663b | 33 | led_green = 1; |
timmey9 | 38:ec3b16c130d7 | 34 | |
timmey9 | 40:bd6d8c35e822 | 35 | pc.printf("\r\n\r\n\r\n"); |
timmey9 | 37:8bdc71f3e874 | 36 | |
timmey9 | 34:44cc9b76a507 | 37 | while(1) { |
bmazzeo | 53:83a90a47c1fd | 38 | pc.printf("%f",sample_array0[1]); |
bmazzeo | 53:83a90a47c1fd | 39 | wait_ms(500); |
timmey9 | 17:2f978f823020 | 40 | } |
timmey9 | 42:52a92a8d2cc7 | 41 | } |