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
adc.h@42:52a92a8d2cc7, 2015-01-30 (annotated)
- Committer:
- timmey9
- Date:
- Fri Jan 30 07:22:00 2015 +0000
- Revision:
- 42:52a92a8d2cc7
- Parent:
- 41:3e0623d81b9a
- Child:
- 45:d591d138cdeb
Works for ADC0_SE13 and ADC1_SE14 with their respective DMAs. Try reading port C directly into the DMA.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
timmey9 | 39:82dc3daecf32 | 1 | #ifndef ADC_H_ |
timmey9 | 39:82dc3daecf32 | 2 | #define ADC_H_ |
timmey9 | 39:82dc3daecf32 | 3 | |
timmey9 | 39:82dc3daecf32 | 4 | #include "mbed.h" |
timmey9 | 39:82dc3daecf32 | 5 | #include <stdio.h> |
timmey9 | 39:82dc3daecf32 | 6 | |
timmey9 | 39:82dc3daecf32 | 7 | // Analog sampling |
timmey9 | 39:82dc3daecf32 | 8 | #include "PeripheralNames.h" |
timmey9 | 39:82dc3daecf32 | 9 | #include "PeripheralPins.h" |
timmey9 | 39:82dc3daecf32 | 10 | #include "fsl_adc_hal.h" |
timmey9 | 39:82dc3daecf32 | 11 | #include "fsl_clock_manager.h" |
timmey9 | 39:82dc3daecf32 | 12 | #include "fsl_dspi_hal.h" |
timmey9 | 41:3e0623d81b9a | 13 | |
timmey9 | 39:82dc3daecf32 | 14 | #include "AngleEncoder.h" |
timmey9 | 41:3e0623d81b9a | 15 | #include "dma.h" |
timmey9 | 39:82dc3daecf32 | 16 | |
timmey9 | 39:82dc3daecf32 | 17 | #define MAX_FADC 6000000 |
timmey9 | 39:82dc3daecf32 | 18 | #define SAMPLING_RATE 10 // In microseconds, so 10 us will be a sampling rate of 100 kHz |
timmey9 | 39:82dc3daecf32 | 19 | |
timmey9 | 42:52a92a8d2cc7 | 20 | extern DMA dma; |
timmey9 | 41:3e0623d81b9a | 21 | |
timmey9 | 41:3e0623d81b9a | 22 | |
timmey9 | 41:3e0623d81b9a | 23 | void adc_start(); |
timmey9 | 41:3e0623d81b9a | 24 | void adc_stop(); |
timmey9 | 41:3e0623d81b9a | 25 | |
timmey9 | 41:3e0623d81b9a | 26 | void adc_init(PinName pin); |
timmey9 | 40:bd6d8c35e822 | 27 | void ADC0_IRQHandler(); |
timmey9 | 41:3e0623d81b9a | 28 | void ADC1_IRQHandler(); |
timmey9 | 41:3e0623d81b9a | 29 | //Serial debug(USBTX,USBRX); |
timmey9 | 41:3e0623d81b9a | 30 | //DigitalOut toggle; |
timmey9 | 41:3e0623d81b9a | 31 | //DMA _dma; |
timmey9 | 39:82dc3daecf32 | 32 | |
timmey9 | 41:3e0623d81b9a | 33 | #endif /* ADC_H_ */ |