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

Functions
Driver / DAC

Driver for the digital-to-analog converter. More...

## Functions
void | dac_Init (void)
| Setup a DAC with 2 channels. More...
void | dac_SetVoltage1 (float32_t voltage)
| Set the voltage of the channel 1 of the DAC. More...
void | dac_SetVoltage2 (float32_t voltage)
| Set the voltage of the channel 2 of the DAC. More...
float32_t | dac_GetVoltage1 (void)
| Get the current output voltage of the channel 1 of the DAC. More...
float32_t | dac_GetVoltage2 (void)
| Get the current output voltage of the channel 2 of the DAC. More...

## Detailed Description

Driver for the digital-to-analog converter.

The STM32 features a two channels DAC, which means it is able to drive two pins with an analog voltage. On the HRI board, this voltage is mulltiplied by an amplification stage, so the final output range is +-9V. The corresponding output pins are on the J1 connector: ANOUT1 (2) and ANOUT2 (4).

In the initialization code, call dac_Init() once. Then call dac_GetVoltageX() everytime the output voltage needs to be updated.

## Function Documentation

## ◆ dac_GetVoltage1()

float32_t dac_GetVoltage1 | ( | void |  | ) |

Get the current output voltage of the channel 1 of the DAC.

Return values

  The | current voltage of the channel 1 of the DAC [V].

## ◆ dac_GetVoltage2()

float32_t dac_GetVoltage2 | ( | void |  | ) |

Get the current output voltage of the channel 2 of the DAC.

Return values

  The | current voltage of the channel 2 of the DAC [V].

## ◆ dac_Init()

void dac_Init | ( | void |  | ) |

Setup a DAC with 2 channels.

## ◆ dac_SetVoltage1()

void dac_SetVoltage1 | ( | float32_t | finalVoltage | ) |

Set the voltage of the channel 1 of the DAC.

Parameters

  finalVoltage | the new voltage [V], between +-DAC_FINAL_RANGE (+-9V).

## ◆ dac_SetVoltage2()

void dac_SetVoltage2 | ( | float32_t | finalVoltage | ) |

Set the voltage of the channel 2 of the DAC.

Parameters

  finalVoltage | the new voltage [V], between +-DAC_FINAL_RANGE (+-9V).