From ac0bd4fc33b9424f1dc342da3294a541e58dd30d Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Thu, 27 Mar 2025 10:31:30 -0400 Subject: [PATCH] read adc registers --- sampling.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sampling.c b/sampling.c index 2adcea6..118936e 100644 --- a/sampling.c +++ b/sampling.c @@ -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; }