Page 282 - MDP2022-2
P. 282

__HAL_TIM_SET_CAPTUREPOLARITY(htim,               TIM_CHANNEL_1,
                  TIM_INPUTCHANNELPOLARITY_RISING);
                                    __HAL_TIM_DISABLE_IT(&htim3,  TIM_IT_CC1);
                              }
                        }
                  }


                  void  HCSR04_Read  (void)
                  {
                        HAL_GPIO_WritePin(TRIG_PORT,  TRIG_PIN,  GPIO_PIN_SET);
                        delay(10);    //  wait  for  10  us
                        HAL_GPIO_WritePin(TRIG_PORT,  TRIG_PIN,  GPIO_PIN_RESET);


                        __HAL_TIM_ENABLE_IT(&htim3,  TIM_IT_CC1);
                  }
                  /*  USER  CODE  END  0  */


                  /**
                      *  @brief    The  application  entry  point.
                      *  @retval  int
                      */
                  int  main(void)
                  {
                      /*  USER  CODE  BEGIN  1  */


                      /*  USER  CODE  END  1  */


                      /*                                                                          MCU
                  Configuration--------------------------------------------------------*/


                      /*  Reset  of  all  peripherals,  Initializes  the  Flash  interface  and  the  Systick.  */
                      HAL_Init();


                      /*  USER  CODE  BEGIN  Init  */


                      /*  USER  CODE  END  Init  */


                      /*  Configure  the  system  clock  */
                      SystemClock_Config();


                      /*  USER  CODE  BEGIN  SysInit  */
   277   278   279   280   281   282   283   284   285   286   287