Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / STM32F4 / Drivers / STM32F4xx_StdPeriph_Driver / inc / stm32f4xx_cec.h
blob9f9d285f3776d4e206ad8882a2a6e143cd2c61a2
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_cec.h
4 * @author MCD Application Team
5 * @version V1.7.1
6 * @date 20-May-2016
7 * @brief This file contains all the functions prototypes for the CEC firmware
8 * library, applicable only for STM32F466xx devices.
9 ******************************************************************************
10 * @attention
12 * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 * You may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at:
18 * http://www.st.com/software_license_agreement_liberty_v2
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
26 ******************************************************************************
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F4XX_CEC_H
31 #define __STM32F4XX_CEC_H
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f4xx.h"
40 /** @addtogroup STM32F4xx_StdPeriph_Driver
41 * @{
44 /** @addtogroup CEC
45 * @{
47 #if defined(STM32F446xx)
48 /* Exported types ------------------------------------------------------------*/
50 /**
51 * @brief CEC Init structure definition
53 typedef struct
55 uint32_t CEC_SignalFreeTime; /*!< Specifies the CEC Signal Free Time configuration.
56 This parameter can be a value of @ref CEC_Signal_Free_Time */
57 uint32_t CEC_RxTolerance; /*!< Specifies the CEC Reception Tolerance.
58 This parameter can be a value of @ref CEC_RxTolerance */
59 uint32_t CEC_StopReception; /*!< Specifies the CEC Stop Reception.
60 This parameter can be a value of @ref CEC_Stop_Reception */
61 uint32_t CEC_BitRisingError; /*!< Specifies the CEC Bit Rising Error generation.
62 This parameter can be a value of @ref CEC_Bit_Rising_Error_Generation */
63 uint32_t CEC_LongBitPeriodError; /*!< Specifies the CEC Long Bit Error generation.
64 This parameter can be a value of @ref CEC_Long_Bit_Error_Generation */
65 uint32_t CEC_BRDNoGen; /*!< Specifies the CEC Broadcast Error generation.
66 This parameter can be a value of @ref CEC_BDR_No_Gen */
67 uint32_t CEC_SFTOption; /*!< Specifies the CEC Signal Free Time option.
68 This parameter can be a value of @ref CEC_SFT_Option */
70 }CEC_InitTypeDef;
72 /* Exported constants --------------------------------------------------------*/
74 /** @defgroup CEC_Exported_Constants
75 * @{
78 /** @defgroup CEC_Signal_Free_Time
79 * @{
81 #define CEC_SignalFreeTime_Standard ((uint32_t)0x00000000) /*!< CEC Signal Free Time Standard */
82 #define CEC_SignalFreeTime_1T ((uint32_t)0x00000001) /*!< CEC 1.5 nominal data bit periods */
83 #define CEC_SignalFreeTime_2T ((uint32_t)0x00000002) /*!< CEC 2.5 nominal data bit periods */
84 #define CEC_SignalFreeTime_3T ((uint32_t)0x00000003) /*!< CEC 3.5 nominal data bit periods */
85 #define CEC_SignalFreeTime_4T ((uint32_t)0x00000004) /*!< CEC 4.5 nominal data bit periods */
86 #define CEC_SignalFreeTime_5T ((uint32_t)0x00000005) /*!< CEC 5.5 nominal data bit periods */
87 #define CEC_SignalFreeTime_6T ((uint32_t)0x00000006) /*!< CEC 6.5 nominal data bit periods */
88 #define CEC_SignalFreeTime_7T ((uint32_t)0x00000007) /*!< CEC 7.5 nominal data bit periods */
90 #define IS_CEC_SIGNAL_FREE_TIME(TIME) (((TIME) == CEC_SignalFreeTime_Standard) || \
91 ((TIME) == CEC_SignalFreeTime_1T)|| \
92 ((TIME) == CEC_SignalFreeTime_2T)|| \
93 ((TIME) == CEC_SignalFreeTime_3T)|| \
94 ((TIME) == CEC_SignalFreeTime_4T)|| \
95 ((TIME) == CEC_SignalFreeTime_5T)|| \
96 ((TIME) == CEC_SignalFreeTime_6T)|| \
97 ((TIME) == CEC_SignalFreeTime_7T))
98 /**
99 * @}
102 /** @defgroup CEC_RxTolerance
103 * @{
105 #define CEC_RxTolerance_Standard ((uint32_t)0x00000000) /*!< Standard Tolerance Margin */
106 #define CEC_RxTolerance_Extended CEC_CFGR_RXTOL /*!< Extended Tolerance Margin */
108 #define IS_CEC_RX_TOLERANCE(TOLERANCE) (((TOLERANCE) == CEC_RxTolerance_Standard) || \
109 ((TOLERANCE) == CEC_RxTolerance_Extended))
111 * @}
114 /** @defgroup CEC_Stop_Reception
115 * @{
117 #define CEC_StopReception_Off ((uint32_t)0x00000000) /*!< No RX Stop on bit Rising Error (BRE) */
118 #define CEC_StopReception_On CEC_CFGR_BRESTP /*!< RX Stop on bit Rising Error (BRE) */
120 #define IS_CEC_STOP_RECEPTION(RECEPTION) (((RECEPTION) == CEC_StopReception_On) || \
121 ((RECEPTION) == CEC_StopReception_Off))
123 * @}
126 /** @defgroup CEC_Bit_Rising_Error_Generation
127 * @{
129 #define CEC_BitRisingError_Off ((uint32_t)0x00000000) /*!< Bit Rising Error generation turned Off */
130 #define CEC_BitRisingError_On CEC_CFGR_BREGEN /*!< Bit Rising Error generation turned On */
132 #define IS_CEC_BIT_RISING_ERROR(ERROR) (((ERROR) == CEC_BitRisingError_Off) || \
133 ((ERROR) == CEC_BitRisingError_On))
135 * @}
138 /** @defgroup CEC_Long_Bit_Error_Generation
139 * @{
141 #define CEC_LongBitPeriodError_Off ((uint32_t)0x00000000) /*!< Long Bit Period Error generation turned Off */
142 #define CEC_LongBitPeriodError_On CEC_CFGR_LREGEN /*!< Long Bit Period Error generation turned On */
144 #define IS_CEC_LONG_BIT_PERIOD_ERROR(ERROR) (((ERROR) == CEC_LongBitPeriodError_Off) || \
145 ((ERROR) == CEC_LongBitPeriodError_On))
147 * @}
150 /** @defgroup CEC_BDR_No_Gen
151 * @{
154 #define CEC_BRDNoGen_Off ((uint32_t)0x00000000) /*!< Broadcast Bit Rising Error generation turned Off */
155 #define CEC_BRDNoGen_On CEC_CFGR_BRDNOGEN /*!< Broadcast Bit Rising Error generation turned On */
157 #define IS_CEC_BDR_NO_GEN_ERROR(ERROR) (((ERROR) == CEC_BRDNoGen_Off) || \
158 ((ERROR) == CEC_BRDNoGen_On))
160 * @}
163 /** @defgroup CEC_SFT_Option
164 * @{
166 #define CEC_SFTOption_Off ((uint32_t)0x00000000) /*!< SFT option turned Off */
167 #define CEC_SFTOption_On CEC_CFGR_SFTOPT /*!< SFT option turned On */
169 #define IS_CEC_SFT_OPTION(OPTION) (((OPTION) == CEC_SFTOption_Off) || \
170 ((OPTION) == CEC_SFTOption_On))
172 * @}
175 /** @defgroup CEC_Own_Address
176 * @{
178 #define IS_CEC_ADDRESS(ADDRESS) ((ADDRESS) < 0x10)
181 * @}
184 /** @defgroup CEC_Interrupt_Configuration_definition
185 * @{
187 #define CEC_IT_TXACKE CEC_IER_TXACKEIE
188 #define CEC_IT_TXERR CEC_IER_TXERRIE
189 #define CEC_IT_TXUDR CEC_IER_TXUDRIE
190 #define CEC_IT_TXEND CEC_IER_TXENDIE
191 #define CEC_IT_TXBR CEC_IER_TXBRIE
192 #define CEC_IT_ARBLST CEC_IER_ARBLSTIE
193 #define CEC_IT_RXACKE CEC_IER_RXACKEIE
194 #define CEC_IT_LBPE CEC_IER_LBPEIE
195 #define CEC_IT_SBPE CEC_IER_SBPEIE
196 #define CEC_IT_BRE CEC_IER_BREIEIE
197 #define CEC_IT_RXOVR CEC_IER_RXOVRIE
198 #define CEC_IT_RXEND CEC_IER_RXENDIE
199 #define CEC_IT_RXBR CEC_IER_RXBRIE
201 #define IS_CEC_IT(IT) ((((IT) & (uint32_t)0xFFFFE000) == 0x00) && ((IT) != 0x00))
203 #define IS_CEC_GET_IT(IT) (((IT) == CEC_IT_TXACKE) || \
204 ((IT) == CEC_IT_TXERR)|| \
205 ((IT) == CEC_IT_TXUDR)|| \
206 ((IT) == CEC_IT_TXEND)|| \
207 ((IT) == CEC_IT_TXBR)|| \
208 ((IT) == CEC_IT_ARBLST)|| \
209 ((IT) == CEC_IT_RXACKE)|| \
210 ((IT) == CEC_IT_LBPE)|| \
211 ((IT) == CEC_IT_SBPE)|| \
212 ((IT) == CEC_IT_BRE)|| \
213 ((IT) == CEC_IT_RXOVR)|| \
214 ((IT) == CEC_IT_RXEND)|| \
215 ((IT) == CEC_IT_RXBR))
217 * @}
220 /** @defgroup CEC_ISR_register_flags_definition
221 * @{
223 #define CEC_FLAG_TXACKE CEC_ISR_TXACKE
224 #define CEC_FLAG_TXERR CEC_ISR_TXERR
225 #define CEC_FLAG_TXUDR CEC_ISR_TXUDR
226 #define CEC_FLAG_TXEND CEC_ISR_TXEND
227 #define CEC_FLAG_TXBR CEC_ISR_TXBR
228 #define CEC_FLAG_ARBLST CEC_ISR_ARBLST
229 #define CEC_FLAG_RXACKE CEC_ISR_RXACKE
230 #define CEC_FLAG_LBPE CEC_ISR_LBPE
231 #define CEC_FLAG_SBPE CEC_ISR_SBPE
232 #define CEC_FLAG_BRE CEC_ISR_BRE
233 #define CEC_FLAG_RXOVR CEC_ISR_RXOVR
234 #define CEC_FLAG_RXEND CEC_ISR_RXEND
235 #define CEC_FLAG_RXBR CEC_ISR_RXBR
237 #define IS_CEC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFE000) == 0x00) && ((FLAG) != 0x00))
239 #define IS_CEC_GET_FLAG(FLAG) (((FLAG) == CEC_FLAG_TXACKE) || \
240 ((FLAG) == CEC_FLAG_TXERR)|| \
241 ((FLAG) == CEC_FLAG_TXUDR)|| \
242 ((FLAG) == CEC_FLAG_TXEND)|| \
243 ((FLAG) == CEC_FLAG_TXBR)|| \
244 ((FLAG) == CEC_FLAG_ARBLST)|| \
245 ((FLAG) == CEC_FLAG_RXACKE)|| \
246 ((FLAG) == CEC_FLAG_LBPE)|| \
247 ((FLAG) == CEC_FLAG_SBPE)|| \
248 ((FLAG) == CEC_FLAG_BRE)|| \
249 ((FLAG) == CEC_FLAG_RXOVR)|| \
250 ((FLAG) == CEC_FLAG_RXEND)|| \
251 ((FLAG) == CEC_FLAG_RXBR))
253 * @}
257 * @}
260 /* Exported macro ------------------------------------------------------------*/
261 /* Exported functions ------------------------------------------------------- */
263 /* Function used to set the CEC configuration to the default reset state *****/
264 void CEC_DeInit(void);
266 /* CEC_Initialization and Configuration functions *****************************/
267 void CEC_Init(CEC_InitTypeDef* CEC_InitStruct);
268 void CEC_StructInit(CEC_InitTypeDef* CEC_InitStruct);
269 void CEC_Cmd(FunctionalState NewState);
270 void CEC_ListenModeCmd(FunctionalState NewState);
271 void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress);
272 void CEC_OwnAddressClear(void);
274 /* CEC_Data transfers functions ***********************************************/
275 void CEC_SendData(uint8_t Data);
276 uint8_t CEC_ReceiveData(void);
277 void CEC_StartOfMessage(void);
278 void CEC_EndOfMessage(void);
280 /* CEC_Interrupts and flags management functions ******************************/
281 void CEC_ITConfig(uint16_t CEC_IT, FunctionalState NewState);
282 FlagStatus CEC_GetFlagStatus(uint16_t CEC_FLAG);
283 void CEC_ClearFlag(uint32_t CEC_FLAG);
284 ITStatus CEC_GetITStatus(uint16_t CEC_IT);
285 void CEC_ClearITPendingBit(uint16_t CEC_IT);
286 #endif /* STM32F446xx */
288 * @}
292 * @}
295 #ifdef __cplusplus
297 #endif
299 #endif /*__STM32F4xx_CEC_H */
301 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/