/Projects/STM32H745I-DISCO/Examples/ADC/ADC_Regular_injected_groups/CM7/Inc/main.h

https://github.com/STMicroelectronics/STM32CubeH7 · C Header · 122 lines · 40 code · 30 blank · 52 comment · 0 complexity · c0dfa840b70956d16c2ddecd22624b25 MD5 · raw file

  1. /**
  2. ******************************************************************************
  3. * @file ADC/ADC_Regular_injected_groups/CM7/Inc/main.h
  4. * @author MCD Application Team
  5. * @brief Header for main.c module
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2019 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. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __MAIN_H
  21. #define __MAIN_H
  22. /* Includes ------------------------------------------------------------------*/
  23. #include "stm32h7xx_hal.h"
  24. #include "stm32h745i_discovery.h"
  25. /* Exported types ------------------------------------------------------------*/
  26. /* Exported constants --------------------------------------------------------*/
  27. /* Trigger for ADC: */
  28. /* - If this literal is defined: ADC is operating in not continuous mode */
  29. /* and conversions are trigger by external trigger: timer. */
  30. /* - If this literal is not defined: ADC is operating in continuous mode */
  31. /* and first conversion is triggered by software trigger. */
  32. #define ADC_TRIGGER_FROM_TIMER
  33. /* Waveform voltage generation for test: */
  34. /* - If this literal is defined: For this example purpose, generates a */
  35. /* waveform voltage on a spare DAC channel, so user has just to connect */
  36. /* a wire between DAC channel output and ADC input to run this example. */
  37. /* (this avoid to user the need of an external signal generator). */
  38. /* - If this literal is not defined: User has to connect an external signal */
  39. /* generator on the selected ADC input to run this example. */
  40. #define WAVEFORM_VOLTAGE_GENERATION_FOR_TEST
  41. /* User can use this section to tailor ADCx instance under use and associated
  42. resources */
  43. /* ## Definition of ADC related resources ################################### */
  44. /* Definition of ADCx clock resources */
  45. #define ADCy ADC3
  46. #define ADCy_CLK_ENABLE() __HAL_RCC_ADC3_CLK_ENABLE()
  47. #define ADCy_FORCE_RESET() __HAL_RCC_ADC3_FORCE_RESET()
  48. #define ADCy_RELEASE_RESET() __HAL_RCC_ADC3_RELEASE_RESET()
  49. /* Definition of ADCx channels */
  50. #define ADCy_CHANNELa ADC_CHANNEL_7
  51. /* Definition of ADCx channels pins */
  52. #define ADCy_CHANNELa_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
  53. #define ADCy_CHANNELa_GPIO_PORT GPIOF
  54. #define ADCy_CHANNELa_PIN GPIO_PIN_8
  55. /* Definition of ADCx DMA resources */
  56. #define ADCy_DMA_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
  57. #define ADCy_DMA DMA1_Stream1
  58. #define ADCy_DMA_IRQn DMA1_Stream1_IRQn
  59. #define ADCy_DMA_IRQHandler DMA1_Stream1_IRQHandler
  60. /* Definition of ADCx NVIC resources */
  61. #define ADCy_IRQn ADC3_IRQn
  62. #define ADCy_IRQHandler ADC3_IRQHandler
  63. #if defined(ADC_TRIGGER_FROM_TIMER)
  64. /* ## Definition of TIM related resources ################################### */
  65. /* Definition of TIMx clock resources */
  66. #define TIMx TIM3 /* Caution: Timer instance must be on APB1 (clocked by PCLK1) due to frequency computation in function "TIM_Config()" */
  67. #define TIMx_CLK_ENABLE() __HAL_RCC_TIM3_CLK_ENABLE()
  68. #define TIMx_FORCE_RESET() __HAL_RCC_TIM3_FORCE_RESET()
  69. #define TIMx_RELEASE_RESET() __HAL_RCC_TIM3_RELEASE_RESET()
  70. #define ADC_EXTERNALTRIGCONV_Tx_TRGO ADC_EXTERNALTRIG_T3_TRGO
  71. #endif /* ADC_TRIGGER_FROM_TIMER */
  72. #if defined(WAVEFORM_VOLTAGE_GENERATION_FOR_TEST)
  73. /* ## Definition of DAC related resources ################################### */
  74. /* Definition of DACx clock resources */
  75. #define DACx DAC1
  76. #define DACx_CLK_ENABLE() __HAL_RCC_DAC12_CLK_ENABLE()
  77. #define DACx_CHANNEL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
  78. #define DACx_FORCE_RESET() __HAL_RCC_DAC12_FORCE_RESET()
  79. #define DACx_RELEASE_RESET() __HAL_RCC_DAC12_RELEASE_RESET()
  80. /* Definition of DACx channels */
  81. #define DACx_CHANNEL_TO_ADCx_CHANNELa DAC_CHANNEL_1
  82. /* Definition of DACx channels pins */
  83. #define DACx_CHANNEL_TO_ADCx_CHANNELa_PIN GPIO_PIN_4
  84. #define DACx_CHANNEL_TO_ADCx_CHANNELa_GPIO_PORT GPIOA
  85. /* Definition of DACx NVIC resources */
  86. #define DACx_IRQn TIM6_DAC_IRQn
  87. #define DACx_IRQHandler TIM6_DAC_IRQHandler
  88. #endif /* WAVEFORM_VOLTAGE_GENERATION_FOR_TEST */
  89. /* Exported macro ------------------------------------------------------------*/
  90. /* Exported functions ------------------------------------------------------- */
  91. #endif /* __MAIN_H */
  92. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/