ECE3849/sampling.h
2025-03-27 12:33:39 -04:00

18 lines
446 B
C

#ifndef SAMPLING_H_
#define SAMPLING_H_
#include <stdint.h>
#define ADC_BUFFER_SIZE 2048 // size must be a power of 2
// index wrapping macro
#define ADC_BUFFER_WRAP(i) ((i) & (ADC_BUFFER_SIZE - 1))
volatile int32_t gADCBufferIndex;
volatile uint16_t gADCBuffer[ADC_BUFFER_SIZE]; // circular buffer
volatile uint32_t gADCErrors; // number of missed ADC deadlines
// initialize ADC and ISR
void start_sampler(void);
#endif /* SAMPLING_H_ */