read adc registers
This commit is contained in:
parent
1482a29a0f
commit
ac0bd4fc33
1 changed files with 4 additions and 2 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "inc/tm4c1294ncpdt.h"
|
||||
#include "driverlib/adc.h"
|
||||
#include "sysctl_pll.h"
|
||||
#include "inc/hw_types.h"
|
||||
|
||||
|
||||
#define ADC_BUFFER_SIZE 2048 // size must be a power of 2
|
||||
|
@ -15,7 +16,8 @@ volatile uint32_t gADCErrors = 0; // number of missed ADC deadlines
|
|||
void ADC_ISR(void)
|
||||
{
|
||||
// clear ADC1 sequence0 interrupt flag in the ADCISC register
|
||||
<...>;
|
||||
HWREGBITW(ADC1_ISC_R, 16) = 1;
|
||||
|
||||
// check for ADC FIFO overflow
|
||||
if(ADC1_OSTAT_R & ADC_OSTAT_OV0) {
|
||||
gADCErrors++; // count errors
|
||||
|
@ -23,7 +25,7 @@ void ADC_ISR(void)
|
|||
}
|
||||
gADCBufferIndex = ADC_BUFFER_WRAP(gADCBufferIndex + 1)
|
||||
// read sample from the ADC1 sequence 0 FIFO
|
||||
gADCBuffer[gADCBufferIndex] = <...>;
|
||||
gADCBuffer[gADCBufferIndex] = ADC1_SSFIFO0_R & 0xFFF;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue