Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
feat: update ccr anytime
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorBel committed Mar 31, 2021
1 parent 474407a commit 043aa91
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/bldc-sensored/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ void tim1_init()
TIM_OC2Init(TIM1, &TIM_OCInitStructure);
TIM_OC3Init(TIM1, &TIM_OCInitStructure);

// Update CCRx only on update event
TIM_OC1PreloadConfig(TIM1, TIM_OCPreload_Enable);
TIM_OC2PreloadConfig(TIM1, TIM_OCPreload_Enable);
TIM_OC3PreloadConfig(TIM1, TIM_OCPreload_Enable);

TIM_BDTRInitTypeDef TIM_BDTRInitStructure;
TIM_BDTRInitStructure.TIM_OSSRState = TIM_OSSRState_Enable;
TIM_BDTRInitStructure.TIM_OSSIState = TIM_OSSIState_Enable;
Expand All @@ -178,12 +173,12 @@ void tim1_init()
TIM_CtrlPWMOutputs(TIM1, ENABLE);
}

uint8_t BLDC_HallSensorsGetPosition(void)
uint8_t HallSensorsGetPosition(void)
{
return (uint8_t)((GPIO_ReadInputData(GPIOB) & (GPIO_Pin_4 | GPIO_Pin_6 | GPIO_Pin_7)) >> 7);
}

void BLDC_HallSensorsInit(void)
void HallSensorsInit(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
EXTI_InitTypeDef EXTI_InitStruct;
Expand Down Expand Up @@ -225,10 +220,14 @@ void EXTI9_5_IRQHandler(void)
EXTI_ClearITPendingBit(EXTI_Line7);

// Commutation
BLDC_MotorCommutation(BLDC_HallSensorsGetPosition());
comutate(HallSensorsGetPosition());
}
}

void commutate()
{
}

int main(void)
{
// clock setup
Expand Down

0 comments on commit 043aa91

Please sign in to comment.