STM32F1 Standard Peripheral bibliotheek  1.0
ST Microelectronics bibliotheek documentatie voor de STM32F1 Standard Peripheral Library
 All Data Structures Files Functions Variables Enumerations Groups
stm32f10x_cec.h
Go to the documentation of this file.
1 
22 /* Define to prevent recursive inclusion -------------------------------------*/
23 #ifndef __STM32F10x_CEC_H
24 #define __STM32F10x_CEC_H
25 
26 #ifdef __cplusplus
27  extern "C" {
28 #endif
29 
30 /* Includes ------------------------------------------------------------------*/
31 #include "stm32f10x.h"
32 
49 typedef struct
50 {
51  uint16_t CEC_BitTimingMode;
53  uint16_t CEC_BitPeriodMode;
56 
68 #define CEC_BitTimingStdMode ((uint16_t)0x00)
69 #define CEC_BitTimingErrFreeMode CEC_CFGR_BTEM
71 #define IS_CEC_BIT_TIMING_ERROR_MODE(MODE) (((MODE) == CEC_BitTimingStdMode) || \
72  ((MODE) == CEC_BitTimingErrFreeMode))
73 
80 #define CEC_BitPeriodStdMode ((uint16_t)0x00)
81 #define CEC_BitPeriodFlexibleMode CEC_CFGR_BPEM
83 #define IS_CEC_BIT_PERIOD_ERROR_MODE(MODE) (((MODE) == CEC_BitPeriodStdMode) || \
84  ((MODE) == CEC_BitPeriodFlexibleMode))
85 
93 #define CEC_IT_TERR CEC_CSR_TERR
94 #define CEC_IT_TBTRF CEC_CSR_TBTRF
95 #define CEC_IT_RERR CEC_CSR_RERR
96 #define CEC_IT_RBTF CEC_CSR_RBTF
97 #define IS_CEC_GET_IT(IT) (((IT) == CEC_IT_TERR) || ((IT) == CEC_IT_TBTRF) || \
98  ((IT) == CEC_IT_RERR) || ((IT) == CEC_IT_RBTF))
99 
107 #define IS_CEC_ADDRESS(ADDRESS) ((ADDRESS) < 0x10)
108 
115 #define IS_CEC_PRESCALER(PRESCALER) ((PRESCALER) <= 0x3FFF)
116 
128 #define CEC_FLAG_BTE ((uint32_t)0x10010000)
129 #define CEC_FLAG_BPE ((uint32_t)0x10020000)
130 #define CEC_FLAG_RBTFE ((uint32_t)0x10040000)
131 #define CEC_FLAG_SBE ((uint32_t)0x10080000)
132 #define CEC_FLAG_ACKE ((uint32_t)0x10100000)
133 #define CEC_FLAG_LINE ((uint32_t)0x10200000)
134 #define CEC_FLAG_TBTFE ((uint32_t)0x10400000)
135 
139 #define CEC_FLAG_TEOM ((uint32_t)0x00000002)
140 #define CEC_FLAG_TERR ((uint32_t)0x00000004)
141 #define CEC_FLAG_TBTRF ((uint32_t)0x00000008)
142 #define CEC_FLAG_RSOM ((uint32_t)0x00000010)
143 #define CEC_FLAG_REOM ((uint32_t)0x00000020)
144 #define CEC_FLAG_RERR ((uint32_t)0x00000040)
145 #define CEC_FLAG_RBTF ((uint32_t)0x00000080)
146 
147 #define IS_CEC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFF03) == 0x00) && ((FLAG) != 0x00))
148 
149 #define IS_CEC_GET_FLAG(FLAG) (((FLAG) == CEC_FLAG_BTE) || ((FLAG) == CEC_FLAG_BPE) || \
150  ((FLAG) == CEC_FLAG_RBTFE) || ((FLAG)== CEC_FLAG_SBE) || \
151  ((FLAG) == CEC_FLAG_ACKE) || ((FLAG) == CEC_FLAG_LINE) || \
152  ((FLAG) == CEC_FLAG_TBTFE) || ((FLAG) == CEC_FLAG_TEOM) || \
153  ((FLAG) == CEC_FLAG_TERR) || ((FLAG) == CEC_FLAG_TBTRF) || \
154  ((FLAG) == CEC_FLAG_RSOM) || ((FLAG) == CEC_FLAG_REOM) || \
155  ((FLAG) == CEC_FLAG_RERR) || ((FLAG) == CEC_FLAG_RBTF))
156 
176 void CEC_DeInit(void);
177 void CEC_Init(CEC_InitTypeDef* CEC_InitStruct);
178 void CEC_Cmd(FunctionalState NewState);
179 void CEC_ITConfig(FunctionalState NewState);
180 void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress);
181 void CEC_SetPrescaler(uint16_t CEC_Prescaler);
182 void CEC_SendDataByte(uint8_t Data);
183 uint8_t CEC_ReceiveDataByte(void);
184 void CEC_StartOfMessage(void);
185 void CEC_EndOfMessageCmd(FunctionalState NewState);
186 FlagStatus CEC_GetFlagStatus(uint32_t CEC_FLAG);
187 void CEC_ClearFlag(uint32_t CEC_FLAG);
188 ITStatus CEC_GetITStatus(uint8_t CEC_IT);
189 void CEC_ClearITPendingBit(uint16_t CEC_IT);
190 
191 #ifdef __cplusplus
192 }
193 #endif
194 
195 #endif /* __STM32F10x_CEC_H */
196 
209 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/