Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 /**
lypinator 0:bb348c97df44 2 ******************************************************************************
lypinator 0:bb348c97df44 3 * @file stm32f4xx_hal_cec.h
lypinator 0:bb348c97df44 4 * @author MCD Application Team
lypinator 0:bb348c97df44 5 * @brief Header file of CEC HAL module.
lypinator 0:bb348c97df44 6 ******************************************************************************
lypinator 0:bb348c97df44 7 * @attention
lypinator 0:bb348c97df44 8 *
lypinator 0:bb348c97df44 9 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
lypinator 0:bb348c97df44 10 *
lypinator 0:bb348c97df44 11 * Redistribution and use in source and binary forms, with or without modification,
lypinator 0:bb348c97df44 12 * are permitted provided that the following conditions are met:
lypinator 0:bb348c97df44 13 * 1. Redistributions of source code must retain the above copyright notice,
lypinator 0:bb348c97df44 14 * this list of conditions and the following disclaimer.
lypinator 0:bb348c97df44 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
lypinator 0:bb348c97df44 16 * this list of conditions and the following disclaimer in the documentation
lypinator 0:bb348c97df44 17 * and/or other materials provided with the distribution.
lypinator 0:bb348c97df44 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
lypinator 0:bb348c97df44 19 * may be used to endorse or promote products derived from this software
lypinator 0:bb348c97df44 20 * without specific prior written permission.
lypinator 0:bb348c97df44 21 *
lypinator 0:bb348c97df44 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
lypinator 0:bb348c97df44 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
lypinator 0:bb348c97df44 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
lypinator 0:bb348c97df44 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
lypinator 0:bb348c97df44 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
lypinator 0:bb348c97df44 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
lypinator 0:bb348c97df44 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
lypinator 0:bb348c97df44 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
lypinator 0:bb348c97df44 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
lypinator 0:bb348c97df44 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
lypinator 0:bb348c97df44 32 *
lypinator 0:bb348c97df44 33 ******************************************************************************
lypinator 0:bb348c97df44 34 */
lypinator 0:bb348c97df44 35
lypinator 0:bb348c97df44 36 /* Define to prevent recursive inclusion -------------------------------------*/
lypinator 0:bb348c97df44 37 #ifndef __STM32F4xx_HAL_CEC_H
lypinator 0:bb348c97df44 38 #define __STM32F4xx_HAL_CEC_H
lypinator 0:bb348c97df44 39
lypinator 0:bb348c97df44 40 #ifdef __cplusplus
lypinator 0:bb348c97df44 41 extern "C" {
lypinator 0:bb348c97df44 42 #endif
lypinator 0:bb348c97df44 43
lypinator 0:bb348c97df44 44 #if defined(STM32F446xx)
lypinator 0:bb348c97df44 45 /* Includes ------------------------------------------------------------------*/
lypinator 0:bb348c97df44 46 #include "stm32f4xx_hal_def.h"
lypinator 0:bb348c97df44 47
lypinator 0:bb348c97df44 48 /** @addtogroup STM32F4xx_HAL_Driver
lypinator 0:bb348c97df44 49 * @{
lypinator 0:bb348c97df44 50 */
lypinator 0:bb348c97df44 51
lypinator 0:bb348c97df44 52 /** @addtogroup CEC
lypinator 0:bb348c97df44 53 * @{
lypinator 0:bb348c97df44 54 */
lypinator 0:bb348c97df44 55
lypinator 0:bb348c97df44 56 /* Exported types ------------------------------------------------------------*/
lypinator 0:bb348c97df44 57 /** @defgroup CEC_Exported_Types CEC Exported Types
lypinator 0:bb348c97df44 58 * @{
lypinator 0:bb348c97df44 59 */
lypinator 0:bb348c97df44 60
lypinator 0:bb348c97df44 61 /**
lypinator 0:bb348c97df44 62 * @brief CEC Init Structure definition
lypinator 0:bb348c97df44 63 */
lypinator 0:bb348c97df44 64 typedef struct
lypinator 0:bb348c97df44 65 {
lypinator 0:bb348c97df44 66 uint32_t SignalFreeTime; /*!< Set SFT field, specifies the Signal Free Time.
lypinator 0:bb348c97df44 67 It can be one of @ref CEC_Signal_Free_Time
lypinator 0:bb348c97df44 68 and belongs to the set {0,...,7} where
lypinator 0:bb348c97df44 69 0x0 is the default configuration
lypinator 0:bb348c97df44 70 else means 0.5 + (SignalFreeTime - 1) nominal data bit periods */
lypinator 0:bb348c97df44 71
lypinator 0:bb348c97df44 72 uint32_t Tolerance; /*!< Set RXTOL bit, specifies the tolerance accepted on the received waveforms,
lypinator 0:bb348c97df44 73 it can be a value of @ref CEC_Tolerance : it is either CEC_STANDARD_TOLERANCE
lypinator 0:bb348c97df44 74 or CEC_EXTENDED_TOLERANCE */
lypinator 0:bb348c97df44 75
lypinator 0:bb348c97df44 76 uint32_t BRERxStop; /*!< Set BRESTP bit @ref CEC_BRERxStop : specifies whether or not a Bit Rising Error stops the reception.
lypinator 0:bb348c97df44 77 CEC_NO_RX_STOP_ON_BRE: reception is not stopped.
lypinator 0:bb348c97df44 78 CEC_RX_STOP_ON_BRE: reception is stopped. */
lypinator 0:bb348c97df44 79
lypinator 0:bb348c97df44 80 uint32_t BREErrorBitGen; /*!< Set BREGEN bit @ref CEC_BREErrorBitGen : specifies whether or not an Error-Bit is generated on the
lypinator 0:bb348c97df44 81 CEC line upon Bit Rising Error detection.
lypinator 0:bb348c97df44 82 CEC_BRE_ERRORBIT_NO_GENERATION: no error-bit generation.
lypinator 0:bb348c97df44 83 CEC_BRE_ERRORBIT_GENERATION: error-bit generation if BRESTP is set. */
lypinator 0:bb348c97df44 84
lypinator 0:bb348c97df44 85 uint32_t LBPEErrorBitGen; /*!< Set LBPEGEN bit @ref CEC_LBPEErrorBitGen : specifies whether or not an Error-Bit is generated on the
lypinator 0:bb348c97df44 86 CEC line upon Long Bit Period Error detection.
lypinator 0:bb348c97df44 87 CEC_LBPE_ERRORBIT_NO_GENERATION: no error-bit generation.
lypinator 0:bb348c97df44 88 CEC_LBPE_ERRORBIT_GENERATION: error-bit generation. */
lypinator 0:bb348c97df44 89
lypinator 0:bb348c97df44 90 uint32_t BroadcastMsgNoErrorBitGen; /*!< Set BRDNOGEN bit @ref CEC_BroadCastMsgErrorBitGen : allows to avoid an Error-Bit generation on the CEC line
lypinator 0:bb348c97df44 91 upon an error detected on a broadcast message.
lypinator 0:bb348c97df44 92
lypinator 0:bb348c97df44 93 It supersedes BREGEN and LBPEGEN bits for a broadcast message error handling. It can take two values:
lypinator 0:bb348c97df44 94
lypinator 0:bb348c97df44 95 1) CEC_BROADCASTERROR_ERRORBIT_GENERATION.
lypinator 0:bb348c97df44 96 a) BRE detection: error-bit generation on the CEC line if BRESTP=CEC_RX_STOP_ON_BRE
lypinator 0:bb348c97df44 97 and BREGEN=CEC_BRE_ERRORBIT_NO_GENERATION.
lypinator 0:bb348c97df44 98 b) LBPE detection: error-bit generation on the CEC line
lypinator 0:bb348c97df44 99 if LBPGEN=CEC_LBPE_ERRORBIT_NO_GENERATION.
lypinator 0:bb348c97df44 100
lypinator 0:bb348c97df44 101 2) CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION.
lypinator 0:bb348c97df44 102 no error-bit generation in case neither a) nor b) are satisfied. Additionally,
lypinator 0:bb348c97df44 103 there is no error-bit generation in case of Short Bit Period Error detection in
lypinator 0:bb348c97df44 104 a broadcast message while LSTN bit is set. */
lypinator 0:bb348c97df44 105
lypinator 0:bb348c97df44 106 uint32_t SignalFreeTimeOption; /*!< Set SFTOP bit @ref CEC_SFT_Option : specifies when SFT timer starts.
lypinator 0:bb348c97df44 107 CEC_SFT_START_ON_TXSOM SFT: timer starts when TXSOM is set by software.
lypinator 0:bb348c97df44 108 CEC_SFT_START_ON_TX_RX_END: SFT timer starts automatically at the end of message transmission/reception. */
lypinator 0:bb348c97df44 109
lypinator 0:bb348c97df44 110 uint32_t ListenMode; /*!< Set LSTN bit @ref CEC_Listening_Mode : specifies device listening mode. It can take two values:
lypinator 0:bb348c97df44 111
lypinator 0:bb348c97df44 112 CEC_REDUCED_LISTENING_MODE: CEC peripheral receives only message addressed to its
lypinator 0:bb348c97df44 113 own address (OAR). Messages addressed to different destination are ignored.
lypinator 0:bb348c97df44 114 Broadcast messages are always received.
lypinator 0:bb348c97df44 115
lypinator 0:bb348c97df44 116 CEC_FULL_LISTENING_MODE: CEC peripheral receives messages addressed to its own
lypinator 0:bb348c97df44 117 address (OAR) with positive acknowledge. Messages addressed to different destination
lypinator 0:bb348c97df44 118 are received, but without interfering with the CEC bus: no acknowledge sent. */
lypinator 0:bb348c97df44 119
lypinator 0:bb348c97df44 120 uint16_t OwnAddress; /*!< Own addresses configuration
lypinator 0:bb348c97df44 121 This parameter can be a value of @ref CEC_OWN_ADDRESS */
lypinator 0:bb348c97df44 122
lypinator 0:bb348c97df44 123 uint8_t *RxBuffer; /*!< CEC Rx buffer pointeur */
lypinator 0:bb348c97df44 124
lypinator 0:bb348c97df44 125
lypinator 0:bb348c97df44 126 }CEC_InitTypeDef;
lypinator 0:bb348c97df44 127
lypinator 0:bb348c97df44 128 /**
lypinator 0:bb348c97df44 129 * @brief HAL CEC State structures definition
lypinator 0:bb348c97df44 130 * @note HAL CEC State value is a combination of 2 different substates: gState and RxState.
lypinator 0:bb348c97df44 131 * - gState contains CEC state information related to global Handle management
lypinator 0:bb348c97df44 132 * and also information related to Tx operations.
lypinator 0:bb348c97df44 133 * gState value coding follow below described bitmap :
lypinator 0:bb348c97df44 134 * b7 (not used)
lypinator 0:bb348c97df44 135 * x : Should be set to 0
lypinator 0:bb348c97df44 136 * b6 Error information
lypinator 0:bb348c97df44 137 * 0 : No Error
lypinator 0:bb348c97df44 138 * 1 : Error
lypinator 0:bb348c97df44 139 * b5 IP initilisation status
lypinator 0:bb348c97df44 140 * 0 : Reset (IP not initialized)
lypinator 0:bb348c97df44 141 * 1 : Init done (IP initialized. HAL CEC Init function already called)
lypinator 0:bb348c97df44 142 * b4-b3 (not used)
lypinator 0:bb348c97df44 143 * xx : Should be set to 00
lypinator 0:bb348c97df44 144 * b2 Intrinsic process state
lypinator 0:bb348c97df44 145 * 0 : Ready
lypinator 0:bb348c97df44 146 * 1 : Busy (IP busy with some configuration or internal operations)
lypinator 0:bb348c97df44 147 * b1 (not used)
lypinator 0:bb348c97df44 148 * x : Should be set to 0
lypinator 0:bb348c97df44 149 * b0 Tx state
lypinator 0:bb348c97df44 150 * 0 : Ready (no Tx operation ongoing)
lypinator 0:bb348c97df44 151 * 1 : Busy (Tx operation ongoing)
lypinator 0:bb348c97df44 152 * - RxState contains information related to Rx operations.
lypinator 0:bb348c97df44 153 * RxState value coding follow below described bitmap :
lypinator 0:bb348c97df44 154 * b7-b6 (not used)
lypinator 0:bb348c97df44 155 * xx : Should be set to 00
lypinator 0:bb348c97df44 156 * b5 IP initilisation status
lypinator 0:bb348c97df44 157 * 0 : Reset (IP not initialized)
lypinator 0:bb348c97df44 158 * 1 : Init done (IP initialized)
lypinator 0:bb348c97df44 159 * b4-b2 (not used)
lypinator 0:bb348c97df44 160 * xxx : Should be set to 000
lypinator 0:bb348c97df44 161 * b1 Rx state
lypinator 0:bb348c97df44 162 * 0 : Ready (no Rx operation ongoing)
lypinator 0:bb348c97df44 163 * 1 : Busy (Rx operation ongoing)
lypinator 0:bb348c97df44 164 * b0 (not used)
lypinator 0:bb348c97df44 165 * x : Should be set to 0.
lypinator 0:bb348c97df44 166 */
lypinator 0:bb348c97df44 167 typedef enum
lypinator 0:bb348c97df44 168 {
lypinator 0:bb348c97df44 169 HAL_CEC_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized
lypinator 0:bb348c97df44 170 Value is allowed for gState and RxState */
lypinator 0:bb348c97df44 171 HAL_CEC_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use
lypinator 0:bb348c97df44 172 Value is allowed for gState and RxState */
lypinator 0:bb348c97df44 173 HAL_CEC_STATE_BUSY = 0x24U, /*!< an internal process is ongoing
lypinator 0:bb348c97df44 174 Value is allowed for gState only */
lypinator 0:bb348c97df44 175 HAL_CEC_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing
lypinator 0:bb348c97df44 176 Value is allowed for RxState only */
lypinator 0:bb348c97df44 177 HAL_CEC_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing
lypinator 0:bb348c97df44 178 Value is allowed for gState only */
lypinator 0:bb348c97df44 179 HAL_CEC_STATE_ERROR = 0x60U /*!< Error Value is allowed for gState only */
lypinator 0:bb348c97df44 180 }HAL_CEC_StateTypeDef;
lypinator 0:bb348c97df44 181
lypinator 0:bb348c97df44 182 /**
lypinator 0:bb348c97df44 183 * @brief CEC handle Structure definition
lypinator 0:bb348c97df44 184 */
lypinator 0:bb348c97df44 185 typedef struct
lypinator 0:bb348c97df44 186 {
lypinator 0:bb348c97df44 187 CEC_TypeDef *Instance; /*!< CEC registers base address */
lypinator 0:bb348c97df44 188
lypinator 0:bb348c97df44 189 CEC_InitTypeDef Init; /*!< CEC communication parameters */
lypinator 0:bb348c97df44 190
lypinator 0:bb348c97df44 191 uint8_t *pTxBuffPtr; /*!< Pointer to CEC Tx transfer Buffer */
lypinator 0:bb348c97df44 192
lypinator 0:bb348c97df44 193 uint16_t TxXferCount; /*!< CEC Tx Transfer Counter */
lypinator 0:bb348c97df44 194
lypinator 0:bb348c97df44 195 uint16_t RxXferSize; /*!< CEC Rx Transfer size, 0: header received only */
lypinator 0:bb348c97df44 196
lypinator 0:bb348c97df44 197 HAL_LockTypeDef Lock; /*!< Locking object */
lypinator 0:bb348c97df44 198
lypinator 0:bb348c97df44 199 HAL_CEC_StateTypeDef gState; /*!< CEC state information related to global Handle management
lypinator 0:bb348c97df44 200 and also related to Tx operations.
lypinator 0:bb348c97df44 201 This parameter can be a value of @ref HAL_CEC_StateTypeDef */
lypinator 0:bb348c97df44 202
lypinator 0:bb348c97df44 203 HAL_CEC_StateTypeDef RxState; /*!< CEC state information related to Rx operations.
lypinator 0:bb348c97df44 204 This parameter can be a value of @ref HAL_CEC_StateTypeDef */
lypinator 0:bb348c97df44 205
lypinator 0:bb348c97df44 206 uint32_t ErrorCode; /*!< For errors handling purposes, copy of ISR register
lypinator 0:bb348c97df44 207 in case error is reported */
lypinator 0:bb348c97df44 208 }CEC_HandleTypeDef;
lypinator 0:bb348c97df44 209 /**
lypinator 0:bb348c97df44 210 * @}
lypinator 0:bb348c97df44 211 */
lypinator 0:bb348c97df44 212
lypinator 0:bb348c97df44 213 /* Exported constants --------------------------------------------------------*/
lypinator 0:bb348c97df44 214 /** @defgroup CEC_Exported_Constants CEC Exported Constants
lypinator 0:bb348c97df44 215 * @{
lypinator 0:bb348c97df44 216 */
lypinator 0:bb348c97df44 217
lypinator 0:bb348c97df44 218 /** @defgroup CEC_Error_Code CEC Error Code
lypinator 0:bb348c97df44 219 * @{
lypinator 0:bb348c97df44 220 */
lypinator 0:bb348c97df44 221 #define HAL_CEC_ERROR_NONE 0x00000000U /*!< no error */
lypinator 0:bb348c97df44 222 #define HAL_CEC_ERROR_RXOVR CEC_ISR_RXOVR /*!< CEC Rx-Overrun */
lypinator 0:bb348c97df44 223 #define HAL_CEC_ERROR_BRE CEC_ISR_BRE /*!< CEC Rx Bit Rising Error */
lypinator 0:bb348c97df44 224 #define HAL_CEC_ERROR_SBPE CEC_ISR_SBPE /*!< CEC Rx Short Bit period Error */
lypinator 0:bb348c97df44 225 #define HAL_CEC_ERROR_LBPE CEC_ISR_LBPE /*!< CEC Rx Long Bit period Error */
lypinator 0:bb348c97df44 226 #define HAL_CEC_ERROR_RXACKE CEC_ISR_RXACKE /*!< CEC Rx Missing Acknowledge */
lypinator 0:bb348c97df44 227 #define HAL_CEC_ERROR_ARBLST CEC_ISR_ARBLST /*!< CEC Arbitration Lost */
lypinator 0:bb348c97df44 228 #define HAL_CEC_ERROR_TXUDR CEC_ISR_TXUDR /*!< CEC Tx-Buffer Underrun */
lypinator 0:bb348c97df44 229 #define HAL_CEC_ERROR_TXERR CEC_ISR_TXERR /*!< CEC Tx-Error */
lypinator 0:bb348c97df44 230 #define HAL_CEC_ERROR_TXACKE CEC_ISR_TXACKE /*!< CEC Tx Missing Acknowledge */
lypinator 0:bb348c97df44 231 /**
lypinator 0:bb348c97df44 232 * @}
lypinator 0:bb348c97df44 233 */
lypinator 0:bb348c97df44 234
lypinator 0:bb348c97df44 235 /** @defgroup CEC_Signal_Free_Time CEC Signal Free Time setting parameter
lypinator 0:bb348c97df44 236 * @{
lypinator 0:bb348c97df44 237 */
lypinator 0:bb348c97df44 238 #define CEC_DEFAULT_SFT 0x00000000U
lypinator 0:bb348c97df44 239 #define CEC_0_5_BITPERIOD_SFT 0x00000001U
lypinator 0:bb348c97df44 240 #define CEC_1_5_BITPERIOD_SFT 0x00000002U
lypinator 0:bb348c97df44 241 #define CEC_2_5_BITPERIOD_SFT 0x00000003U
lypinator 0:bb348c97df44 242 #define CEC_3_5_BITPERIOD_SFT 0x00000004U
lypinator 0:bb348c97df44 243 #define CEC_4_5_BITPERIOD_SFT 0x00000005U
lypinator 0:bb348c97df44 244 #define CEC_5_5_BITPERIOD_SFT 0x00000006U
lypinator 0:bb348c97df44 245 #define CEC_6_5_BITPERIOD_SFT 0x00000007U
lypinator 0:bb348c97df44 246 /**
lypinator 0:bb348c97df44 247 * @}
lypinator 0:bb348c97df44 248 */
lypinator 0:bb348c97df44 249
lypinator 0:bb348c97df44 250 /** @defgroup CEC_Tolerance CEC Receiver Tolerance
lypinator 0:bb348c97df44 251 * @{
lypinator 0:bb348c97df44 252 */
lypinator 0:bb348c97df44 253 #define CEC_STANDARD_TOLERANCE 0x00000000U
lypinator 0:bb348c97df44 254 #define CEC_EXTENDED_TOLERANCE ((uint32_t)CEC_CFGR_RXTOL)
lypinator 0:bb348c97df44 255 /**
lypinator 0:bb348c97df44 256 * @}
lypinator 0:bb348c97df44 257 */
lypinator 0:bb348c97df44 258
lypinator 0:bb348c97df44 259 /** @defgroup CEC_BRERxStop CEC Reception Stop on Error
lypinator 0:bb348c97df44 260 * @{
lypinator 0:bb348c97df44 261 */
lypinator 0:bb348c97df44 262 #define CEC_NO_RX_STOP_ON_BRE 0x00000000U
lypinator 0:bb348c97df44 263 #define CEC_RX_STOP_ON_BRE ((uint32_t)CEC_CFGR_BRESTP)
lypinator 0:bb348c97df44 264 /**
lypinator 0:bb348c97df44 265 * @}
lypinator 0:bb348c97df44 266 */
lypinator 0:bb348c97df44 267
lypinator 0:bb348c97df44 268 /** @defgroup CEC_BREErrorBitGen CEC Error Bit Generation if Bit Rise Error reported
lypinator 0:bb348c97df44 269 * @{
lypinator 0:bb348c97df44 270 */
lypinator 0:bb348c97df44 271 #define CEC_BRE_ERRORBIT_NO_GENERATION 0x00000000U
lypinator 0:bb348c97df44 272 #define CEC_BRE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BREGEN)
lypinator 0:bb348c97df44 273 /**
lypinator 0:bb348c97df44 274 * @}
lypinator 0:bb348c97df44 275 */
lypinator 0:bb348c97df44 276
lypinator 0:bb348c97df44 277 /** @defgroup CEC_LBPEErrorBitGen CEC Error Bit Generation if Long Bit Period Error reported
lypinator 0:bb348c97df44 278 * @{
lypinator 0:bb348c97df44 279 */
lypinator 0:bb348c97df44 280 #define CEC_LBPE_ERRORBIT_NO_GENERATION 0x00000000U
lypinator 0:bb348c97df44 281 #define CEC_LBPE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_LBPEGEN)
lypinator 0:bb348c97df44 282 /**
lypinator 0:bb348c97df44 283 * @}
lypinator 0:bb348c97df44 284 */
lypinator 0:bb348c97df44 285
lypinator 0:bb348c97df44 286 /** @defgroup CEC_BroadCastMsgErrorBitGen CEC Error Bit Generation on Broadcast message
lypinator 0:bb348c97df44 287 * @{
lypinator 0:bb348c97df44 288 */
lypinator 0:bb348c97df44 289 #define CEC_BROADCASTERROR_ERRORBIT_GENERATION 0x00000000U
lypinator 0:bb348c97df44 290 #define CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BRDNOGEN)
lypinator 0:bb348c97df44 291 /**
lypinator 0:bb348c97df44 292 * @}
lypinator 0:bb348c97df44 293 */
lypinator 0:bb348c97df44 294
lypinator 0:bb348c97df44 295 /** @defgroup CEC_SFT_Option CEC Signal Free Time start option
lypinator 0:bb348c97df44 296 * @{
lypinator 0:bb348c97df44 297 */
lypinator 0:bb348c97df44 298 #define CEC_SFT_START_ON_TXSOM 0x00000000U
lypinator 0:bb348c97df44 299 #define CEC_SFT_START_ON_TX_RX_END ((uint32_t)CEC_CFGR_SFTOPT)
lypinator 0:bb348c97df44 300 /**
lypinator 0:bb348c97df44 301 * @}
lypinator 0:bb348c97df44 302 */
lypinator 0:bb348c97df44 303
lypinator 0:bb348c97df44 304 /** @defgroup CEC_Listening_Mode CEC Listening mode option
lypinator 0:bb348c97df44 305 * @{
lypinator 0:bb348c97df44 306 */
lypinator 0:bb348c97df44 307 #define CEC_REDUCED_LISTENING_MODE 0x00000000U
lypinator 0:bb348c97df44 308 #define CEC_FULL_LISTENING_MODE ((uint32_t)CEC_CFGR_LSTN)
lypinator 0:bb348c97df44 309 /**
lypinator 0:bb348c97df44 310 * @}
lypinator 0:bb348c97df44 311 */
lypinator 0:bb348c97df44 312
lypinator 0:bb348c97df44 313 /** @defgroup CEC_OAR_Position CEC Device Own Address position in CEC CFGR register
lypinator 0:bb348c97df44 314 * @{
lypinator 0:bb348c97df44 315 */
lypinator 0:bb348c97df44 316 #define CEC_CFGR_OAR_LSB_POS 16U
lypinator 0:bb348c97df44 317 /**
lypinator 0:bb348c97df44 318 * @}
lypinator 0:bb348c97df44 319 */
lypinator 0:bb348c97df44 320
lypinator 0:bb348c97df44 321 /** @defgroup CEC_Initiator_Position CEC Initiator logical address position in message header
lypinator 0:bb348c97df44 322 * @{
lypinator 0:bb348c97df44 323 */
lypinator 0:bb348c97df44 324 #define CEC_INITIATOR_LSB_POS 4U
lypinator 0:bb348c97df44 325 /**
lypinator 0:bb348c97df44 326 * @}
lypinator 0:bb348c97df44 327 */
lypinator 0:bb348c97df44 328
lypinator 0:bb348c97df44 329 /** @defgroup CEC_OWN_ADDRESS CEC Own Address
lypinator 0:bb348c97df44 330 * @{
lypinator 0:bb348c97df44 331 */
lypinator 0:bb348c97df44 332 #define CEC_OWN_ADDRESS_NONE ((uint16_t)0x0000) /* Reset value */
lypinator 0:bb348c97df44 333 #define CEC_OWN_ADDRESS_0 ((uint16_t)0x0001) /* Logical Address 0 */
lypinator 0:bb348c97df44 334 #define CEC_OWN_ADDRESS_1 ((uint16_t)0x0002) /* Logical Address 1 */
lypinator 0:bb348c97df44 335 #define CEC_OWN_ADDRESS_2 ((uint16_t)0x0004) /* Logical Address 2 */
lypinator 0:bb348c97df44 336 #define CEC_OWN_ADDRESS_3 ((uint16_t)0x0008) /* Logical Address 3 */
lypinator 0:bb348c97df44 337 #define CEC_OWN_ADDRESS_4 ((uint16_t)0x0010) /* Logical Address 4 */
lypinator 0:bb348c97df44 338 #define CEC_OWN_ADDRESS_5 ((uint16_t)0x0020) /* Logical Address 5 */
lypinator 0:bb348c97df44 339 #define CEC_OWN_ADDRESS_6 ((uint16_t)0x0040) /* Logical Address 6 */
lypinator 0:bb348c97df44 340 #define CEC_OWN_ADDRESS_7 ((uint16_t)0x0080) /* Logical Address 7 */
lypinator 0:bb348c97df44 341 #define CEC_OWN_ADDRESS_8 ((uint16_t)0x0100) /* Logical Address 9 */
lypinator 0:bb348c97df44 342 #define CEC_OWN_ADDRESS_9 ((uint16_t)0x0200) /* Logical Address 10 */
lypinator 0:bb348c97df44 343 #define CEC_OWN_ADDRESS_10 ((uint16_t)0x0400) /* Logical Address 11 */
lypinator 0:bb348c97df44 344 #define CEC_OWN_ADDRESS_11 ((uint16_t)0x0800) /* Logical Address 12 */
lypinator 0:bb348c97df44 345 #define CEC_OWN_ADDRESS_12 ((uint16_t)0x1000) /* Logical Address 13 */
lypinator 0:bb348c97df44 346 #define CEC_OWN_ADDRESS_13 ((uint16_t)0x2000) /* Logical Address 14 */
lypinator 0:bb348c97df44 347 #define CEC_OWN_ADDRESS_14 ((uint16_t)0x4000) /* Logical Address 15 */
lypinator 0:bb348c97df44 348 /**
lypinator 0:bb348c97df44 349 * @}
lypinator 0:bb348c97df44 350 */
lypinator 0:bb348c97df44 351
lypinator 0:bb348c97df44 352 /** @defgroup CEC_Interrupts_Definitions CEC Interrupts definition
lypinator 0:bb348c97df44 353 * @{
lypinator 0:bb348c97df44 354 */
lypinator 0:bb348c97df44 355 #define CEC_IT_TXACKE CEC_IER_TXACKEIE
lypinator 0:bb348c97df44 356 #define CEC_IT_TXERR CEC_IER_TXERRIE
lypinator 0:bb348c97df44 357 #define CEC_IT_TXUDR CEC_IER_TXUDRIE
lypinator 0:bb348c97df44 358 #define CEC_IT_TXEND CEC_IER_TXENDIE
lypinator 0:bb348c97df44 359 #define CEC_IT_TXBR CEC_IER_TXBRIE
lypinator 0:bb348c97df44 360 #define CEC_IT_ARBLST CEC_IER_ARBLSTIE
lypinator 0:bb348c97df44 361 #define CEC_IT_RXACKE CEC_IER_RXACKEIE
lypinator 0:bb348c97df44 362 #define CEC_IT_LBPE CEC_IER_LBPEIE
lypinator 0:bb348c97df44 363 #define CEC_IT_SBPE CEC_IER_SBPEIE
lypinator 0:bb348c97df44 364 #define CEC_IT_BRE CEC_IER_BREIE
lypinator 0:bb348c97df44 365 #define CEC_IT_RXOVR CEC_IER_RXOVRIE
lypinator 0:bb348c97df44 366 #define CEC_IT_RXEND CEC_IER_RXENDIE
lypinator 0:bb348c97df44 367 #define CEC_IT_RXBR CEC_IER_RXBRIE
lypinator 0:bb348c97df44 368 /**
lypinator 0:bb348c97df44 369 * @}
lypinator 0:bb348c97df44 370 */
lypinator 0:bb348c97df44 371
lypinator 0:bb348c97df44 372 /** @defgroup CEC_Flags_Definitions CEC Flags definition
lypinator 0:bb348c97df44 373 * @{
lypinator 0:bb348c97df44 374 */
lypinator 0:bb348c97df44 375 #define CEC_FLAG_TXACKE CEC_ISR_TXACKE
lypinator 0:bb348c97df44 376 #define CEC_FLAG_TXERR CEC_ISR_TXERR
lypinator 0:bb348c97df44 377 #define CEC_FLAG_TXUDR CEC_ISR_TXUDR
lypinator 0:bb348c97df44 378 #define CEC_FLAG_TXEND CEC_ISR_TXEND
lypinator 0:bb348c97df44 379 #define CEC_FLAG_TXBR CEC_ISR_TXBR
lypinator 0:bb348c97df44 380 #define CEC_FLAG_ARBLST CEC_ISR_ARBLST
lypinator 0:bb348c97df44 381 #define CEC_FLAG_RXACKE CEC_ISR_RXACKE
lypinator 0:bb348c97df44 382 #define CEC_FLAG_LBPE CEC_ISR_LBPE
lypinator 0:bb348c97df44 383 #define CEC_FLAG_SBPE CEC_ISR_SBPE
lypinator 0:bb348c97df44 384 #define CEC_FLAG_BRE CEC_ISR_BRE
lypinator 0:bb348c97df44 385 #define CEC_FLAG_RXOVR CEC_ISR_RXOVR
lypinator 0:bb348c97df44 386 #define CEC_FLAG_RXEND CEC_ISR_RXEND
lypinator 0:bb348c97df44 387 #define CEC_FLAG_RXBR CEC_ISR_RXBR
lypinator 0:bb348c97df44 388 /**
lypinator 0:bb348c97df44 389 * @}
lypinator 0:bb348c97df44 390 */
lypinator 0:bb348c97df44 391
lypinator 0:bb348c97df44 392 /** @defgroup CEC_ALL_ERROR CEC all RX or TX errors flags
lypinator 0:bb348c97df44 393 * @{
lypinator 0:bb348c97df44 394 */
lypinator 0:bb348c97df44 395 #define CEC_ISR_ALL_ERROR ((uint32_t)CEC_ISR_RXOVR|CEC_ISR_BRE|CEC_ISR_SBPE|CEC_ISR_LBPE|CEC_ISR_RXACKE|\
lypinator 0:bb348c97df44 396 CEC_ISR_ARBLST|CEC_ISR_TXUDR|CEC_ISR_TXERR|CEC_ISR_TXACKE)
lypinator 0:bb348c97df44 397 /**
lypinator 0:bb348c97df44 398 * @}
lypinator 0:bb348c97df44 399 */
lypinator 0:bb348c97df44 400
lypinator 0:bb348c97df44 401 /** @defgroup CEC_IER_ALL_RX CEC all RX errors interrupts enabling flag
lypinator 0:bb348c97df44 402 * @{
lypinator 0:bb348c97df44 403 */
lypinator 0:bb348c97df44 404 #define CEC_IER_RX_ALL_ERR ((uint32_t)CEC_IER_RXACKEIE|CEC_IER_LBPEIE|CEC_IER_SBPEIE|CEC_IER_BREIE|CEC_IER_RXOVRIE)
lypinator 0:bb348c97df44 405 /**
lypinator 0:bb348c97df44 406 * @}
lypinator 0:bb348c97df44 407 */
lypinator 0:bb348c97df44 408
lypinator 0:bb348c97df44 409 /** @defgroup CEC_IER_ALL_TX CEC all TX errors interrupts enabling flag
lypinator 0:bb348c97df44 410 * @{
lypinator 0:bb348c97df44 411 */
lypinator 0:bb348c97df44 412 #define CEC_IER_TX_ALL_ERR ((uint32_t)CEC_IER_TXACKEIE|CEC_IER_TXERRIE|CEC_IER_TXUDRIE|CEC_IER_ARBLSTIE)
lypinator 0:bb348c97df44 413 /**
lypinator 0:bb348c97df44 414 * @}
lypinator 0:bb348c97df44 415 */
lypinator 0:bb348c97df44 416
lypinator 0:bb348c97df44 417 /**
lypinator 0:bb348c97df44 418 * @}
lypinator 0:bb348c97df44 419 */
lypinator 0:bb348c97df44 420
lypinator 0:bb348c97df44 421 /* Exported macros -----------------------------------------------------------*/
lypinator 0:bb348c97df44 422 /** @defgroup CEC_Exported_Macros CEC Exported Macros
lypinator 0:bb348c97df44 423 * @{
lypinator 0:bb348c97df44 424 */
lypinator 0:bb348c97df44 425
lypinator 0:bb348c97df44 426 /** @brief Reset CEC handle gstate & RxState
lypinator 0:bb348c97df44 427 * @param __HANDLE__ CEC handle.
lypinator 0:bb348c97df44 428 * @retval None
lypinator 0:bb348c97df44 429 */
lypinator 0:bb348c97df44 430 #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{ \
lypinator 0:bb348c97df44 431 (__HANDLE__)->gState = HAL_CEC_STATE_RESET; \
lypinator 0:bb348c97df44 432 (__HANDLE__)->RxState = HAL_CEC_STATE_RESET; \
lypinator 0:bb348c97df44 433 } while(0)
lypinator 0:bb348c97df44 434
lypinator 0:bb348c97df44 435 /** @brief Checks whether or not the specified CEC interrupt flag is set.
lypinator 0:bb348c97df44 436 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 437 * @param __FLAG__ specifies the flag to check.
lypinator 0:bb348c97df44 438 * @arg CEC_FLAG_TXACKE: Tx Missing acknowledge Error
lypinator 0:bb348c97df44 439 * @arg CEC_FLAG_TXERR: Tx Error.
lypinator 0:bb348c97df44 440 * @arg CEC_FLAG_TXUDR: Tx-Buffer Underrun.
lypinator 0:bb348c97df44 441 * @arg CEC_FLAG_TXEND: End of transmission (successful transmission of the last byte).
lypinator 0:bb348c97df44 442 * @arg CEC_FLAG_TXBR: Tx-Byte Request.
lypinator 0:bb348c97df44 443 * @arg CEC_FLAG_ARBLST: Arbitration Lost
lypinator 0:bb348c97df44 444 * @arg CEC_FLAG_RXACKE: Rx-Missing Acknowledge
lypinator 0:bb348c97df44 445 * @arg CEC_FLAG_LBPE: Rx Long period Error
lypinator 0:bb348c97df44 446 * @arg CEC_FLAG_SBPE: Rx Short period Error
lypinator 0:bb348c97df44 447 * @arg CEC_FLAG_BRE: Rx Bit Rising Error
lypinator 0:bb348c97df44 448 * @arg CEC_FLAG_RXOVR: Rx Overrun.
lypinator 0:bb348c97df44 449 * @arg CEC_FLAG_RXEND: End Of Reception.
lypinator 0:bb348c97df44 450 * @arg CEC_FLAG_RXBR: Rx-Byte Received.
lypinator 0:bb348c97df44 451 * @retval ITStatus
lypinator 0:bb348c97df44 452 */
lypinator 0:bb348c97df44 453 #define __HAL_CEC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__))
lypinator 0:bb348c97df44 454
lypinator 0:bb348c97df44 455 /** @brief Clears the interrupt or status flag when raised (write at 1)
lypinator 0:bb348c97df44 456 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 457 * @param __FLAG__ specifies the interrupt/status flag to clear.
lypinator 0:bb348c97df44 458 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 459 * @arg CEC_FLAG_TXACKE: Tx Missing acknowledge Error
lypinator 0:bb348c97df44 460 * @arg CEC_FLAG_TXERR: Tx Error.
lypinator 0:bb348c97df44 461 * @arg CEC_FLAG_TXUDR: Tx-Buffer Underrun.
lypinator 0:bb348c97df44 462 * @arg CEC_FLAG_TXEND: End of transmission (successful transmission of the last byte).
lypinator 0:bb348c97df44 463 * @arg CEC_FLAG_TXBR: Tx-Byte Request.
lypinator 0:bb348c97df44 464 * @arg CEC_FLAG_ARBLST: Arbitration Lost
lypinator 0:bb348c97df44 465 * @arg CEC_FLAG_RXACKE: Rx-Missing Acknowledge
lypinator 0:bb348c97df44 466 * @arg CEC_FLAG_LBPE: Rx Long period Error
lypinator 0:bb348c97df44 467 * @arg CEC_FLAG_SBPE: Rx Short period Error
lypinator 0:bb348c97df44 468 * @arg CEC_FLAG_BRE: Rx Bit Rising Error
lypinator 0:bb348c97df44 469 * @arg CEC_FLAG_RXOVR: Rx Overrun.
lypinator 0:bb348c97df44 470 * @arg CEC_FLAG_RXEND: End Of Reception.
lypinator 0:bb348c97df44 471 * @arg CEC_FLAG_RXBR: Rx-Byte Received.
lypinator 0:bb348c97df44 472 * @retval none
lypinator 0:bb348c97df44 473 */
lypinator 0:bb348c97df44 474 #define __HAL_CEC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR |= (__FLAG__))
lypinator 0:bb348c97df44 475
lypinator 0:bb348c97df44 476 /** @brief Enables the specified CEC interrupt.
lypinator 0:bb348c97df44 477 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 478 * @param __INTERRUPT__ specifies the CEC interrupt to enable.
lypinator 0:bb348c97df44 479 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 480 * @arg CEC_IT_TXACKE: Tx Missing acknowledge Error IT Enable
lypinator 0:bb348c97df44 481 * @arg CEC_IT_TXERR: Tx Error IT Enable
lypinator 0:bb348c97df44 482 * @arg CEC_IT_TXUDR: Tx-Buffer Underrun IT Enable
lypinator 0:bb348c97df44 483 * @arg CEC_IT_TXEND: End of transmission IT Enable
lypinator 0:bb348c97df44 484 * @arg CEC_IT_TXBR: Tx-Byte Request IT Enable
lypinator 0:bb348c97df44 485 * @arg CEC_IT_ARBLST: Arbitration Lost IT Enable
lypinator 0:bb348c97df44 486 * @arg CEC_IT_RXACKE: Rx-Missing Acknowledge IT Enable
lypinator 0:bb348c97df44 487 * @arg CEC_IT_LBPE: Rx Long period Error IT Enable
lypinator 0:bb348c97df44 488 * @arg CEC_IT_SBPE: Rx Short period Error IT Enable
lypinator 0:bb348c97df44 489 * @arg CEC_IT_BRE: Rx Bit Rising Error IT Enable
lypinator 0:bb348c97df44 490 * @arg CEC_IT_RXOVR: Rx Overrun IT Enable
lypinator 0:bb348c97df44 491 * @arg CEC_IT_RXEND: End Of Reception IT Enable
lypinator 0:bb348c97df44 492 * @arg CEC_IT_RXBR: Rx-Byte Received IT Enable
lypinator 0:bb348c97df44 493 * @retval none
lypinator 0:bb348c97df44 494 */
lypinator 0:bb348c97df44 495 #define __HAL_CEC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
lypinator 0:bb348c97df44 496
lypinator 0:bb348c97df44 497 /** @brief Disables the specified CEC interrupt.
lypinator 0:bb348c97df44 498 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 499 * @param __INTERRUPT__ specifies the CEC interrupt to disable.
lypinator 0:bb348c97df44 500 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 501 * @arg CEC_IT_TXACKE: Tx Missing acknowledge Error IT Enable
lypinator 0:bb348c97df44 502 * @arg CEC_IT_TXERR: Tx Error IT Enable
lypinator 0:bb348c97df44 503 * @arg CEC_IT_TXUDR: Tx-Buffer Underrun IT Enable
lypinator 0:bb348c97df44 504 * @arg CEC_IT_TXEND: End of transmission IT Enable
lypinator 0:bb348c97df44 505 * @arg CEC_IT_TXBR: Tx-Byte Request IT Enable
lypinator 0:bb348c97df44 506 * @arg CEC_IT_ARBLST: Arbitration Lost IT Enable
lypinator 0:bb348c97df44 507 * @arg CEC_IT_RXACKE: Rx-Missing Acknowledge IT Enable
lypinator 0:bb348c97df44 508 * @arg CEC_IT_LBPE: Rx Long period Error IT Enable
lypinator 0:bb348c97df44 509 * @arg CEC_IT_SBPE: Rx Short period Error IT Enable
lypinator 0:bb348c97df44 510 * @arg CEC_IT_BRE: Rx Bit Rising Error IT Enable
lypinator 0:bb348c97df44 511 * @arg CEC_IT_RXOVR: Rx Overrun IT Enable
lypinator 0:bb348c97df44 512 * @arg CEC_IT_RXEND: End Of Reception IT Enable
lypinator 0:bb348c97df44 513 * @arg CEC_IT_RXBR: Rx-Byte Received IT Enable
lypinator 0:bb348c97df44 514 * @retval none
lypinator 0:bb348c97df44 515 */
lypinator 0:bb348c97df44 516 #define __HAL_CEC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__)))
lypinator 0:bb348c97df44 517
lypinator 0:bb348c97df44 518 /** @brief Checks whether or not the specified CEC interrupt is enabled.
lypinator 0:bb348c97df44 519 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 520 * @param __INTERRUPT__ specifies the CEC interrupt to check.
lypinator 0:bb348c97df44 521 * This parameter can be one of the following values:
lypinator 0:bb348c97df44 522 * @arg CEC_IT_TXACKE: Tx Missing acknowledge Error IT Enable
lypinator 0:bb348c97df44 523 * @arg CEC_IT_TXERR: Tx Error IT Enable
lypinator 0:bb348c97df44 524 * @arg CEC_IT_TXUDR: Tx-Buffer Underrun IT Enable
lypinator 0:bb348c97df44 525 * @arg CEC_IT_TXEND: End of transmission IT Enable
lypinator 0:bb348c97df44 526 * @arg CEC_IT_TXBR: Tx-Byte Request IT Enable
lypinator 0:bb348c97df44 527 * @arg CEC_IT_ARBLST: Arbitration Lost IT Enable
lypinator 0:bb348c97df44 528 * @arg CEC_IT_RXACKE: Rx-Missing Acknowledge IT Enable
lypinator 0:bb348c97df44 529 * @arg CEC_IT_LBPE: Rx Long period Error IT Enable
lypinator 0:bb348c97df44 530 * @arg CEC_IT_SBPE: Rx Short period Error IT Enable
lypinator 0:bb348c97df44 531 * @arg CEC_IT_BRE: Rx Bit Rising Error IT Enable
lypinator 0:bb348c97df44 532 * @arg CEC_IT_RXOVR: Rx Overrun IT Enable
lypinator 0:bb348c97df44 533 * @arg CEC_IT_RXEND: End Of Reception IT Enable
lypinator 0:bb348c97df44 534 * @arg CEC_IT_RXBR: Rx-Byte Received IT Enable
lypinator 0:bb348c97df44 535 * @retval FlagStatus
lypinator 0:bb348c97df44 536 */
lypinator 0:bb348c97df44 537 #define __HAL_CEC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER & (__INTERRUPT__))
lypinator 0:bb348c97df44 538
lypinator 0:bb348c97df44 539 /** @brief Enables the CEC device
lypinator 0:bb348c97df44 540 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 541 * @retval none
lypinator 0:bb348c97df44 542 */
lypinator 0:bb348c97df44 543 #define __HAL_CEC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_CECEN)
lypinator 0:bb348c97df44 544
lypinator 0:bb348c97df44 545 /** @brief Disables the CEC device
lypinator 0:bb348c97df44 546 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 547 * @retval none
lypinator 0:bb348c97df44 548 */
lypinator 0:bb348c97df44 549 #define __HAL_CEC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~CEC_CR_CECEN)
lypinator 0:bb348c97df44 550
lypinator 0:bb348c97df44 551 /** @brief Set Transmission Start flag
lypinator 0:bb348c97df44 552 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 553 * @retval none
lypinator 0:bb348c97df44 554 */
lypinator 0:bb348c97df44 555 #define __HAL_CEC_FIRST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXSOM)
lypinator 0:bb348c97df44 556
lypinator 0:bb348c97df44 557 /** @brief Set Transmission End flag
lypinator 0:bb348c97df44 558 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 559 * @retval none
lypinator 0:bb348c97df44 560 * If the CEC message consists of only one byte, TXEOM must be set before of TXSOM.
lypinator 0:bb348c97df44 561 */
lypinator 0:bb348c97df44 562 #define __HAL_CEC_LAST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXEOM)
lypinator 0:bb348c97df44 563
lypinator 0:bb348c97df44 564 /** @brief Get Transmission Start flag
lypinator 0:bb348c97df44 565 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 566 * @retval FlagStatus
lypinator 0:bb348c97df44 567 */
lypinator 0:bb348c97df44 568 #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXSOM)
lypinator 0:bb348c97df44 569
lypinator 0:bb348c97df44 570 /** @brief Get Transmission End flag
lypinator 0:bb348c97df44 571 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 572 * @retval FlagStatus
lypinator 0:bb348c97df44 573 */
lypinator 0:bb348c97df44 574 #define __HAL_CEC_GET_TRANSMISSION_END_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXEOM)
lypinator 0:bb348c97df44 575
lypinator 0:bb348c97df44 576 /** @brief Clear OAR register
lypinator 0:bb348c97df44 577 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 578 * @retval none
lypinator 0:bb348c97df44 579 */
lypinator 0:bb348c97df44 580 #define __HAL_CEC_CLEAR_OAR(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_OAR)
lypinator 0:bb348c97df44 581
lypinator 0:bb348c97df44 582 /** @brief Set OAR register (without resetting previously set address in case of multi-address mode)
lypinator 0:bb348c97df44 583 * To reset OAR, __HAL_CEC_CLEAR_OAR() needs to be called beforehand
lypinator 0:bb348c97df44 584 * @param __HANDLE__ specifies the CEC Handle.
lypinator 0:bb348c97df44 585 * @param __ADDRESS__ Own Address value (CEC logical address is identified by bit position)
lypinator 0:bb348c97df44 586 * @retval none
lypinator 0:bb348c97df44 587 */
lypinator 0:bb348c97df44 588 #define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) SET_BIT((__HANDLE__)->Instance->CFGR, (__ADDRESS__)<< CEC_CFGR_OAR_LSB_POS)
lypinator 0:bb348c97df44 589
lypinator 0:bb348c97df44 590 /**
lypinator 0:bb348c97df44 591 * @}
lypinator 0:bb348c97df44 592 */
lypinator 0:bb348c97df44 593
lypinator 0:bb348c97df44 594 /* Exported functions --------------------------------------------------------*/
lypinator 0:bb348c97df44 595 /** @addtogroup CEC_Exported_Functions
lypinator 0:bb348c97df44 596 * @{
lypinator 0:bb348c97df44 597 */
lypinator 0:bb348c97df44 598
lypinator 0:bb348c97df44 599 /** @addtogroup CEC_Exported_Functions_Group1
lypinator 0:bb348c97df44 600 * @{
lypinator 0:bb348c97df44 601 */
lypinator 0:bb348c97df44 602 /* Initialization and de-initialization functions ****************************/
lypinator 0:bb348c97df44 603 HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec);
lypinator 0:bb348c97df44 604 HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec);
lypinator 0:bb348c97df44 605 HAL_StatusTypeDef HAL_CEC_SetDeviceAddress(CEC_HandleTypeDef *hcec, uint16_t CEC_OwnAddress);
lypinator 0:bb348c97df44 606 void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec);
lypinator 0:bb348c97df44 607 void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec);
lypinator 0:bb348c97df44 608 /**
lypinator 0:bb348c97df44 609 * @}
lypinator 0:bb348c97df44 610 */
lypinator 0:bb348c97df44 611
lypinator 0:bb348c97df44 612 /** @addtogroup CEC_Exported_Functions_Group2
lypinator 0:bb348c97df44 613 * @{
lypinator 0:bb348c97df44 614 */
lypinator 0:bb348c97df44 615 /* I/O operation functions ***************************************************/
lypinator 0:bb348c97df44 616 HAL_StatusTypeDef HAL_CEC_Transmit_IT(CEC_HandleTypeDef *hcec, uint8_t InitiatorAddress,uint8_t DestinationAddress, uint8_t *pData, uint32_t Size);
lypinator 0:bb348c97df44 617 uint32_t HAL_CEC_GetLastReceivedFrameSize(CEC_HandleTypeDef *hcec);
lypinator 0:bb348c97df44 618 void HAL_CEC_ChangeRxBuffer(CEC_HandleTypeDef *hcec, uint8_t* Rxbuffer);
lypinator 0:bb348c97df44 619 void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec);
lypinator 0:bb348c97df44 620 void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec);
lypinator 0:bb348c97df44 621 void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec, uint32_t RxFrameSize);
lypinator 0:bb348c97df44 622 void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec);
lypinator 0:bb348c97df44 623 /**
lypinator 0:bb348c97df44 624 * @}
lypinator 0:bb348c97df44 625 */
lypinator 0:bb348c97df44 626
lypinator 0:bb348c97df44 627 /** @addtogroup CEC_Exported_Functions_Group3
lypinator 0:bb348c97df44 628 * @{
lypinator 0:bb348c97df44 629 */
lypinator 0:bb348c97df44 630 /* Peripheral State functions ************************************************/
lypinator 0:bb348c97df44 631 HAL_CEC_StateTypeDef HAL_CEC_GetState(CEC_HandleTypeDef *hcec);
lypinator 0:bb348c97df44 632 uint32_t HAL_CEC_GetError(CEC_HandleTypeDef *hcec);
lypinator 0:bb348c97df44 633 /**
lypinator 0:bb348c97df44 634 * @}
lypinator 0:bb348c97df44 635 */
lypinator 0:bb348c97df44 636
lypinator 0:bb348c97df44 637 /**
lypinator 0:bb348c97df44 638 * @}
lypinator 0:bb348c97df44 639 */
lypinator 0:bb348c97df44 640
lypinator 0:bb348c97df44 641 /* Private types -------------------------------------------------------------*/
lypinator 0:bb348c97df44 642 /** @defgroup CEC_Private_Types CEC Private Types
lypinator 0:bb348c97df44 643 * @{
lypinator 0:bb348c97df44 644 */
lypinator 0:bb348c97df44 645
lypinator 0:bb348c97df44 646 /**
lypinator 0:bb348c97df44 647 * @}
lypinator 0:bb348c97df44 648 */
lypinator 0:bb348c97df44 649
lypinator 0:bb348c97df44 650 /* Private variables ---------------------------------------------------------*/
lypinator 0:bb348c97df44 651 /** @defgroup CEC_Private_Variables CEC Private Variables
lypinator 0:bb348c97df44 652 * @{
lypinator 0:bb348c97df44 653 */
lypinator 0:bb348c97df44 654
lypinator 0:bb348c97df44 655 /**
lypinator 0:bb348c97df44 656 * @}
lypinator 0:bb348c97df44 657 */
lypinator 0:bb348c97df44 658
lypinator 0:bb348c97df44 659 /* Private constants ---------------------------------------------------------*/
lypinator 0:bb348c97df44 660 /** @defgroup CEC_Private_Constants CEC Private Constants
lypinator 0:bb348c97df44 661 * @{
lypinator 0:bb348c97df44 662 */
lypinator 0:bb348c97df44 663
lypinator 0:bb348c97df44 664 /**
lypinator 0:bb348c97df44 665 * @}
lypinator 0:bb348c97df44 666 */
lypinator 0:bb348c97df44 667
lypinator 0:bb348c97df44 668 /* Private macros ------------------------------------------------------------*/
lypinator 0:bb348c97df44 669 /** @defgroup CEC_Private_Macros CEC Private Macros
lypinator 0:bb348c97df44 670 * @{
lypinator 0:bb348c97df44 671 */
lypinator 0:bb348c97df44 672
lypinator 0:bb348c97df44 673 #define IS_CEC_SIGNALFREETIME(__SFT__) ((__SFT__) <= CEC_CFGR_SFT)
lypinator 0:bb348c97df44 674
lypinator 0:bb348c97df44 675 #define IS_CEC_TOLERANCE(__RXTOL__) (((__RXTOL__) == CEC_STANDARD_TOLERANCE) || \
lypinator 0:bb348c97df44 676 ((__RXTOL__) == CEC_EXTENDED_TOLERANCE))
lypinator 0:bb348c97df44 677
lypinator 0:bb348c97df44 678 #define IS_CEC_BRERXSTOP(__BRERXSTOP__) (((__BRERXSTOP__) == CEC_NO_RX_STOP_ON_BRE) || \
lypinator 0:bb348c97df44 679 ((__BRERXSTOP__) == CEC_RX_STOP_ON_BRE))
lypinator 0:bb348c97df44 680
lypinator 0:bb348c97df44 681 #define IS_CEC_BREERRORBITGEN(__ERRORBITGEN__) (((__ERRORBITGEN__) == CEC_BRE_ERRORBIT_NO_GENERATION) || \
lypinator 0:bb348c97df44 682 ((__ERRORBITGEN__) == CEC_BRE_ERRORBIT_GENERATION))
lypinator 0:bb348c97df44 683
lypinator 0:bb348c97df44 684 #define IS_CEC_LBPEERRORBITGEN(__ERRORBITGEN__) (((__ERRORBITGEN__) == CEC_LBPE_ERRORBIT_NO_GENERATION) || \
lypinator 0:bb348c97df44 685 ((__ERRORBITGEN__) == CEC_LBPE_ERRORBIT_GENERATION))
lypinator 0:bb348c97df44 686
lypinator 0:bb348c97df44 687 #define IS_CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION(__ERRORBITGEN__) (((__ERRORBITGEN__) == CEC_BROADCASTERROR_ERRORBIT_GENERATION) || \
lypinator 0:bb348c97df44 688 ((__ERRORBITGEN__) == CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION))
lypinator 0:bb348c97df44 689
lypinator 0:bb348c97df44 690 #define IS_CEC_SFTOP(__SFTOP__) (((__SFTOP__) == CEC_SFT_START_ON_TXSOM) || \
lypinator 0:bb348c97df44 691 ((__SFTOP__) == CEC_SFT_START_ON_TX_RX_END))
lypinator 0:bb348c97df44 692
lypinator 0:bb348c97df44 693 #define IS_CEC_LISTENING_MODE(__MODE__) (((__MODE__) == CEC_REDUCED_LISTENING_MODE) || \
lypinator 0:bb348c97df44 694 ((__MODE__) == CEC_FULL_LISTENING_MODE))
lypinator 0:bb348c97df44 695
lypinator 0:bb348c97df44 696 /** @brief Check CEC message size.
lypinator 0:bb348c97df44 697 * The message size is the payload size: without counting the header,
lypinator 0:bb348c97df44 698 * it varies from 0 byte (ping operation, one header only, no payload) to
lypinator 0:bb348c97df44 699 * 15 bytes (1 opcode and up to 14 operands following the header).
lypinator 0:bb348c97df44 700 * @param __SIZE__ CEC message size.
lypinator 0:bb348c97df44 701 * @retval Test result (TRUE or FALSE).
lypinator 0:bb348c97df44 702 */
lypinator 0:bb348c97df44 703 #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0x10U)
lypinator 0:bb348c97df44 704
lypinator 0:bb348c97df44 705 /** @brief Check CEC device Own Address Register (OAR) setting.
lypinator 0:bb348c97df44 706 * OAR address is written in a 15-bit field within CEC_CFGR register.
lypinator 0:bb348c97df44 707 * @param __ADDRESS__ CEC own address.
lypinator 0:bb348c97df44 708 * @retval Test result (TRUE or FALSE).
lypinator 0:bb348c97df44 709 */
lypinator 0:bb348c97df44 710 #define IS_CEC_OWN_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x7FFFU)
lypinator 0:bb348c97df44 711
lypinator 0:bb348c97df44 712 /** @brief Check CEC initiator or destination logical address setting.
lypinator 0:bb348c97df44 713 * Initiator and destination addresses are coded over 4 bits.
lypinator 0:bb348c97df44 714 * @param __ADDRESS__ CEC initiator or logical address.
lypinator 0:bb348c97df44 715 * @retval Test result (TRUE or FALSE).
lypinator 0:bb348c97df44 716 */
lypinator 0:bb348c97df44 717 #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x0FU)
lypinator 0:bb348c97df44 718 /**
lypinator 0:bb348c97df44 719 * @}
lypinator 0:bb348c97df44 720 */
lypinator 0:bb348c97df44 721 /* Private functions ---------------------------------------------------------*/
lypinator 0:bb348c97df44 722 /** @defgroup CEC_Private_Functions CEC Private Functions
lypinator 0:bb348c97df44 723 * @{
lypinator 0:bb348c97df44 724 */
lypinator 0:bb348c97df44 725
lypinator 0:bb348c97df44 726 /**
lypinator 0:bb348c97df44 727 * @}
lypinator 0:bb348c97df44 728 */
lypinator 0:bb348c97df44 729
lypinator 0:bb348c97df44 730 /**
lypinator 0:bb348c97df44 731 * @}
lypinator 0:bb348c97df44 732 */
lypinator 0:bb348c97df44 733
lypinator 0:bb348c97df44 734 /**
lypinator 0:bb348c97df44 735 * @}
lypinator 0:bb348c97df44 736 */
lypinator 0:bb348c97df44 737 #endif /* STM32F446xx */
lypinator 0:bb348c97df44 738
lypinator 0:bb348c97df44 739 #ifdef __cplusplus
lypinator 0:bb348c97df44 740 }
lypinator 0:bb348c97df44 741 #endif
lypinator 0:bb348c97df44 742
lypinator 0:bb348c97df44 743 #endif /* __STM32F4xx_HAL_CEC_H */
lypinator 0:bb348c97df44 744
lypinator 0:bb348c97df44 745 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/