Forzaferrarileo

tim_sync stm32f4xx_hal_msp.c

Apr 21st, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.12 KB | None | 0 0
  1. /**tttttttttt
  2.   ******************************************************************************
  3.   * File Name          : stm32f4xx_hal_msp.c
  4.   * Description        : This file provides code for the MSP Initialization
  5.   *                      and de-Initialization codes.
  6.   ******************************************************************************
  7.   *
  8.   * COPYRIGHT(c) 2016 STMicroelectronics
  9.   *
  10.   * Redistribution and use in source and binary forms, with or without modification,
  11.   * are permitted provided that the following conditions are met:
  12.   *   1. Redistributions of source code must retain the above copyright notice,
  13.   *      this list of conditions and the following disclaimer.
  14.   *   2. Redistributions in binary form must reproduce the above copyright notice,
  15.   *      this list of conditions and the following disclaimer in the documentation
  16.   *      and/or other materials provided with the distribution.
  17.   *   3. Neither the name of STMicroelectronics nor the names of its contributors
  18.   *      may be used to endorse or promote products derived from this software
  19.   *      without specific prior written permission.
  20.   *
  21.   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  22.   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  24.   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  25.   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  27.   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  28.   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  29.   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30.   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31.   *
  32.   ******************************************************************************
  33.   */
  34. /* Includes ------------------------------------------------------------------*/
  35. #include "stm32f4xx_hal.h"
  36.  
  37. /* USER CODE BEGIN 0 */
  38.  
  39. /* USER CODE END 0 */
  40.  
  41. /**
  42.   * Initializes the Global MSP.
  43.   */
  44. void HAL_MspInit(void)
  45. {
  46.   /* USER CODE BEGIN MspInit 0 */
  47.  
  48.   /* USER CODE END MspInit 0 */
  49.  
  50.   HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_0);
  51.  
  52.   /* System interrupt init*/
  53.   /* SysTick_IRQn interrupt configuration */
  54.   HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
  55.  
  56.   /* USER CODE BEGIN MspInit 1 */
  57.  
  58.   /* USER CODE END MspInit 1 */
  59. }
  60.  
  61. void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
  62. {
  63.  
  64.   if(htim_base->Instance==TIM3)
  65.   {
  66.   /* USER CODE BEGIN TIM3_MspInit 0 */
  67.  
  68.   /* USER CODE END TIM3_MspInit 0 */
  69.     /* Peripheral clock enable */
  70.     __TIM3_CLK_ENABLE();
  71.   /* USER CODE BEGIN TIM3_MspInit 1 */
  72.  
  73.   /* USER CODE END TIM3_MspInit 1 */
  74.   }
  75.   else if(htim_base->Instance==TIM4)
  76.   {
  77.   /* USER CODE BEGIN TIM4_MspInit 0 */
  78.  
  79.   /* USER CODE END TIM4_MspInit 0 */
  80.     /* Peripheral clock enable */
  81.     __TIM4_CLK_ENABLE();
  82.   /* Peripheral interrupt init*/
  83.     HAL_NVIC_SetPriority(TIM4_IRQn, 0, 0);
  84.     HAL_NVIC_EnableIRQ(TIM4_IRQn);
  85.   /* USER CODE BEGIN TIM4_MspInit 1 */
  86.  
  87.   /* USER CODE END TIM4_MspInit 1 */
  88.   }
  89.  
  90. }
  91.  
  92. void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
  93. {
  94.  
  95.   if(htim_base->Instance==TIM3)
  96.   {
  97.   /* USER CODE BEGIN TIM3_MspDeInit 0 */
  98.  
  99.   /* USER CODE END TIM3_MspDeInit 0 */
  100.     /* Peripheral clock disable */
  101.     __TIM3_CLK_DISABLE();
  102.   /* USER CODE BEGIN TIM3_MspDeInit 1 */
  103.  
  104.   /* USER CODE END TIM3_MspDeInit 1 */
  105.   }
  106.   else if(htim_base->Instance==TIM4)
  107.   {
  108.   /* USER CODE BEGIN TIM4_MspDeInit 0 */
  109.  
  110.   /* USER CODE END TIM4_MspDeInit 0 */
  111.     /* Peripheral clock disable */
  112.     __TIM4_CLK_DISABLE();
  113.  
  114.     /* Peripheral interrupt DeInit*/
  115.     HAL_NVIC_DisableIRQ(TIM4_IRQn);
  116.  
  117.   /* USER CODE BEGIN TIM4_MspDeInit 1 */
  118.  
  119.   /* USER CODE END TIM4_MspDeInit 1 */
  120.   }
  121.  
  122. }
  123.  
  124. /* USER CODE BEGIN 1 */
  125.  
  126. /* USER CODE END 1 */
  127.  
  128. /**
  129.   * @}
  130.   */
  131.  
  132. /**
  133.   * @}
  134.   */
  135.  
  136. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Add Comment
Please, Sign In to add comment