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: adc.h
- Revision:
- 45:d591d138cdeb
- Parent:
- 42:52a92a8d2cc7
- Child:
- 51:43143a3fc2d7
--- a/adc.h Fri Jan 30 14:56:58 2015 +0000 +++ b/adc.h Sat Jan 31 07:25:52 2015 +0000 @@ -2,32 +2,30 @@ #define ADC_H_ #include "mbed.h" -#include <stdio.h> - -// Analog sampling -#include "PeripheralNames.h" -#include "PeripheralPins.h" -#include "fsl_adc_hal.h" -#include "fsl_clock_manager.h" -#include "fsl_dspi_hal.h" - -#include "AngleEncoder.h" #include "dma.h" -#define MAX_FADC 6000000 -#define SAMPLING_RATE 10 // In microseconds, so 10 us will be a sampling rate of 100 kHz +/*** + * Sets ADC to continuous conversion mode with software trigger, then + * triggers the ADC. + **/ +void adc_start(); -extern DMA dma; - - -void adc_start(); +/*** + * Sets ADC to single conversion mode with hardware trigger. So the + * ADC stops unless triggered by a timer. + **/ void adc_stop(); -void adc_init(PinName pin); +/*** + * Initializes the ADC to 16-bit single-ended CH13, hardware triggered + * with DMA enabled. + **/ +void adc_init(); + +/*** + * Toggles PTC16 when conversion completes + **/ void ADC0_IRQHandler(); -void ADC1_IRQHandler(); -//Serial debug(USBTX,USBRX); -//DigitalOut toggle; -//DMA _dma; +void adc_single_sample(); #endif /* ADC_H_ */ \ No newline at end of file