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.
 
 
 

231 lines
10 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_hal_dcmi_ex.h
  4. * @author MCD Application Team
  5. * @version V1.7.1
  6. * @date 14-April-2017
  7. * @brief Header file of DCMI Extension HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32F4xx_HAL_DCMI_EX_H
  39. #define __STM32F4xx_HAL_DCMI_EX_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. #if defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) ||\
  44. defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) ||\
  45. defined(STM32F479xx)
  46. /* Includes ------------------------------------------------------------------*/
  47. #include "stm32f4xx_hal_def.h"
  48. /** @addtogroup STM32F4xx_HAL_Driver
  49. * @{
  50. */
  51. /** @addtogroup DCMIEx
  52. * @brief DCMI HAL module driver
  53. * @{
  54. */
  55. /* Exported types ------------------------------------------------------------*/
  56. /** @defgroup DCMIEx_Exported_Types DCMI Extended Exported Types
  57. * @{
  58. */
  59. /**
  60. * @brief DCMIEx Embedded Synchronisation CODE Init structure definition
  61. */
  62. typedef struct
  63. {
  64. uint8_t FrameStartCode; /*!< Specifies the code of the frame start delimiter. */
  65. uint8_t LineStartCode; /*!< Specifies the code of the line start delimiter. */
  66. uint8_t LineEndCode; /*!< Specifies the code of the line end delimiter. */
  67. uint8_t FrameEndCode; /*!< Specifies the code of the frame end delimiter. */
  68. }DCMI_CodesInitTypeDef;
  69. /**
  70. * @brief DCMI Init structure definition
  71. */
  72. typedef struct
  73. {
  74. uint32_t SynchroMode; /*!< Specifies the Synchronization Mode: Hardware or Embedded.
  75. This parameter can be a value of @ref DCMI_Synchronization_Mode */
  76. uint32_t PCKPolarity; /*!< Specifies the Pixel clock polarity: Falling or Rising.
  77. This parameter can be a value of @ref DCMI_PIXCK_Polarity */
  78. uint32_t VSPolarity; /*!< Specifies the Vertical synchronization polarity: High or Low.
  79. This parameter can be a value of @ref DCMI_VSYNC_Polarity */
  80. uint32_t HSPolarity; /*!< Specifies the Horizontal synchronization polarity: High or Low.
  81. This parameter can be a value of @ref DCMI_HSYNC_Polarity */
  82. uint32_t CaptureRate; /*!< Specifies the frequency of frame capture: All, 1/2 or 1/4.
  83. This parameter can be a value of @ref DCMI_Capture_Rate */
  84. uint32_t ExtendedDataMode; /*!< Specifies the data width: 8-bit, 10-bit, 12-bit or 14-bit.
  85. This parameter can be a value of @ref DCMI_Extended_Data_Mode */
  86. DCMI_CodesInitTypeDef SyncroCode; /*!< Specifies the code of the frame start delimiter. */
  87. uint32_t JPEGMode; /*!< Enable or Disable the JPEG mode
  88. This parameter can be a value of @ref DCMI_MODE_JPEG */
  89. #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  90. uint32_t ByteSelectMode; /*!< Specifies the data to be captured by the interface
  91. This parameter can be a value of @ref DCMIEx_Byte_Select_Mode */
  92. uint32_t ByteSelectStart; /*!< Specifies if the data to be captured by the interface is even or odd
  93. This parameter can be a value of @ref DCMIEx_Byte_Select_Start */
  94. uint32_t LineSelectMode; /*!< Specifies the line of data to be captured by the interface
  95. This parameter can be a value of @ref DCMIEx_Line_Select_Mode */
  96. uint32_t LineSelectStart; /*!< Specifies if the line of data to be captured by the interface is even or odd
  97. This parameter can be a value of @ref DCMIEx_Line_Select_Start */
  98. #endif /* STM32F446xx || STM32F469xx || STM32F479xx */
  99. }DCMI_InitTypeDef;
  100. /**
  101. * @}
  102. */
  103. /* Exported constants --------------------------------------------------------*/
  104. #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  105. /** @defgroup DCMIEx_Exported_Constants DCMI Exported Constants
  106. * @{
  107. */
  108. /** @defgroup DCMIEx_Byte_Select_Mode DCMI Byte Select Mode
  109. * @{
  110. */
  111. #define DCMI_BSM_ALL 0x00000000U /*!< Interface captures all received data */
  112. #define DCMI_BSM_OTHER ((uint32_t)DCMI_CR_BSM_0) /*!< Interface captures every other byte from the received data */
  113. #define DCMI_BSM_ALTERNATE_4 ((uint32_t)DCMI_CR_BSM_1) /*!< Interface captures one byte out of four */
  114. #define DCMI_BSM_ALTERNATE_2 ((uint32_t)(DCMI_CR_BSM_0 | DCMI_CR_BSM_1)) /*!< Interface captures two bytes out of four */
  115. /**
  116. * @}
  117. */
  118. /** @defgroup DCMIEx_Byte_Select_Start DCMI Byte Select Start
  119. * @{
  120. */
  121. #define DCMI_OEBS_ODD 0x00000000U /*!< Interface captures first data from the frame/line start, second one being dropped */
  122. #define DCMI_OEBS_EVEN ((uint32_t)DCMI_CR_OEBS) /*!< Interface captures second data from the frame/line start, first one being dropped */
  123. /**
  124. * @}
  125. */
  126. /** @defgroup DCMIEx_Line_Select_Mode DCMI Line Select Mode
  127. * @{
  128. */
  129. #define DCMI_LSM_ALL 0x00000000U /*!< Interface captures all received lines */
  130. #define DCMI_LSM_ALTERNATE_2 ((uint32_t)DCMI_CR_LSM) /*!< Interface captures one line out of two */
  131. /**
  132. * @}
  133. */
  134. /** @defgroup DCMIEx_Line_Select_Start DCMI Line Select Start
  135. * @{
  136. */
  137. #define DCMI_OELS_ODD 0x00000000U /*!< Interface captures first line from the frame start, second one being dropped */
  138. #define DCMI_OELS_EVEN ((uint32_t)DCMI_CR_OELS) /*!< Interface captures second line from the frame start, first one being dropped */
  139. /**
  140. * @}
  141. */
  142. /**
  143. * @}
  144. */
  145. #endif /* STM32F446xx || STM32F469xx || STM32F479xx */
  146. /* Exported macro ------------------------------------------------------------*/
  147. /* Exported functions --------------------------------------------------------*/
  148. /* Private types -------------------------------------------------------------*/
  149. /* Private variables ---------------------------------------------------------*/
  150. /* Private constants ---------------------------------------------------------*/
  151. #define DCMI_POSITION_ESCR_LSC (uint32_t)POSITION_VAL(DCMI_ESCR_LSC) /*!< Required left shift to set line start delimiter */
  152. #define DCMI_POSITION_ESCR_LEC (uint32_t)POSITION_VAL(DCMI_ESCR_LEC) /*!< Required left shift to set line end delimiter */
  153. #define DCMI_POSITION_ESCR_FEC (uint32_t)POSITION_VAL(DCMI_ESCR_FEC) /*!< Required left shift to set frame end delimiter */
  154. /* Private macro -------------------------------------------------------------*/
  155. #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
  156. /** @defgroup DCMIEx_Private_Macros DCMI Extended Private Macros
  157. * @{
  158. */
  159. #define IS_DCMI_BYTE_SELECT_MODE(MODE)(((MODE) == DCMI_BSM_ALL) || \
  160. ((MODE) == DCMI_BSM_OTHER) || \
  161. ((MODE) == DCMI_BSM_ALTERNATE_4) || \
  162. ((MODE) == DCMI_BSM_ALTERNATE_2))
  163. #define IS_DCMI_BYTE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OEBS_ODD) || \
  164. ((POLARITY) == DCMI_OEBS_EVEN))
  165. #define IS_DCMI_LINE_SELECT_MODE(MODE)(((MODE) == DCMI_LSM_ALL) || \
  166. ((MODE) == DCMI_LSM_ALTERNATE_2))
  167. #define IS_DCMI_LINE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OELS_ODD) || \
  168. ((POLARITY) == DCMI_OELS_EVEN))
  169. #endif /* STM32F446xx || STM32F469xx || STM32F479xx */
  170. /**
  171. * @}
  172. */
  173. /* Private functions ---------------------------------------------------------*/
  174. #endif /* STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\
  175. STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx ||\
  176. STM32F479xx */
  177. /**
  178. * @}
  179. */
  180. /**
  181. * @}
  182. */
  183. #ifdef __cplusplus
  184. }
  185. #endif
  186. #endif /* __STM32F4xx_HAL_DCMI_H */
  187. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/