mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Tue Mar 15 14:34:00 2016 +0000
Revision:
116:c0f6e94411f5
Parent:
107:4f6c30876dfa
Child:
122:f9eeca106725
Release 116 of the mbed library

Changes:
- new targets - NUCLEO_L073RZ
- fixes to IOTSS BEID platform
- LPC824, LPC1549 and LPC11U68 - fix PWMOut SCT bugs
- STM32F7 - Cube driver
- STM32F4 - add RTC LSI macro, defined as 0
- STM32F3 - fix multiple ADC clock initialization
- retarget - binary mode fix for GCC

Who changed what in which revision?

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