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:
<>
Date:
Mon Jan 16 12:05:23 2017 +0000
Revision:
134:ad3be0349dc5
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 134 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3488: Dev stm i2c v2 unitary functions https://github.com/ARMmbed/mbed-os/pull/3488
3492: Fix #3463 CAN read() return value https://github.com/ARMmbed/mbed-os/pull/3492
3503: [LPC15xx] Ensure that PWM=1 is resolved correctly https://github.com/ARMmbed/mbed-os/pull/3503
3504: [LPC15xx] CAN implementation improvements https://github.com/ARMmbed/mbed-os/pull/3504
3539: NUCLEO_F412ZG - Add support of TRNG peripheral https://github.com/ARMmbed/mbed-os/pull/3539
3540: STM: SPI: Initialize Rx in spi_master_write https://github.com/ARMmbed/mbed-os/pull/3540
3438: K64F: Add support for SERIAL ASYNCH API https://github.com/ARMmbed/mbed-os/pull/3438
3519: MCUXpresso: Fix ENET driver to enable interrupts after interrupt handler is set https://github.com/ARMmbed/mbed-os/pull/3519
3544: STM32L4 deepsleep improvement https://github.com/ARMmbed/mbed-os/pull/3544
3546: NUCLEO-F412ZG - Add CAN peripheral https://github.com/ARMmbed/mbed-os/pull/3546
3551: Fix I2C driver for RZ/A1H https://github.com/ARMmbed/mbed-os/pull/3551
3558: K64F UART Asynch API: Fix synchronization issue https://github.com/ARMmbed/mbed-os/pull/3558
3563: LPC4088 - Fix vector checksum https://github.com/ARMmbed/mbed-os/pull/3563
3567: Dev stm32 F0 v1.7.0 https://github.com/ARMmbed/mbed-os/pull/3567
3577: Fixes linking errors when building with debug profile https://github.com/ARMmbed/mbed-os/pull/3577

Who changed what in which revision?

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