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:
Kojto
Date:
Tue Feb 03 15:31:20 2015 +0000
Revision:
93:e188a91d3eaa
Child:
108:34e6b704fe68
Release 93 of the mbed library

Main changes:

- Renesas RZ_A1H bugfixes - i2c, ticker
- new targets - Nucleo F303RE, Nucleo F070RB, BLE SMURFS,
Dragonfly 411RE,
- BusXXX - is connected method, plus operators addition
- LPC8xx - I2c fixes
- timestamp_t reverted to uint32_t
- RTX - fixes regarding stack (alignment, magic word)

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 93:e188a91d3eaa 5 * @version V1.2.0
Kojto 93:e188a91d3eaa 6 * @date 11-December-2014
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 93:e188a91d3eaa 11 * <h2><center>&copy; COPYRIGHT(c) 2014 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 93:e188a91d3eaa 57 /** @addtogroup CEC CEC HAL Module Driver
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 HAL Error structures definition
Kojto 93:e188a91d3eaa 148 */
Kojto 93:e188a91d3eaa 149 typedef enum
Kojto 93:e188a91d3eaa 150 {
Kojto 93:e188a91d3eaa 151 HAL_CEC_ERROR_NONE = (uint32_t) 0x0, /*!< no error */
Kojto 93:e188a91d3eaa 152 HAL_CEC_ERROR_RXOVR = CEC_ISR_RXOVR, /*!< CEC Rx-Overrun */
Kojto 93:e188a91d3eaa 153 HAL_CEC_ERROR_BRE = CEC_ISR_BRE, /*!< CEC Rx Bit Rising Error */
Kojto 93:e188a91d3eaa 154 HAL_CEC_ERROR_SBPE = CEC_ISR_SBPE, /*!< CEC Rx Short Bit period Error */
Kojto 93:e188a91d3eaa 155 HAL_CEC_ERROR_LBPE = CEC_ISR_LBPE, /*!< CEC Rx Long Bit period Error */
Kojto 93:e188a91d3eaa 156 HAL_CEC_ERROR_RXACKE = CEC_ISR_RXACKE, /*!< CEC Rx Missing Acknowledge */
Kojto 93:e188a91d3eaa 157 HAL_CEC_ERROR_ARBLST = CEC_ISR_ARBLST, /*!< CEC Arbitration Lost */
Kojto 93:e188a91d3eaa 158 HAL_CEC_ERROR_TXUDR = CEC_ISR_TXUDR, /*!< CEC Tx-Buffer Underrun */
Kojto 93:e188a91d3eaa 159 HAL_CEC_ERROR_TXERR = CEC_ISR_TXERR, /*!< CEC Tx-Error */
Kojto 93:e188a91d3eaa 160 HAL_CEC_ERROR_TXACKE = CEC_ISR_TXACKE /*!< CEC Tx Missing Acknowledge */
Kojto 93:e188a91d3eaa 161 }
Kojto 93:e188a91d3eaa 162 HAL_CEC_ErrorTypeDef;
Kojto 93:e188a91d3eaa 163
Kojto 93:e188a91d3eaa 164 /**
Kojto 93:e188a91d3eaa 165 * @brief CEC handle Structure definition
Kojto 93:e188a91d3eaa 166 */
Kojto 93:e188a91d3eaa 167 typedef struct
Kojto 93:e188a91d3eaa 168 {
Kojto 93:e188a91d3eaa 169 CEC_TypeDef *Instance; /* CEC registers base address */
Kojto 93:e188a91d3eaa 170
Kojto 93:e188a91d3eaa 171 CEC_InitTypeDef Init; /* CEC communication parameters */
Kojto 93:e188a91d3eaa 172
Kojto 93:e188a91d3eaa 173 uint8_t *pTxBuffPtr; /* Pointer to CEC Tx transfer Buffer */
Kojto 93:e188a91d3eaa 174
Kojto 93:e188a91d3eaa 175 uint16_t TxXferCount; /* CEC Tx Transfer Counter */
Kojto 93:e188a91d3eaa 176
Kojto 93:e188a91d3eaa 177 uint8_t *pRxBuffPtr; /* Pointer to CEC Rx transfer Buffer */
Kojto 93:e188a91d3eaa 178
Kojto 93:e188a91d3eaa 179 uint16_t RxXferSize; /* CEC Rx Transfer size, 0: header received only */
Kojto 93:e188a91d3eaa 180
Kojto 93:e188a91d3eaa 181 __IO uint32_t ErrorCode; /* For errors handling purposes, copy of ISR register
Kojto 93:e188a91d3eaa 182 in case error is reported */
Kojto 93:e188a91d3eaa 183
Kojto 93:e188a91d3eaa 184 HAL_LockTypeDef Lock; /* Locking object */
Kojto 93:e188a91d3eaa 185
Kojto 93:e188a91d3eaa 186 HAL_CEC_StateTypeDef State; /* CEC communication state */
Kojto 93:e188a91d3eaa 187
Kojto 93:e188a91d3eaa 188 }CEC_HandleTypeDef;
Kojto 93:e188a91d3eaa 189 /**
Kojto 93:e188a91d3eaa 190 * @}
Kojto 93:e188a91d3eaa 191 */
Kojto 93:e188a91d3eaa 192
Kojto 93:e188a91d3eaa 193 /* Exported constants --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 194 /** @defgroup CEC_Exported_Constants CEC Exported Constants
Kojto 93:e188a91d3eaa 195 * @{
Kojto 93:e188a91d3eaa 196 */
Kojto 93:e188a91d3eaa 197
Kojto 93:e188a91d3eaa 198 /** @defgroup CEC_Signal_Free_Time Signal Free Time setting parameter
Kojto 93:e188a91d3eaa 199 * @{
Kojto 93:e188a91d3eaa 200 */
Kojto 93:e188a91d3eaa 201 #define CEC_DEFAULT_SFT ((uint32_t)0x00000000)
Kojto 93:e188a91d3eaa 202 #define CEC_0_5_BITPERIOD_SFT ((uint32_t)0x00000001)
Kojto 93:e188a91d3eaa 203 #define CEC_1_5_BITPERIOD_SFT ((uint32_t)0x00000002)
Kojto 93:e188a91d3eaa 204 #define CEC_2_5_BITPERIOD_SFT ((uint32_t)0x00000003)
Kojto 93:e188a91d3eaa 205 #define CEC_3_5_BITPERIOD_SFT ((uint32_t)0x00000004)
Kojto 93:e188a91d3eaa 206 #define CEC_4_5_BITPERIOD_SFT ((uint32_t)0x00000005)
Kojto 93:e188a91d3eaa 207 #define CEC_5_5_BITPERIOD_SFT ((uint32_t)0x00000006)
Kojto 93:e188a91d3eaa 208 #define CEC_6_5_BITPERIOD_SFT ((uint32_t)0x00000007)
Kojto 93:e188a91d3eaa 209 #define IS_CEC_SIGNALFREETIME(SFT) ((SFT) <= CEC_CFGR_SFT)
Kojto 93:e188a91d3eaa 210 /**
Kojto 93:e188a91d3eaa 211 * @}
Kojto 93:e188a91d3eaa 212 */
Kojto 93:e188a91d3eaa 213
Kojto 93:e188a91d3eaa 214 /** @defgroup CEC_Tolerance Receiver Tolerance
Kojto 93:e188a91d3eaa 215 * @{
Kojto 93:e188a91d3eaa 216 */
Kojto 93:e188a91d3eaa 217 #define CEC_STANDARD_TOLERANCE ((uint32_t)0x00000000)
Kojto 93:e188a91d3eaa 218 #define CEC_EXTENDED_TOLERANCE ((uint32_t)CEC_CFGR_RXTOL)
Kojto 93:e188a91d3eaa 219 #define IS_CEC_TOLERANCE(RXTOL) (((RXTOL) == CEC_STANDARD_TOLERANCE) || \
Kojto 93:e188a91d3eaa 220 ((RXTOL) == CEC_EXTENDED_TOLERANCE))
Kojto 93:e188a91d3eaa 221 /**
Kojto 93:e188a91d3eaa 222 * @}
Kojto 93:e188a91d3eaa 223 */
Kojto 93:e188a91d3eaa 224
Kojto 93:e188a91d3eaa 225 /** @defgroup CEC_BRERxStop Reception Stop on Error
Kojto 93:e188a91d3eaa 226 * @{
Kojto 93:e188a91d3eaa 227 */
Kojto 93:e188a91d3eaa 228 #define CEC_NO_RX_STOP_ON_BRE ((uint32_t)0x00000000)
Kojto 93:e188a91d3eaa 229 #define CEC_RX_STOP_ON_BRE ((uint32_t)CEC_CFGR_BRESTP)
Kojto 93:e188a91d3eaa 230 #define IS_CEC_BRERXSTOP(BRERXSTOP) (((BRERXSTOP) == CEC_NO_RX_STOP_ON_BRE) || \
Kojto 93:e188a91d3eaa 231 ((BRERXSTOP) == CEC_RX_STOP_ON_BRE))
Kojto 93:e188a91d3eaa 232 /**
Kojto 93:e188a91d3eaa 233 * @}
Kojto 93:e188a91d3eaa 234 */
Kojto 93:e188a91d3eaa 235
Kojto 93:e188a91d3eaa 236 /** @defgroup CEC_BREErrorBitGen Error Bit Generation if Bit Rise Error reported
Kojto 93:e188a91d3eaa 237 * @{
Kojto 93:e188a91d3eaa 238 */
Kojto 93:e188a91d3eaa 239 #define CEC_BRE_ERRORBIT_NO_GENERATION ((uint32_t)0x00000000)
Kojto 93:e188a91d3eaa 240 #define CEC_BRE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BREGEN)
Kojto 93:e188a91d3eaa 241 #define IS_CEC_BREERRORBITGEN(ERRORBITGEN) (((ERRORBITGEN) == CEC_BRE_ERRORBIT_NO_GENERATION) || \
Kojto 93:e188a91d3eaa 242 ((ERRORBITGEN) == CEC_BRE_ERRORBIT_GENERATION))
Kojto 93:e188a91d3eaa 243 /**
Kojto 93:e188a91d3eaa 244 * @}
Kojto 93:e188a91d3eaa 245 */
Kojto 93:e188a91d3eaa 246
Kojto 93:e188a91d3eaa 247 /** @defgroup CEC_LBPEErrorBitGen Error Bit Generation if Long Bit Period Error reported
Kojto 93:e188a91d3eaa 248 * @{
Kojto 93:e188a91d3eaa 249 */
Kojto 93:e188a91d3eaa 250 #define CEC_LBPE_ERRORBIT_NO_GENERATION ((uint32_t)0x00000000)
Kojto 93:e188a91d3eaa 251 #define CEC_LBPE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_LBPEGEN)
Kojto 93:e188a91d3eaa 252 #define IS_CEC_LBPEERRORBITGEN(ERRORBITGEN) (((ERRORBITGEN) == CEC_LBPE_ERRORBIT_NO_GENERATION) || \
Kojto 93:e188a91d3eaa 253 ((ERRORBITGEN) == CEC_LBPE_ERRORBIT_GENERATION))
Kojto 93:e188a91d3eaa 254 /**
Kojto 93:e188a91d3eaa 255 * @}
Kojto 93:e188a91d3eaa 256 */
Kojto 93:e188a91d3eaa 257
Kojto 93:e188a91d3eaa 258 /** @defgroup CEC_BroadCastMsgErrorBitGen Error Bit Generation on Broadcast message
Kojto 93:e188a91d3eaa 259 * @{
Kojto 93:e188a91d3eaa 260 */
Kojto 93:e188a91d3eaa 261 #define CEC_BROADCASTERROR_ERRORBIT_GENERATION ((uint32_t)0x00000000)
Kojto 93:e188a91d3eaa 262 #define CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BRDNOGEN)
Kojto 93:e188a91d3eaa 263 #define IS_CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION(ERRORBITGEN) (((ERRORBITGEN) == CEC_BROADCASTERROR_ERRORBIT_GENERATION) || \
Kojto 93:e188a91d3eaa 264 ((ERRORBITGEN) == CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION))
Kojto 93:e188a91d3eaa 265 /**
Kojto 93:e188a91d3eaa 266 * @}
Kojto 93:e188a91d3eaa 267 */
Kojto 93:e188a91d3eaa 268
Kojto 93:e188a91d3eaa 269 /** @defgroup CEC_SFT_Option Signal Free Time start option
Kojto 93:e188a91d3eaa 270 * @{
Kojto 93:e188a91d3eaa 271 */
Kojto 93:e188a91d3eaa 272 #define CEC_SFT_START_ON_TXSOM ((uint32_t)0x00000000)
Kojto 93:e188a91d3eaa 273 #define CEC_SFT_START_ON_TX_RX_END ((uint32_t)CEC_CFGR_SFTOPT)
Kojto 93:e188a91d3eaa 274 #define IS_CEC_SFTOP(SFTOP) (((SFTOP) == CEC_SFT_START_ON_TXSOM) || \
Kojto 93:e188a91d3eaa 275 ((SFTOP) == CEC_SFT_START_ON_TX_RX_END))
Kojto 93:e188a91d3eaa 276 /**
Kojto 93:e188a91d3eaa 277 * @}
Kojto 93:e188a91d3eaa 278 */
Kojto 93:e188a91d3eaa 279
Kojto 93:e188a91d3eaa 280 /** @defgroup CEC_Listening_Mode Listening mode option
Kojto 93:e188a91d3eaa 281 * @{
Kojto 93:e188a91d3eaa 282 */
Kojto 93:e188a91d3eaa 283 #define CEC_REDUCED_LISTENING_MODE ((uint32_t)0x00000000)
Kojto 93:e188a91d3eaa 284 #define CEC_FULL_LISTENING_MODE ((uint32_t)CEC_CFGR_LSTN)
Kojto 93:e188a91d3eaa 285 #define IS_CEC_LISTENING_MODE(MODE) (((MODE) == CEC_REDUCED_LISTENING_MODE) || \
Kojto 93:e188a91d3eaa 286 ((MODE) == CEC_FULL_LISTENING_MODE))
Kojto 93:e188a91d3eaa 287 /**
Kojto 93:e188a91d3eaa 288 * @}
Kojto 93:e188a91d3eaa 289 */
Kojto 93:e188a91d3eaa 290
Kojto 93:e188a91d3eaa 291 /** @defgroup CEC_ALL_ERROR all RX or TX errors flags in CEC ISR register
Kojto 93:e188a91d3eaa 292 * @{
Kojto 93:e188a91d3eaa 293 */
Kojto 93:e188a91d3eaa 294 #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 295 CEC_ISR_ARBLST|CEC_ISR_TXUDR|CEC_ISR_TXERR|CEC_ISR_TXACKE)
Kojto 93:e188a91d3eaa 296 /**
Kojto 93:e188a91d3eaa 297 * @}
Kojto 93:e188a91d3eaa 298 */
Kojto 93:e188a91d3eaa 299
Kojto 93:e188a91d3eaa 300 /** @defgroup CEC_IER_ALL_RX all RX errors interrupts enabling flag
Kojto 93:e188a91d3eaa 301 * @{
Kojto 93:e188a91d3eaa 302 */
Kojto 93:e188a91d3eaa 303 #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 304 /**
Kojto 93:e188a91d3eaa 305 * @}
Kojto 93:e188a91d3eaa 306 */
Kojto 93:e188a91d3eaa 307
Kojto 93:e188a91d3eaa 308 /** @defgroup CEC_IER_ALL_TX all TX errors interrupts enabling flag
Kojto 93:e188a91d3eaa 309 * @{
Kojto 93:e188a91d3eaa 310 */
Kojto 93:e188a91d3eaa 311 #define CEC_IER_TX_ALL_ERR ((uint32_t)CEC_IER_TXACKEIE|CEC_IER_TXERRIE|CEC_IER_TXUDRIE|CEC_IER_ARBLSTIE)
Kojto 93:e188a91d3eaa 312 /**
Kojto 93:e188a91d3eaa 313 * @}
Kojto 93:e188a91d3eaa 314 */
Kojto 93:e188a91d3eaa 315
Kojto 93:e188a91d3eaa 316 /** @defgroup CEC_OAR_Position Device Own Address position in CEC CFGR register
Kojto 93:e188a91d3eaa 317 * @{
Kojto 93:e188a91d3eaa 318 */
Kojto 93:e188a91d3eaa 319 #define CEC_CFGR_OAR_LSB_POS ((uint32_t) 16)
Kojto 93:e188a91d3eaa 320 /**
Kojto 93:e188a91d3eaa 321 * @}
Kojto 93:e188a91d3eaa 322 */
Kojto 93:e188a91d3eaa 323
Kojto 93:e188a91d3eaa 324 /** @defgroup CEC_Initiator_Position Initiator logical address position in message header
Kojto 93:e188a91d3eaa 325 * @{
Kojto 93:e188a91d3eaa 326 */
Kojto 93:e188a91d3eaa 327 #define CEC_INITIATOR_LSB_POS ((uint32_t) 4)
Kojto 93:e188a91d3eaa 328 /**
Kojto 93:e188a91d3eaa 329 * @}
Kojto 93:e188a91d3eaa 330 */
Kojto 93:e188a91d3eaa 331
Kojto 93:e188a91d3eaa 332 /**
Kojto 93:e188a91d3eaa 333 * @}
Kojto 93:e188a91d3eaa 334 */
Kojto 93:e188a91d3eaa 335
Kojto 93:e188a91d3eaa 336 /* Exported macros -----------------------------------------------------------*/
Kojto 93:e188a91d3eaa 337 /** @defgroup CEC_Exported_Macros CEC Exported Macros
Kojto 93:e188a91d3eaa 338 * @{
Kojto 93:e188a91d3eaa 339 */
Kojto 93:e188a91d3eaa 340
Kojto 93:e188a91d3eaa 341 /** @brief Reset CEC handle state
Kojto 93:e188a91d3eaa 342 * @param __HANDLE__: CEC handle.
Kojto 93:e188a91d3eaa 343 * @retval None
Kojto 93:e188a91d3eaa 344 */
Kojto 93:e188a91d3eaa 345 #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CEC_STATE_RESET)
Kojto 93:e188a91d3eaa 346
Kojto 93:e188a91d3eaa 347 /** @brief Checks whether or not the specified CEC interrupt flag is set.
Kojto 93:e188a91d3eaa 348 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 349 * @param __INTERRUPT__: specifies the interrupt to check.
Kojto 93:e188a91d3eaa 350 * This parameter can be one of the following values:
Kojto 93:e188a91d3eaa 351 * @arg CEC_ISR_RXBR : Rx-Byte Received
Kojto 93:e188a91d3eaa 352 * @arg CEC_ISR_RXEND : End of Reception
Kojto 93:e188a91d3eaa 353 * @arg CEC_ISR_RXOVR : Rx Overrun
Kojto 93:e188a91d3eaa 354 * @arg CEC_ISR_BRE : Rx Bit Rising Error
Kojto 93:e188a91d3eaa 355 * @arg CEC_ISR_SBPE : Rx Short Bit Period Error
Kojto 93:e188a91d3eaa 356 * @arg CEC_ISR_LBPE : Rx Long Bit Period Error
Kojto 93:e188a91d3eaa 357 * @arg CEC_ISR_RXACKE : Rx Missing Acknowledge
Kojto 93:e188a91d3eaa 358 * @arg CEC_ISR_ARBLST : Arbitration lost
Kojto 93:e188a91d3eaa 359 * @arg CEC_ISR_TXBR : Tx-Byte Request
Kojto 93:e188a91d3eaa 360 * @arg CEC_ISR_TXEND : End of Transmission
Kojto 93:e188a91d3eaa 361 * @arg CEC_ISR_TXUDR : Tx-buffer Underrun
Kojto 93:e188a91d3eaa 362 * @arg CEC_ISR_TXERR : Tx Error
Kojto 93:e188a91d3eaa 363 * @arg CEC_ISR_TXACKE : Tx Missing Acknowledge
Kojto 93:e188a91d3eaa 364 * @retval ITStatus
Kojto 93:e188a91d3eaa 365 */
Kojto 93:e188a91d3eaa 366 #define __HAL_CEC_GET_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->ISR & (__INTERRUPT__))
Kojto 93:e188a91d3eaa 367
Kojto 93:e188a91d3eaa 368 /** @brief Clears the interrupt or status flag when raised (write at 1)
Kojto 93:e188a91d3eaa 369 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 370 * @param __FLAG__: specifies the interrupt/status flag to clear.
Kojto 93:e188a91d3eaa 371 * This parameter can be one of the following values:
Kojto 93:e188a91d3eaa 372 * @arg CEC_ISR_RXBR : Rx-Byte Received
Kojto 93:e188a91d3eaa 373 * @arg CEC_ISR_RXEND : End of Reception
Kojto 93:e188a91d3eaa 374 * @arg CEC_ISR_RXOVR : Rx Overrun
Kojto 93:e188a91d3eaa 375 * @arg CEC_ISR_BRE : Rx Bit Rising Error
Kojto 93:e188a91d3eaa 376 * @arg CEC_ISR_SBPE : Rx Short Bit Period Error
Kojto 93:e188a91d3eaa 377 * @arg CEC_ISR_LBPE : Rx Long Bit Period Error
Kojto 93:e188a91d3eaa 378 * @arg CEC_ISR_RXACKE : Rx Missing Acknowledge
Kojto 93:e188a91d3eaa 379 * @arg CEC_ISR_ARBLST : Arbitration lost
Kojto 93:e188a91d3eaa 380 * @arg CEC_ISR_TXBR : Tx-Byte Request
Kojto 93:e188a91d3eaa 381 * @arg CEC_ISR_TXEND : End of Transmission
Kojto 93:e188a91d3eaa 382 * @arg CEC_ISR_TXUDR : Tx-buffer Underrun
Kojto 93:e188a91d3eaa 383 * @arg CEC_ISR_TXERR : Tx Error
Kojto 93:e188a91d3eaa 384 * @arg CEC_ISR_TXACKE : Tx Missing Acknowledge
Kojto 93:e188a91d3eaa 385 * @retval none
Kojto 93:e188a91d3eaa 386 */
Kojto 93:e188a91d3eaa 387 #define __HAL_CEC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR = (__FLAG__))
Kojto 93:e188a91d3eaa 388
Kojto 93:e188a91d3eaa 389 /** @brief Enables the specified CEC interrupt.
Kojto 93:e188a91d3eaa 390 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 391 * @param __INTERRUPT__: specifies the CEC interrupt to enable.
Kojto 93:e188a91d3eaa 392 * This parameter can be one of the following values:
Kojto 93:e188a91d3eaa 393 * @arg CEC_IER_RXBRIE : Rx-Byte Received IT Enable
Kojto 93:e188a91d3eaa 394 * @arg CEC_IER_RXENDIE : End Of Reception IT Enable
Kojto 93:e188a91d3eaa 395 * @arg CEC_IER_RXOVRIE : Rx-Overrun IT Enable
Kojto 93:e188a91d3eaa 396 * @arg CEC_IER_BREIE : Rx Bit Rising Error IT Enable
Kojto 93:e188a91d3eaa 397 * @arg CEC_IER_SBPEIE : Rx Short Bit period Error IT Enable
Kojto 93:e188a91d3eaa 398 * @arg CEC_IER_LBPEIE : Rx Long Bit period Error IT Enable
Kojto 93:e188a91d3eaa 399 * @arg CEC_IER_RXACKEIE : Rx Missing Acknowledge IT Enable
Kojto 93:e188a91d3eaa 400 * @arg CEC_IER_ARBLSTIE : Arbitration Lost IT Enable
Kojto 93:e188a91d3eaa 401 * @arg CEC_IER_TXBRIE : Tx Byte Request IT Enable
Kojto 93:e188a91d3eaa 402 * @arg CEC_IER_TXENDIE : End of Transmission IT Enable
Kojto 93:e188a91d3eaa 403 * @arg CEC_IER_TXUDRIE : Tx-Buffer Underrun IT Enable
Kojto 93:e188a91d3eaa 404 * @arg CEC_IER_TXERRIE : Tx-Error IT Enable
Kojto 93:e188a91d3eaa 405 * @arg CEC_IER_TXACKEIE : Tx Missing Acknowledge IT Enable
Kojto 93:e188a91d3eaa 406 * @retval none
Kojto 93:e188a91d3eaa 407 */
Kojto 93:e188a91d3eaa 408 #define __HAL_CEC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
Kojto 93:e188a91d3eaa 409
Kojto 93:e188a91d3eaa 410 /** @brief Disables the specified CEC interrupt.
Kojto 93:e188a91d3eaa 411 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 412 * @param __INTERRUPT__: specifies the CEC interrupt to disable.
Kojto 93:e188a91d3eaa 413 * This parameter can be one of the following values:
Kojto 93:e188a91d3eaa 414 * @arg CEC_IER_RXBRIE : Rx-Byte Received IT Enable
Kojto 93:e188a91d3eaa 415 * @arg CEC_IER_RXENDIE : End Of Reception IT Enable
Kojto 93:e188a91d3eaa 416 * @arg CEC_IER_RXOVRIE : Rx-Overrun IT Enable
Kojto 93:e188a91d3eaa 417 * @arg CEC_IER_BREIE : Rx Bit Rising Error IT Enable
Kojto 93:e188a91d3eaa 418 * @arg CEC_IER_SBPEIE : Rx Short Bit period Error IT Enable
Kojto 93:e188a91d3eaa 419 * @arg CEC_IER_LBPEIE : Rx Long Bit period Error IT Enable
Kojto 93:e188a91d3eaa 420 * @arg CEC_IER_RXACKEIE : Rx Missing Acknowledge IT Enable
Kojto 93:e188a91d3eaa 421 * @arg CEC_IER_ARBLSTIE : Arbitration Lost IT Enable
Kojto 93:e188a91d3eaa 422 * @arg CEC_IER_TXBRIE : Tx Byte Request IT Enable
Kojto 93:e188a91d3eaa 423 * @arg CEC_IER_TXENDIE : End of Transmission IT Enable
Kojto 93:e188a91d3eaa 424 * @arg CEC_IER_TXUDRIE : Tx-Buffer Underrun IT Enable
Kojto 93:e188a91d3eaa 425 * @arg CEC_IER_TXERRIE : Tx-Error IT Enable
Kojto 93:e188a91d3eaa 426 * @arg CEC_IER_TXACKEIE : Tx Missing Acknowledge IT Enable
Kojto 93:e188a91d3eaa 427 * @retval none
Kojto 93:e188a91d3eaa 428 */
Kojto 93:e188a91d3eaa 429 #define __HAL_CEC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__)))
Kojto 93:e188a91d3eaa 430
Kojto 93:e188a91d3eaa 431 /** @brief Checks whether or not the specified CEC interrupt is enabled.
Kojto 93:e188a91d3eaa 432 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 433 * @param __INTERRUPT__: specifies the CEC interrupt to check.
Kojto 93:e188a91d3eaa 434 * This parameter can be one of the following values:
Kojto 93:e188a91d3eaa 435 * @arg CEC_IER_RXBRIE : Rx-Byte Received IT Enable
Kojto 93:e188a91d3eaa 436 * @arg CEC_IER_RXENDIE : End Of Reception IT Enable
Kojto 93:e188a91d3eaa 437 * @arg CEC_IER_RXOVRIE : Rx-Overrun IT Enable
Kojto 93:e188a91d3eaa 438 * @arg CEC_IER_BREIE : Rx Bit Rising Error IT Enable
Kojto 93:e188a91d3eaa 439 * @arg CEC_IER_SBPEIE : Rx Short Bit period Error IT Enable
Kojto 93:e188a91d3eaa 440 * @arg CEC_IER_LBPEIE : Rx Long Bit period Error IT Enable
Kojto 93:e188a91d3eaa 441 * @arg CEC_IER_RXACKEIE : Rx Missing Acknowledge IT Enable
Kojto 93:e188a91d3eaa 442 * @arg CEC_IER_ARBLSTIE : Arbitration Lost IT Enable
Kojto 93:e188a91d3eaa 443 * @arg CEC_IER_TXBRIE : Tx Byte Request IT Enable
Kojto 93:e188a91d3eaa 444 * @arg CEC_IER_TXENDIE : End of Transmission IT Enable
Kojto 93:e188a91d3eaa 445 * @arg CEC_IER_TXUDRIE : Tx-Buffer Underrun IT Enable
Kojto 93:e188a91d3eaa 446 * @arg CEC_IER_TXERRIE : Tx-Error IT Enable
Kojto 93:e188a91d3eaa 447 * @arg CEC_IER_TXACKEIE : Tx Missing Acknowledge IT Enable
Kojto 93:e188a91d3eaa 448 * @retval FlagStatus
Kojto 93:e188a91d3eaa 449 */
Kojto 93:e188a91d3eaa 450 #define __HAL_CEC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER & (__INTERRUPT__))
Kojto 93:e188a91d3eaa 451
Kojto 93:e188a91d3eaa 452 /** @brief Enables the CEC device
Kojto 93:e188a91d3eaa 453 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 454 * @retval none
Kojto 93:e188a91d3eaa 455 */
Kojto 93:e188a91d3eaa 456 #define __HAL_CEC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_CECEN)
Kojto 93:e188a91d3eaa 457
Kojto 93:e188a91d3eaa 458 /** @brief Disables the CEC device
Kojto 93:e188a91d3eaa 459 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 460 * @retval none
Kojto 93:e188a91d3eaa 461 */
Kojto 93:e188a91d3eaa 462 #define __HAL_CEC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~CEC_CR_CECEN)
Kojto 93:e188a91d3eaa 463
Kojto 93:e188a91d3eaa 464 /** @brief Set Transmission Start flag
Kojto 93:e188a91d3eaa 465 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 466 * @retval none
Kojto 93:e188a91d3eaa 467 */
Kojto 93:e188a91d3eaa 468 #define __HAL_CEC_FIRST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXSOM)
Kojto 93:e188a91d3eaa 469
Kojto 93:e188a91d3eaa 470 /** @brief Set Transmission End flag
Kojto 93:e188a91d3eaa 471 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 472 * @retval none
Kojto 93:e188a91d3eaa 473 * If the CEC message consists of only one byte, TXEOM must be set before of TXSOM.
Kojto 93:e188a91d3eaa 474 */
Kojto 93:e188a91d3eaa 475 #define __HAL_CEC_LAST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXEOM)
Kojto 93:e188a91d3eaa 476
Kojto 93:e188a91d3eaa 477 /** @brief Get Transmission Start flag
Kojto 93:e188a91d3eaa 478 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 479 * @retval FlagStatus
Kojto 93:e188a91d3eaa 480 */
Kojto 93:e188a91d3eaa 481 #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXSOM)
Kojto 93:e188a91d3eaa 482
Kojto 93:e188a91d3eaa 483 /** @brief Get Transmission End flag
Kojto 93:e188a91d3eaa 484 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 485 * @retval FlagStatus
Kojto 93:e188a91d3eaa 486 */
Kojto 93:e188a91d3eaa 487 #define __HAL_CEC_GET_TRANSMISSION_END_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXEOM)
Kojto 93:e188a91d3eaa 488
Kojto 93:e188a91d3eaa 489 /** @brief Clear OAR register
Kojto 93:e188a91d3eaa 490 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 491 * @retval none
Kojto 93:e188a91d3eaa 492 */
Kojto 93:e188a91d3eaa 493 #define __HAL_CEC_CLEAR_OAR(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_OAR)
Kojto 93:e188a91d3eaa 494
Kojto 93:e188a91d3eaa 495 /** @brief Set OAR register (without resetting previously set address in case of multi-address mode)
Kojto 93:e188a91d3eaa 496 * To reset OAR, __HAL_CEC_CLEAR_OAR() needs to be called beforehand
Kojto 93:e188a91d3eaa 497 * @param __HANDLE__: specifies the CEC Handle.
Kojto 93:e188a91d3eaa 498 * @param __ADDRESS__: Own Address value (CEC logical address is identified by bit position)
Kojto 93:e188a91d3eaa 499 * @retval none
Kojto 93:e188a91d3eaa 500 */
Kojto 93:e188a91d3eaa 501 #define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) SET_BIT((__HANDLE__)->Instance->CFGR, (__ADDRESS__)<< CEC_CFGR_OAR_LSB_POS)
Kojto 93:e188a91d3eaa 502
Kojto 93:e188a91d3eaa 503 /** @brief Check CEC device Own Address Register (OAR) setting.
Kojto 93:e188a91d3eaa 504 * OAR address is written in a 15-bit field within CEC_CFGR register.
Kojto 93:e188a91d3eaa 505 * @param __ADDRESS__: CEC own address.
Kojto 93:e188a91d3eaa 506 * @retval Test result (TRUE or FALSE).
Kojto 93:e188a91d3eaa 507 */
Kojto 93:e188a91d3eaa 508 #define IS_CEC_OAR_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x07FFF)
Kojto 93:e188a91d3eaa 509
Kojto 93:e188a91d3eaa 510 /** @brief Check CEC initiator or destination logical address setting.
Kojto 93:e188a91d3eaa 511 * Initiator and destination addresses are coded over 4 bits.
Kojto 93:e188a91d3eaa 512 * @param __ADDRESS__: CEC initiator or logical address.
Kojto 93:e188a91d3eaa 513 * @retval Test result (TRUE or FALSE).
Kojto 93:e188a91d3eaa 514 */
Kojto 93:e188a91d3eaa 515 #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0xF)
Kojto 93:e188a91d3eaa 516
Kojto 93:e188a91d3eaa 517 /** @brief Check CEC message size.
Kojto 93:e188a91d3eaa 518 * The message size is the payload size: without counting the header,
Kojto 93:e188a91d3eaa 519 * it varies from 0 byte (ping operation, one header only, no payload) to
Kojto 93:e188a91d3eaa 520 * 15 bytes (1 opcode and up to 14 operands following the header).
Kojto 93:e188a91d3eaa 521 * @param __SIZE__: CEC message size.
Kojto 93:e188a91d3eaa 522 * @retval Test result (TRUE or FALSE).
Kojto 93:e188a91d3eaa 523 */
Kojto 93:e188a91d3eaa 524 #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0xF)
Kojto 93:e188a91d3eaa 525
Kojto 93:e188a91d3eaa 526 /**
Kojto 93:e188a91d3eaa 527 * @}
Kojto 93:e188a91d3eaa 528 */
Kojto 93:e188a91d3eaa 529
Kojto 93:e188a91d3eaa 530 /* Exported functions --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 531 /** @addtogroup CEC_Exported_Functions CEC Exported Functions
Kojto 93:e188a91d3eaa 532 * @{
Kojto 93:e188a91d3eaa 533 */
Kojto 93:e188a91d3eaa 534 /** @addtogroup CEC_Exported_Functions_Group1 Initialization/de-initialization function
Kojto 93:e188a91d3eaa 535 * @brief Initialization and Configuration functions
Kojto 93:e188a91d3eaa 536 * @{
Kojto 93:e188a91d3eaa 537 */
Kojto 93:e188a91d3eaa 538 /* Initialization and de-initialization functions ****************************/
Kojto 93:e188a91d3eaa 539 HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec);
Kojto 93:e188a91d3eaa 540 HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec);
Kojto 93:e188a91d3eaa 541 void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec);
Kojto 93:e188a91d3eaa 542 void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec);
Kojto 93:e188a91d3eaa 543 /**
Kojto 93:e188a91d3eaa 544 * @}
Kojto 93:e188a91d3eaa 545 */
Kojto 93:e188a91d3eaa 546
Kojto 93:e188a91d3eaa 547 /** @addtogroup CEC_Exported_Functions_Group2 IO operation function
Kojto 93:e188a91d3eaa 548 * @brief CEC Transmit/Receive functions
Kojto 93:e188a91d3eaa 549 * @{
Kojto 93:e188a91d3eaa 550 */
Kojto 93:e188a91d3eaa 551 /* I/O operation functions ***************************************************/
Kojto 93:e188a91d3eaa 552 HAL_StatusTypeDef HAL_CEC_Transmit(CEC_HandleTypeDef *hcec, uint8_t DestinationAddress, uint8_t *pData, uint32_t Size, uint32_t Timeout);
Kojto 93:e188a91d3eaa 553 HAL_StatusTypeDef HAL_CEC_Receive(CEC_HandleTypeDef *hcec, uint8_t *pData, uint32_t Timeout);
Kojto 93:e188a91d3eaa 554 HAL_StatusTypeDef HAL_CEC_Transmit_IT(CEC_HandleTypeDef *hcec, uint8_t DestinationAddress, uint8_t *pData, uint32_t Size);
Kojto 93:e188a91d3eaa 555 HAL_StatusTypeDef HAL_CEC_Receive_IT(CEC_HandleTypeDef *hcec, uint8_t *pData);
Kojto 93:e188a91d3eaa 556 void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec);
Kojto 93:e188a91d3eaa 557 void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec);
Kojto 93:e188a91d3eaa 558 void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec);
Kojto 93:e188a91d3eaa 559 void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec);
Kojto 93:e188a91d3eaa 560 /**
Kojto 93:e188a91d3eaa 561 * @}
Kojto 93:e188a91d3eaa 562 */
Kojto 93:e188a91d3eaa 563
Kojto 93:e188a91d3eaa 564 /** @addtogroup CEC_Exported_Functions_Group3 Peripheral Control function
Kojto 93:e188a91d3eaa 565 * @brief CEC control functions
Kojto 93:e188a91d3eaa 566 * @{
Kojto 93:e188a91d3eaa 567 */
Kojto 93:e188a91d3eaa 568 /* Peripheral State functions ************************************************/
Kojto 93:e188a91d3eaa 569 HAL_CEC_StateTypeDef HAL_CEC_GetState(CEC_HandleTypeDef *hcec);
Kojto 93:e188a91d3eaa 570 uint32_t HAL_CEC_GetError(CEC_HandleTypeDef *hcec);
Kojto 93:e188a91d3eaa 571 /**
Kojto 93:e188a91d3eaa 572 * @}
Kojto 93:e188a91d3eaa 573 */
Kojto 93:e188a91d3eaa 574
Kojto 93:e188a91d3eaa 575 /**
Kojto 93:e188a91d3eaa 576 * @}
Kojto 93:e188a91d3eaa 577 */
Kojto 93:e188a91d3eaa 578
Kojto 93:e188a91d3eaa 579 /**
Kojto 93:e188a91d3eaa 580 * @}
Kojto 93:e188a91d3eaa 581 */
Kojto 93:e188a91d3eaa 582
Kojto 93:e188a91d3eaa 583 /**
Kojto 93:e188a91d3eaa 584 * @}
Kojto 93:e188a91d3eaa 585 */
Kojto 93:e188a91d3eaa 586
Kojto 93:e188a91d3eaa 587 #endif /* defined(STM32F042x6) || defined(STM32F048xx) || */
Kojto 93:e188a91d3eaa 588 /* defined(STM32F051x8) || defined(STM32F058xx) || */
Kojto 93:e188a91d3eaa 589 /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || */
Kojto 93:e188a91d3eaa 590 /* defined(STM32F091xC) || defined(STM32F098xx) */
Kojto 93:e188a91d3eaa 591 #ifdef __cplusplus
Kojto 93:e188a91d3eaa 592 }
Kojto 93:e188a91d3eaa 593 #endif
Kojto 93:e188a91d3eaa 594
Kojto 93:e188a91d3eaa 595 #endif /* __STM32F0xx_HAL_CEC_H */
Kojto 93:e188a91d3eaa 596
Kojto 93:e188a91d3eaa 597 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Kojto 93:e188a91d3eaa 598