Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
109:9296ab0bfc11
.

Who changed what in which revision?

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