stm32f4xx_hal_dcmi_ex.h 10 KB

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