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