Subversion Repositories FuelGauge

Rev

Rev 2 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /**
  2.   ******************************************************************************
  3.   * @file    stm32f0xx_hal_tim_ex.h
  4.   * @author  MCD Application Team
  5.   * @brief   Header file of TIM HAL Extended module.
  6.   ******************************************************************************
  7.   * @attention
  8.   *
  9.   * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  10.   * All rights reserved.</center></h2>
  11.   *
  12.   * This software component is licensed by ST under BSD 3-Clause license,
  13.   * the "License"; You may not use this file except in compliance with the
  14.   * License. You may obtain a copy of the License at:
  15.   *                        opensource.org/licenses/BSD-3-Clause
  16.   *
  17.   ******************************************************************************
  18.   */
  19.  
  20. /* Define to prevent recursive inclusion -------------------------------------*/
  21. #ifndef STM32F0xx_HAL_TIM_EX_H
  22. #define STM32F0xx_HAL_TIM_EX_H
  23.  
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27.  
  28. /* Includes ------------------------------------------------------------------*/
  29. #include "stm32f0xx_hal_def.h"
  30.  
  31. /** @addtogroup STM32F0xx_HAL_Driver
  32.   * @{
  33.   */
  34.  
  35. /** @addtogroup TIMEx
  36.   * @{
  37.   */
  38.  
  39. /* Exported types ------------------------------------------------------------*/
  40. /** @defgroup TIMEx_Exported_Types TIM Extended Exported Types
  41.   * @{
  42.   */
  43.  
  44. /**
  45.   * @brief  TIM Hall sensor Configuration Structure definition
  46.   */
  47.  
  48. typedef struct
  49. {
  50.   uint32_t IC1Polarity;         /*!< Specifies the active edge of the input signal.
  51.                                      This parameter can be a value of @ref TIM_Input_Capture_Polarity */
  52.  
  53.   uint32_t IC1Prescaler;        /*!< Specifies the Input Capture Prescaler.
  54.                                      This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
  55.  
  56.   uint32_t IC1Filter;           /*!< Specifies the input capture filter.
  57.                                      This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */
  58.  
  59.   uint32_t Commutation_Delay;   /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
  60.                                      This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */
  61. } TIM_HallSensor_InitTypeDef;
  62. /**
  63.   * @}
  64.   */
  65. /* End of exported types -----------------------------------------------------*/
  66.  
  67. /* Exported constants --------------------------------------------------------*/
  68. /** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants
  69.   * @{
  70.   */
  71.  
  72. /** @defgroup TIMEx_Remap TIM Extended Remapping
  73.   * @{
  74.   */
  75. #define TIM_TIM14_GPIO                         (0x00000000U) /*!< TIM14 TI1 is connected to GPIO */
  76. #define TIM_TIM14_RTC                          (0x00000001U) /*!< TIM14 TI1 is connected to RTC_clock */
  77. #define TIM_TIM14_HSE                          (0x00000002U) /*!< TIM14 TI1 is connected to HSE/32U */
  78. #define TIM_TIM14_MCO                          (0x00000003U) /*!< TIM14 TI1 is connected to MCO */
  79. /**
  80.   * @}
  81.   */
  82.  
  83. /**
  84.   * @}
  85.   */
  86. /* End of exported constants -------------------------------------------------*/
  87.  
  88. /* Exported macro ------------------------------------------------------------*/
  89. /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros
  90.   * @{
  91.   */
  92.  
  93. /**
  94.   * @}
  95.   */
  96. /* End of exported macro -----------------------------------------------------*/
  97.  
  98. /* Private macro -------------------------------------------------------------*/
  99. /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros
  100.   * @{
  101.   */
  102. #define IS_TIM_REMAP(__INSTANCE__, __REMAP__)                                        \
  103.   (((__INSTANCE__) == TIM14)  && (((__REMAP__) & 0xFFFFFFFCU) == 0x00000000U))
  104.  
  105. /**
  106.   * @}
  107.   */
  108. /* End of private macro ------------------------------------------------------*/
  109.  
  110. /* Exported functions --------------------------------------------------------*/
  111. /** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions
  112.   * @{
  113.   */
  114.  
  115. /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions
  116.   *  @brief    Timer Hall Sensor functions
  117.   * @{
  118.   */
  119. /*  Timer Hall Sensor functions  **********************************************/
  120. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef *sConfig);
  121. HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim);
  122.  
  123. void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim);
  124. void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim);
  125.  
  126. /* Blocking mode: Polling */
  127. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim);
  128. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim);
  129. /* Non-Blocking mode: Interrupt */
  130. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim);
  131. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim);
  132. /* Non-Blocking mode: DMA */
  133. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length);
  134. HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim);
  135. /**
  136.   * @}
  137.   */
  138.  
  139. /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions
  140.   *  @brief   Timer Complementary Output Compare functions
  141.   * @{
  142.   */
  143. /*  Timer Complementary Output Compare functions  *****************************/
  144. /* Blocking mode: Polling */
  145. HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
  146. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
  147.  
  148. /* Non-Blocking mode: Interrupt */
  149. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  150. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  151.  
  152. /* Non-Blocking mode: DMA */
  153. HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
  154. HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
  155. /**
  156.   * @}
  157.   */
  158.  
  159. /** @addtogroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions
  160.   *  @brief    Timer Complementary PWM functions
  161.   * @{
  162.   */
  163. /*  Timer Complementary PWM functions  ****************************************/
  164. /* Blocking mode: Polling */
  165. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
  166. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
  167.  
  168. /* Non-Blocking mode: Interrupt */
  169. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  170. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
  171. /* Non-Blocking mode: DMA */
  172. HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
  173. HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
  174. /**
  175.   * @}
  176.   */
  177.  
  178. /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions
  179.   *  @brief    Timer Complementary One Pulse functions
  180.   * @{
  181.   */
  182. /*  Timer Complementary One Pulse functions  **********************************/
  183. /* Blocking mode: Polling */
  184. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  185. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  186.  
  187. /* Non-Blocking mode: Interrupt */
  188. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  189. HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
  190. /**
  191.   * @}
  192.   */
  193.  
  194. /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions
  195.   *  @brief    Peripheral Control functions
  196.   * @{
  197.   */
  198. /* Extended Control functions  ************************************************/
  199. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t  InputTrigger,
  200.                                               uint32_t  CommutationSource);
  201. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t  InputTrigger,
  202.                                                  uint32_t  CommutationSource);
  203. HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t  InputTrigger,
  204.                                                   uint32_t  CommutationSource);
  205. HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim,
  206.                                                         TIM_MasterConfigTypeDef *sMasterConfig);
  207. HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim,
  208.                                                 TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig);
  209. HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap);
  210. /**
  211.   * @}
  212.   */
  213.  
  214. /** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions
  215.   * @brief    Extended Callbacks functions
  216.   * @{
  217.   */
  218. /* Extended Callback **********************************************************/
  219. void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim);
  220. void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim);
  221. void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim);
  222. /**
  223.   * @}
  224.   */
  225.  
  226. /** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions
  227.   * @brief    Extended Peripheral State functions
  228.   * @{
  229.   */
  230. /* Extended Peripheral State functions  ***************************************/
  231. HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim);
  232. HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(TIM_HandleTypeDef *htim,  uint32_t ChannelN);
  233. /**
  234.   * @}
  235.   */
  236.  
  237. /**
  238.   * @}
  239.   */
  240. /* End of exported functions -------------------------------------------------*/
  241.  
  242. /* Private functions----------------------------------------------------------*/
  243. /** @addtogroup TIMEx_Private_Functions TIMEx Private Functions
  244.   * @{
  245.   */
  246. void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma);
  247. void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma);
  248. /**
  249.   * @}
  250.   */
  251. /* End of private functions --------------------------------------------------*/
  252.  
  253. /**
  254.   * @}
  255.   */
  256.  
  257. /**
  258.   * @}
  259.   */
  260.  
  261. #ifdef __cplusplus
  262. }
  263. #endif
  264.  
  265.  
  266. #endif /* STM32F0xx_HAL_TIM_EX_H */
  267.  
  268. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
  269.