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:
108:34e6b704fe68
.

Who changed what in which revision?

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