kotyamba (kotyamba) wrote,
kotyamba
kotyamba

STM32, Hal & delay_us

TIM2 в режиме OnePulse "тикает" раз в мкс

void delay_us(uint32_t value)
{
// #include "stm32f1xx_ll_tim.h" !!!  
    LL_TIM_SetAutoReload(htim2.Instance, value - 1);
    LL_TIM_SetCounter(htim2.Instance,0);
    HAL_TIM_Base_Start(&htim2);
    while(LL_TIM_IsActiveFlag_UPDATE(htim2.Instance) == 0);
    LL_TIM_ClearFlag_UPDATE(htim2.Instance);
}
Tags: #include
Subscribe
  • Post a new comment

    Error

    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments