The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Kojto
Date:
Fri Aug 12 13:04:35 2016 +0200
Revision:
123:b0220dba8be7
Parent:
122:f9eeca106725
Release 123 of the mbed library

Changes:
- new targets: nucleo_f207zg, beetle, nrf51_dk, hexiwear,
nuvoton nuc472, vk rz a1h
- ST - fix timer interrupt handler, sleep api fix
- NXP - lpc15xx us ticker fix
- Nordic - analogin fixes, LF clock init addition, enable i2c async

Who changed what in which revision?

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