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

Functions
Driver / H-bridge

Driver for the H-bridge of the motor. More...

## Functions
void | hb_Init (void)
| Initialize the pins and the PWM timer to control the H-bridge. More...
void | hb_Enable (void)
| Enable the motor driver. More...
void | hb_Disable (void)
| Disable the motor driver. More...
void | hb_SetPWM (float32_t ratio)
| Set the PWM duty. More...
bool | hb_HasFault (void)
| Gets the fault state. Gets the fault state of the H-Bridge from its nFAULT line. A fault may be because of an undervoltage, overcurrent or overtemperature. More...

## Detailed Description

Driver for the H-bridge of the motor.

The DC motor is supplied by a H-bridge on the HRI board. These power electronics are controlled by the microcontroller using a PWM timer.

Call hb_Init() first in the initialization code. Then, call hb_Enable() to enable the H-bridge chip (power on), and hb_SetPWM() to set the motor voltage.

## Function Documentation

## ◆ hb_Disable()

void hb_Disable | ( | void |  | ) |

Disable the motor driver.

## ◆ hb_Enable()

void hb_Enable | ( | void |  | ) |

Enable the motor driver.

## ◆ hb_HasFault()

bool hb_HasFault | ( | void |  | ) |

Gets the fault state. Gets the fault state of the H-Bridge from its nFAULT line. A fault may be because of an undervoltage, overcurrent or overtemperature.

Returns
  true if there is a fault, false otherwise.

## ◆ hb_Init()

void hb_Init | ( | void |  | ) |

Initialize the pins and the PWM timer to control the H-bridge.

## ◆ hb_SetPWM()

void hb_SetPWM | ( | float32_t | ratio | ) |

Set the PWM duty.

Parameters

  ratio | PWM duty ("on" time ratio) [-1.0 to 1.0]. 0 means zero voltage at the motor leads, -1 and 1 are max voltages.