HRI board firmware  v2.1
Microcontroller firmware of the board used during the HRI labs.
Functions | Variables
adc.c File Reference
#include "adc.h"
#include "../lib/basic_filter.h"
#include "../lib/utils.h"

Functions

void adc_DmaInit (void)
 Setup the DMA that copies the current ADC samples to the RAM. More...
 
void adc_Init (void)
 Initialize the ADC converter (2 analog inputs + current sense). More...
 
void adc_CalibrateCurrentSens (void)
 Compute the current sense offset. More...
 
float32_t adc_GetCurrent (void)
 Compute the current sense offset. More...
 
void adc_StartConversion (AdcChannel channel)
 Start the ADC conversion of the selected channel. More...
 
bool adc_ConversionIsFinished (void)
 Gets the ADC conversion status of the selected channel. More...
 
float32_t adc_GetConversionResult (void)
 Gets the voltage measured by the selected ADC channel. More...
 
float32_t adc_GetChannelVoltage (AdcChannel channel)
 Gets the voltage measured by the selected ADC channel. More...
 

Variables

volatile uint16_t adc_currentValuesBuffer [ADC_BUFFER_SIZE]
 
bfilt_BasicFilter adc_currentFilter
 
float32_t adc_currentSensOffset = 0.0f
 

Function Documentation

◆ adc_ConversionIsFinished()

bool adc_ConversionIsFinished ( void  )

Gets the ADC conversion status of the selected channel.

Return values
1if the conversion is finished, 0 otherwise.

◆ adc_DmaInit()

void adc_DmaInit ( void  )

Setup the DMA that copies the current ADC samples to the RAM.

◆ adc_GetConversionResult()

float32_t adc_GetConversionResult ( void  )

Gets the voltage measured by the selected ADC channel.

Returns
the measured voltage [V].
Note
make sure that the conversion is finished before calling.

◆ adc_StartConversion()

void adc_StartConversion ( AdcChannel  channel)

Start the ADC conversion of the selected channel.

Parameters
channelthe ADC channel to acquire.

Variable Documentation

◆ adc_currentFilter

bfilt_BasicFilter adc_currentFilter

◆ adc_currentSensOffset

float32_t adc_currentSensOffset = 0.0f

◆ adc_currentValuesBuffer

volatile uint16_t adc_currentValuesBuffer[ADC_BUFFER_SIZE]