1#ifndef RENSSELAERMOTORSPORT_ANALOGSENSOR_H
2#define RENSSELAERMOTORSPORT_ANALOGSENSOR_H
8#include "stm32f7xx_hal_adc.h"
9#include "stm32f7xx_hal_dma.h"
10#include "stm32f7xx_hal_uart.h"
22#define ADC_CHANNELS 16
23#define UART_BUF_SIZE 100
24#define BUFFER_SIZE 1000
38void ProcessADCData(uint16_t* adc1_data, uint16_t* adc2_data, uint16_t* adc3_data);
47extern UART_HandleTypeDef
huart2;
int getAnalogSensorData(AnalogSensor *sensor)
Retrieves analog sensor data for a specific channel.
DMA_HandleTypeDef hdma_adc1
void initAnalogSensor(AnalogSensor *analogSensor, const char *name, int hz, int channel)
Initializes an analog sensor and configures the corresponding GPIO pin.
void ProcessADCData(uint16_t *adc1_data, uint16_t *adc2_data, uint16_t *adc3_data)
Processes ADC data from all three ADCs and stores it in the circular buffer.
DMA_HandleTypeDef hdma_adc3
ADCSample getLatestSample(void)
Retrieves the latest ADC sample from the buffer.
uint32_t getRecentSamples(ADCSample *samples, uint32_t num_samples)
Retrieves a specified number of recent samples from the buffer.
char uart_buf[UART_BUF_SIZE]
UART_HandleTypeDef huart2
DMA_HandleTypeDef hdma_adc2