NetBurner 3.5.6
PDF Version
PeriodicAD_DMA.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
5#include <basictypes.h>
6
7#define DMA_CH_DTER_0 8
8#define DMA_CH_DTER_1 9
9#define DMA_CH_DTER_2 10
10#define DMA_CH_DTER_3 11
11
12#define DMA_ERR_NOERR 0
13#define DMA_ERR_CHNOTSET 1
14#define DMA_ERR_TMRNOTSET 2
15#define DMA_ERR_TMRRUNNING 3
16
17// Initialize the dma timer to sample the ADC
18int initADC_DMA(int channel = 0, int timerNum = 3);
19
20// Set the sample period for the ADC (in us)
21double setSamplePeriod(uint32_t period);
22
23// Set the sample frequency (in Hz)
24double setSampleFreq(uint32_t freq);
25
26// Start logging the ADC using DMA. The period is in units of 1 us
27int startADC_DMA(void *buffer, uint32_t bufferSize, void (*isrfunc)(void *, void *));
28
29// Stop the DMA Timer and ADC
30void stopADC_DMA();