|
HRI board firmware
v2.1
Microcontroller firmware of the board used during the HRI labs.
|
Driver for the analog-to-digital peripheral of the STM32. More...
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... | |
Driver for the analog-to-digital peripheral of the STM32.
An analog-to-digital converter (ADC) is used to measure the voltage of one or several microcontroller analog pins.
In addition, there is an additional channel to measure the current going through the motor (useful for current regulation).
Call adc_Init() first, in the initialization code. Then, call adc_GetChannelVoltage() every time you need the voltage.
To measure accurately the motor current, a calibration has to be performed first. Call dc_CalibrateCurrentSens() in the main(), when the current regulation is disabled (see H-bridge documentation). Then, call adc_GetCurrent() every time it is needed. This function returns the last value transfered by the DMA, so there is no conversion delay when calling this function.
| enum AdcChannel |
Enum that corresponds to the two ADC input channels of the board.
| void adc_CalibrateCurrentSens | ( | void | ) |
Compute the current sense offset.
| float32_t adc_GetChannelVoltage | ( | AdcChannel | channel | ) |
Gets the voltage measured by the selected ADC channel.
| channel | the channel of the ADC. |
| float32_t adc_GetCurrent | ( | void | ) |
Compute the current sense offset.
| The | measured current in [mA]. |
| void adc_Init | ( | void | ) |
Initialize the ADC converter (2 analog inputs + current sense).
1.8.13