mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-22 16:14:37 +08:00
Change TIM_1_8_PERIOD_CLOCKS and add RCR
This commit is contained in:
@@ -67,12 +67,13 @@
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
#define TIM_1_8_CLOCK_HZ 168000000
|
||||
#define TIM_1_8_PERIOD_CLOCKS 10192
|
||||
#define TIM_1_8_PERIOD_CLOCKS 3500
|
||||
#define TIM_1_8_DEADTIME_CLOCKS 20
|
||||
#define TIM_APB1_CLOCK_HZ 84000000
|
||||
#define TIM_APB1_PERIOD_CLOCKS 4096
|
||||
#define TIM_APB1_DEADTIME_CLOCKS 40
|
||||
#define configAPPLICATION_ALLOCATED_HEAP 1
|
||||
#define TIM_1_8_RCR 2
|
||||
|
||||
#define M0_nCS_Pin GPIO_PIN_13
|
||||
#define M0_nCS_GPIO_Port GPIOC
|
||||
|
||||
@@ -94,7 +94,7 @@ void MX_TIM1_Init(void)
|
||||
htim1.Init.CounterMode = TIM_COUNTERMODE_CENTERALIGNED3;
|
||||
htim1.Init.Period = TIM_1_8_PERIOD_CLOCKS;
|
||||
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim1.Init.RepetitionCounter = 0;
|
||||
htim1.Init.RepetitionCounter = TIM_1_8_RCR;
|
||||
if (HAL_TIM_Base_Init(&htim1) != HAL_OK)
|
||||
{
|
||||
_Error_Handler(__FILE__, __LINE__);
|
||||
@@ -324,7 +324,7 @@ void MX_TIM8_Init(void)
|
||||
htim8.Init.CounterMode = TIM_COUNTERMODE_CENTERALIGNED3;
|
||||
htim8.Init.Period = TIM_1_8_PERIOD_CLOCKS;
|
||||
htim8.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim8.Init.RepetitionCounter = 0;
|
||||
htim8.Init.RepetitionCounter = TIM_1_8_RCR;
|
||||
if (HAL_TIM_PWM_Init(&htim8) != HAL_OK)
|
||||
{
|
||||
_Error_Handler(__FILE__, __LINE__);
|
||||
|
||||
Reference in New Issue
Block a user