add includes

This commit is contained in:
Andy Killorin 2025-03-27 10:37:54 -04:00
parent ac0bd4fc33
commit 1d2833a282
Signed by: ank
GPG key ID: 23F9463ECB67FE8C

View file

@ -2,8 +2,15 @@
#include <stdbool.h> #include <stdbool.h>
#include "inc/tm4c1294ncpdt.h" #include "inc/tm4c1294ncpdt.h"
#include "driverlib/adc.h" #include "driverlib/adc.h"
#include "driverlib/pin_map.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include "driverlib/interrupt.h"
#include "sysctl_pll.h" #include "sysctl_pll.h"
#include "inc/hw_types.h" #include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include <math.h>
#include "buttons.h"
#define ADC_BUFFER_SIZE 2048 // size must be a power of 2 #define ADC_BUFFER_SIZE 2048 // size must be a power of 2
@ -23,9 +30,9 @@ void ADC_ISR(void)
gADCErrors++; // count errors gADCErrors++; // count errors
ADC1_OSTAT_R = ADC_OSTAT_OV0; // clear overflow condition ADC1_OSTAT_R = ADC_OSTAT_OV0; // clear overflow condition
} }
gADCBufferIndex = ADC_BUFFER_WRAP(gADCBufferIndex + 1) gADCBufferIndex = ADC_BUFFER_WRAP(gADCBufferIndex + 1);
// read sample from the ADC1 sequence 0 FIFO // read sample from the ADC1 sequence 0 FIFO
gADCBuffer[gADCBufferIndex] = ADC1_SSFIFO0_R & 0xFFF; gADCBuffer[gADCBufferIndex] = (ADC1_SSFIFO0_R & ADC_SSFIFO0_DATA_M);
} }
@ -50,13 +57,12 @@ void start_sampler() {
0); // specify the "Always" trigger 0); // specify the "Always" trigger
// in the 0th step, sample channel 3 (AIN3) // in the 0th step, sample channel 3 (AIN3)
// enable interrupt, and make it the end of sequence // enable interrupt, and make it the end of sequence
ADCSequenceStepConfigure(ADC1_BASE, 0, 0, ADC_CTL_CH3)); ADCSequenceStepConfigure(ADC1_BASE, 0, 0, ADC_CTL_CH3);
// enable the sequence. it is now sampling // enable the sequence. it is now sampling
ADCSequenceEnable(ADC0_BASE, 0); ADCSequenceEnable(ADC0_BASE, 0);
// enable sequence 0 interrupt in the ADC1 peripheral // enable sequence 0 interrupt in the ADC1 peripheral
ADCIntEnable(INT_ADC1SS0); ADCIntEnable(ADC1_BASE, INT_ADC1SS0);
IntPrioritySet(INT_ADC1SS0, 0); // set ADC1 sequence 0 interrupt priority IntPrioritySet(INT_ADC1SS0, 0); // set ADC1 sequence 0 interrupt priority
// enable ADC1 sequence 0 interrupt in int. controller // enable ADC1 sequence 0 interrupt in int. controller
IntEnable(INT_ADC1SS0); IntEnable(INT_ADC1SS0);
}
}