You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

x_nucleo_ihm05a1_stm32f4xx.h 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /**
  2. ******************************************************************************
  3. * @file x_nucleo_ihm05a1_stm32f4xx.h
  4. * @author IPC Rennes
  5. * @version V1.5.0
  6. * @date June 1st, 2018
  7. * @brief Header for BSP driver for x-nucleo-ihm05a1 Nucleo extension board
  8. * (based on L6208)
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT(c) 2018 STMicroelectronics</center></h2>
  13. *
  14. * Redistribution and use in source and binary forms, with or without modification,
  15. * are permitted provided that the following conditions are met:
  16. * 1. Redistributions of source code must retain the above copyright notice,
  17. * this list of conditions and the following disclaimer.
  18. * 2. Redistributions in binary form must reproduce the above copyright notice,
  19. * this list of conditions and the following disclaimer in the documentation
  20. * and/or other materials provided with the distribution.
  21. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  22. * may be used to endorse or promote products derived from this software
  23. * without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  26. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  28. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  29. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  30. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  31. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  32. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  33. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. ******************************************************************************
  37. */
  38. /* Define to prevent recursive inclusion -------------------------------------*/
  39. #ifndef X_NUCLEO_IHM05A1_STM32F4XX_H
  40. #define X_NUCLEO_IHM05A1_STM32F4XX_H
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. /* Includes ------------------------------------------------------------------*/
  45. #include "stm32f4xx_nucleo.h"
  46. /** @addtogroup BSP
  47. * @{
  48. */
  49. /** @addtogroup X_NUCLEO_IHM05A1_STM32F4XX
  50. * @{
  51. */
  52. /* Exported Constants --------------------------------------------------------*/
  53. /** @defgroup IHM05A1_Exported_Constants IHM05A1 Exported Constants
  54. * @{
  55. */
  56. /******************************************************************************/
  57. /* USE_STM32F4XX_NUCLEO */
  58. /******************************************************************************/
  59. /** @defgroup Constants_For_STM32F4XX_NUCLEO Constants For STM32F4XX NUCLEO
  60. * @{
  61. */
  62. /// GPIO Pin used for the VREFA
  63. #define BSP_MOTOR_CONTROL_BOARD_VREFA_PIN (GPIO_PIN_3)
  64. /// GPIO port used for the VREFA
  65. #define BSP_MOTOR_CONTROL_BOARD_VREFA_PORT (GPIOB)
  66. /// Interrupt line used for L6208 OCD and OVT
  67. #define FLAG_EXTI_LINE_IRQn (EXTI15_10_IRQn)
  68. /// Timer used to generate the VREFA PWM
  69. #define BSP_MOTOR_CONTROL_BOARD_TIMER_VREFA_PWM (TIM2)
  70. /// Timer used to generate the VREFB PWM
  71. #define BSP_MOTOR_CONTROL_BOARD_TIMER_VREFB_PWM (TIM3)
  72. /// Channel Timer used for the VREFA PWM
  73. #define BSP_MOTOR_CONTROL_BOARD_CHAN_TIMER_VREFA_PWM (TIM_CHANNEL_2)
  74. /// Channel Timer used for the VREFB PWM
  75. #define BSP_MOTOR_CONTROL_BOARD_CHAN_TIMER_VREFB_PWM (TIM_CHANNEL_2)
  76. /// HAL Active Channel Timer used for the VREFA PWM
  77. #define BSP_MOTOR_CONTROL_BOARD_HAL_ACT_CHAN_TIMER_VREFA_PWM (HAL_TIM_ACTIVE_CHANNEL_2)
  78. /// HAL Active Channel Timer used for the VREFB PWM
  79. #define BSP_MOTOR_CONTROL_BOARD_HAL_ACT_CHAN_TIMER_VREFB_PWM (HAL_TIM_ACTIVE_CHANNEL_2)
  80. /// Timer Clock Enable for the VREFA PWM
  81. #define __BSP_MOTOR_CONTROL_BOARD_TIMER_VREFA_PWM_CLCK_ENABLE() __TIM2_CLK_ENABLE()
  82. /// Timer Clock Disable for the VREFA PWM
  83. #define __BSP_MOTOR_CONTROL_BOARD_TIMER_VREFA_PWM_CLCK_DISABLE() __TIM2_CLK_DISABLE()
  84. /// Timer Clock Enable for the VREFB PWMs
  85. #define __BSP_MOTOR_CONTROL_BOARD_TIMER_VREFB_PWM_CLCK_ENABLE() __TIM3_CLK_ENABLE()
  86. /// Timer Clock Disable for the VREFB PWMs
  87. #define __BSP_MOTOR_CONTROL_BOARD_TIMER_VREFB_PWM_CLCK_DISABLE() __TIM3_CLK_DISABLE()
  88. /// VREFA PWM GPIO alternate function
  89. #define BSP_MOTOR_CONTROL_BOARD_AFx_TIMx_VREFA_PWM (GPIO_AF1_TIM2)
  90. /// VREFB PWM GPIO alternate function
  91. #define BSP_MOTOR_CONTROL_BOARD_AFx_TIMx_VREFB_PWM (GPIO_AF2_TIM3)
  92. /// Timer used to generate the tick
  93. #define BSP_MOTOR_CONTROL_BOARD_TIMER_TICK (TIM4)
  94. /// tick timer global interrupt
  95. #define BSP_MOTOR_CONTROL_BOARD_TIMER_TICK_IRQn (TIM4_IRQn)
  96. /// Channel Timer used for the tick
  97. #define BSP_MOTOR_CONTROL_BOARD_CHAN_TIMER_TICK (TIM_CHANNEL_1)
  98. /// Timer Clock Enable for the tick
  99. #define __BSP_MOTOR_CONTROL_BOARD_TIMER_TICK_CLCK_ENABLE() __TIM4_CLK_ENABLE()
  100. /// Timer Clock Disable for the tick
  101. #define __BSP_MOTOR_CONTROL_BOARD_TIMER_TICK_CLCK_DISABLE() __TIM4_CLK_DISABLE()
  102. /// HAL Active Channel Timer used for the tick
  103. #define BSP_MOTOR_CONTROL_BOARD_HAL_ACT_CHAN_TIMER_TICK (HAL_TIM_ACTIVE_CHANNEL_1)
  104. /// Flag interrupt priority
  105. #define BSP_MOTOR_CONTROL_BOARD_EN_AND_FLAG_PRIORITY (1)
  106. /// tick timer priority (lower than flag interrupt priority)
  107. #define BSP_MOTOR_CONTROL_BOARD_TIMER_TICK_PRIORITY (BSP_MOTOR_CONTROL_BOARD_EN_AND_FLAG_PRIORITY + 1)
  108. /**
  109. * @}
  110. */
  111. /******************************************************************************/
  112. /* Independent plateform definitions */
  113. /******************************************************************************/
  114. /** @defgroup Constants_For_All_Nucleo_Platforms Constants For All Nucleo Platforms
  115. * @{
  116. */
  117. /// GPIO Pin used for the VREFB
  118. #define BSP_MOTOR_CONTROL_BOARD_VREFB_PIN (GPIO_PIN_7)
  119. /// GPIO Port used for the VREFB
  120. #define BSP_MOTOR_CONTROL_BOARD_VREFB_PORT (GPIOC)
  121. /// GPIO Pin used for the L6208 clock pin (step clock input)
  122. #define BSP_MOTOR_CONTROL_BOARD_CLOCK_PIN (GPIO_PIN_10)
  123. /// GPIO port used for the L6208 clock pin (step clock input)
  124. #define BSP_MOTOR_CONTROL_BOARD_CLOCK_PORT (GPIOB)
  125. /// GPIO Pin used for the L6208 CW/CCW pin (direction)
  126. #define BSP_MOTOR_CONTROL_BOARD_DIR_PIN (GPIO_PIN_8)
  127. /// GPIO port used for the L6208 CW/CCW pin (direction)
  128. #define BSP_MOTOR_CONTROL_BOARD_DIR_PORT (GPIOA)
  129. /// GPIO Pin used for the L6208 HALF/FULL pin (step mode selector)
  130. #define BSP_MOTOR_CONTROL_BOARD_HALF_FULL_PIN (GPIO_PIN_5)
  131. /// GPIO port used for the L6208 HALF/FULL pin (step mode selector)
  132. #define BSP_MOTOR_CONTROL_BOARD_HALF_FULL_PORT (GPIOB)
  133. /// GPIO Pin used for the L6208 control pin (decay mode selector)
  134. #define BSP_MOTOR_CONTROL_BOARD_CONTROL_PIN (GPIO_PIN_4)
  135. /// GPIO port used for the L6208 control pin (decay mode selector)
  136. #define BSP_MOTOR_CONTROL_BOARD_CONTROL_PORT (GPIOB)
  137. /// GPIO Pin used for the L6208 reset pin
  138. #define BSP_MOTOR_CONTROL_BOARD_RESET_PIN (GPIO_PIN_9)
  139. /// GPIO port used for the L6208 reset pin
  140. #define BSP_MOTOR_CONTROL_BOARD_RESET_PORT (GPIOA)
  141. /// GPIO Pin used for the L6208 EN pin (chip enable) and OCD and OVT alarms
  142. #define BSP_MOTOR_CONTROL_BOARD_EN_AND_FLAG_PIN (GPIO_PIN_10)
  143. /// GPIO port used for the L6208 EN pin (chip enable) OCD and OVT alarms
  144. #define BSP_MOTOR_CONTROL_BOARD_EN_AND_FLAG_PORT (GPIOA)
  145. /**
  146. * @}
  147. */
  148. /**
  149. * @}
  150. */
  151. /**
  152. * @}
  153. */
  154. /**
  155. * @}
  156. */
  157. #ifdef __cplusplus
  158. }
  159. #endif
  160. #endif /* X_NUCLEO_IHM05A1_STM32F4XX_H */
  161. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/