Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F78442744
h_bridge.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Aug 20, 22:08
Size
1 KB
Mime Type
text/x-c
Expires
Thu, Aug 22, 22:08 (2 d)
Engine
blob
Format
Raw Data
Handle
20036761
Attached To
R2671 HHRI-software
h_bridge.h
View Options
#ifndef __H_BRIDGE_H
#define __H_BRIDGE_H
#include "../main.h"
#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
// Motor PWM freq. [Hz]
#define PWM_RESOL_SHIFT_DWN 6
// PWM_SCALE = 0xFFFF/2^PWM_RESOL_SHIFT_DWN
#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))
/** @defgroup H_Bridge Driver / H-bridge
* @brief 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.
*
* @addtogroup H_Bridge
* @{
*/
void
hb_Init
(
void
);
void
hb_Enable
(
void
);
void
hb_Disable
(
void
);
void
hb_SetPWM
(
float32_t
ratio
);
/**
* @}
*/
#endif
Event Timeline
Log In to Comment