Compare commits

...

2 Commits

Author SHA1 Message Date
EN
e82a79f1c3 修正delay_us被优化的错误 2024-07-19 09:14:32 +08:00
EN
cf240a9d5c 舵机初始化时默认旋转90度 2024-07-19 09:14:01 +08:00
2 changed files with 2 additions and 1 deletions

View File

@ -64,7 +64,7 @@ GETCHAR_PROTOTYPE
void delay_us(uint16_t us)
{
uint32_t delay = (HAL_RCC_GetHCLKFreq() / 4000000 * us);
volatile uint32_t delay = (HAL_RCC_GetHCLKFreq() / 4000000 * us);
while (delay--);
}

View File

@ -3,6 +3,7 @@
void SERVO_Init()
{
__HAL_TIM_SetCompare(&htim1, TIM_CHANNEL_4, 150);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_4);
}