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

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

Go to the source code of this file.

## Macros
#define | PWM1_Pin 6
#define | PWM1_Port GPIOC
#define | PWM2_Pin 7
#define | PWM2_Port GPIOC
#define | ENB1_Pin 8
#define | ENB1_Port GPIOC
#define | ENB2_Pin 9
#define | ENB2_Port GPIOC
#define | nFAULT_Pin GPIO_Pin_15
#define | nFAULT_Port GPIOD
#define | nSLEEP_Pin GPIO_Pin_14
#define | nSLEEP_Port GPIOD
#define | PWM_FREQUENCY 30000
#define | PWM_RESOL_SHIFT_DWN 6
#define | CURRENT_SCALE_RESOL ((uint32_t)(16-PWM_RESOL_SHIFT_DWN))
#define | PWM_TIM_PERIODE ((int16_t)(0xFFFF>>PWM_RESOL_SHIFT_DWN))
#define | PWM_TIM_PRESCALER ((int16_t)(SystemCoreClock/APB2_PRESCALER*TIM_MULTIPLIER/PWM_FREQUENCY/PWM_TIM_PERIODE-1))

## 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...

## Macro Definition Documentation

## ◆ CURRENT_SCALE_RESOL

#define CURRENT_SCALE_RESOL ((uint32_t)(16-PWM_RESOL_SHIFT_DWN))

## ◆ ENB1_Pin

#define ENB1_Pin 8

## ◆ ENB1_Port

#define ENB1_Port GPIOC

## ◆ ENB2_Pin

#define ENB2_Pin 9

## ◆ ENB2_Port

#define ENB2_Port GPIOC

## ◆ nFAULT_Pin

#define nFAULT_Pin GPIO_Pin_15

## ◆ nFAULT_Port

#define nFAULT_Port GPIOD

## ◆ nSLEEP_Pin

#define nSLEEP_Pin GPIO_Pin_14

## ◆ nSLEEP_Port

#define nSLEEP_Port GPIOD

## ◆ PWM1_Pin

#define PWM1_Pin 6

## ◆ PWM1_Port

#define PWM1_Port GPIOC

## ◆ PWM2_Pin

#define PWM2_Pin 7

## ◆ PWM2_Port

#define PWM2_Port GPIOC

## ◆ PWM_FREQUENCY

#define PWM_FREQUENCY 30000

## ◆ PWM_RESOL_SHIFT_DWN

#define PWM_RESOL_SHIFT_DWN 6

## ◆ PWM_TIM_PERIODE

#define PWM_TIM_PERIODE ((int16_t)(0xFFFF>>PWM_RESOL_SHIFT_DWN))

## ◆ PWM_TIM_PRESCALER

#define PWM_TIM_PRESCALER ((int16_t)(SystemCoreClock/APB2_PRESCALER*TIM_MULTIPLIER/PWM_FREQUENCY/PWM_TIM_PERIODE-1))