HRI board firmware v2.1 Microcontroller firmware of the board used during the HRI labs.

Macros | Enumerations | Functions
adc.h File Reference
`#include "../main.h"`

Go to the source code of this file.

## Macros
#define | ADC_HALL_PIN GPIO_Pin_1
#define | ADC_HALL_PORT GPIOB
#define | ADC_HALL_CHANNEL ADC_Channel_9
#define | ADC_ANIN1_PIN GPIO_Pin_6
#define | ADC_ANIN1_PORT GPIOA
#define | ADC_ANIN1_CHANNEL ADC_Channel_6
#define | ADC_ANIN2_PIN GPIO_Pin_7
#define | ADC_ANIN2_PORT GPIOA
#define | ADC_ANIN2_CHANNEL ADC_Channel_7
#define | ADC_ANIN3_PIN GPIO_Pin_4
#define | ADC_ANIN3_PORT GPIOC
#define | ADC_ANIN3_CHANNEL ADC_Channel_14
#define | ADC_ANIN4_PIN GPIO_Pin_5
#define | ADC_ANIN4_PORT GPIOC
#define | ADC_ANIN4_CHANNEL ADC_Channel_15
#define | ADC_CURRENT_SENSE_PIN GPIO_Pin_3
#define | ADC_CURRENT_SENSE_PORT GPIOA
#define | ADC_CURRENT_SENSE_CHANNEL ADC_Channel_3
#define | ADC_MAX 4095.0f
#define | ADC_MAX_CONVERSION_TIME 100
#define | ADC_BUFFER_SIZE 33
#define | ADC_CURRENT_SCALE (ADC_REF_VOLTAGE / (CURRENT_SHUNT_RESISTANCE * CURRENT_SHUNT_AMPLIFIER_GAIN * ADC_MAX))
#define | ADC_CALIB_N_SAMPLES 1000

## Enumerations
enum | AdcChannel { ADC_CHANNEL_9 = 9, ADC_CHANNEL_6 = 6, ADC_CHANNEL_7 = 7, ADC_CHANNEL_14 = 14, ADC_CHANNEL_15 = 15 }
| Enum that corresponds to the two ADC input channels of the board. More...

## Functions
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...
float32_t | adc_GetChannelVoltage (AdcChannel channel)
| Gets the voltage measured by the selected ADC channel. More...

## Macro Definition Documentation

## ◆ ADC_ANIN1_CHANNEL

#define ADC_ANIN1_CHANNEL ADC_Channel_6

## ◆ ADC_ANIN1_PIN

#define ADC_ANIN1_PIN GPIO_Pin_6

## ◆ ADC_ANIN1_PORT

#define ADC_ANIN1_PORT GPIOA

## ◆ ADC_ANIN2_CHANNEL

#define ADC_ANIN2_CHANNEL ADC_Channel_7

## ◆ ADC_ANIN2_PIN

#define ADC_ANIN2_PIN GPIO_Pin_7

## ◆ ADC_ANIN2_PORT

#define ADC_ANIN2_PORT GPIOA

## ◆ ADC_ANIN3_CHANNEL

#define ADC_ANIN3_CHANNEL ADC_Channel_14

## ◆ ADC_ANIN3_PIN

#define ADC_ANIN3_PIN GPIO_Pin_4

## ◆ ADC_ANIN3_PORT

#define ADC_ANIN3_PORT GPIOC

## ◆ ADC_ANIN4_CHANNEL

#define ADC_ANIN4_CHANNEL ADC_Channel_15

## ◆ ADC_ANIN4_PIN

#define ADC_ANIN4_PIN GPIO_Pin_5

## ◆ ADC_ANIN4_PORT

#define ADC_ANIN4_PORT GPIOC

## ◆ ADC_BUFFER_SIZE

#define ADC_BUFFER_SIZE 33

## ◆ ADC_CALIB_N_SAMPLES

#define ADC_CALIB_N_SAMPLES 1000

## ◆ ADC_CURRENT_SCALE

#define ADC_CURRENT_SCALE (ADC_REF_VOLTAGE / (CURRENT_SHUNT_RESISTANCE * CURRENT_SHUNT_AMPLIFIER_GAIN * ADC_MAX))

## ◆ ADC_CURRENT_SENSE_CHANNEL

#define ADC_CURRENT_SENSE_CHANNEL ADC_Channel_3

## ◆ ADC_CURRENT_SENSE_PIN

#define ADC_CURRENT_SENSE_PIN GPIO_Pin_3

## ◆ ADC_CURRENT_SENSE_PORT

#define ADC_CURRENT_SENSE_PORT GPIOA

## ◆ ADC_HALL_CHANNEL

#define ADC_HALL_CHANNEL ADC_Channel_9

## ◆ ADC_HALL_PIN

#define ADC_HALL_PIN GPIO_Pin_1

## ◆ ADC_HALL_PORT

#define ADC_HALL_PORT GPIOB

## ◆ ADC_MAX

#define ADC_MAX 4095.0f

## ◆ ADC_MAX_CONVERSION_TIME

#define ADC_MAX_CONVERSION_TIME 100