mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
96:487b796308b0
remove SerialHalfDuplex.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 96:487b796308b0 1 /**
Kojto 96:487b796308b0 2 ******************************************************************************
Kojto 96:487b796308b0 3 * @file stm32f1xx_hal_cec.h
Kojto 96:487b796308b0 4 * @author MCD Application Team
Kojto 96:487b796308b0 5 * @version V1.0.0
Kojto 96:487b796308b0 6 * @date 15-December-2014
Kojto 96:487b796308b0 7 * @brief Header file of CEC HAL module.
Kojto 96:487b796308b0 8 ******************************************************************************
Kojto 96:487b796308b0 9 * @attention
Kojto 96:487b796308b0 10 *
Kojto 96:487b796308b0 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 96:487b796308b0 12 *
Kojto 96:487b796308b0 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 96:487b796308b0 14 * are permitted provided that the following conditions are met:
Kojto 96:487b796308b0 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 96:487b796308b0 16 * this list of conditions and the following disclaimer.
Kojto 96:487b796308b0 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 96:487b796308b0 18 * this list of conditions and the following disclaimer in the documentation
Kojto 96:487b796308b0 19 * and/or other materials provided with the distribution.
Kojto 96:487b796308b0 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 96:487b796308b0 21 * may be used to endorse or promote products derived from this software
Kojto 96:487b796308b0 22 * without specific prior written permission.
Kojto 96:487b796308b0 23 *
Kojto 96:487b796308b0 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 96:487b796308b0 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 96:487b796308b0 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 96:487b796308b0 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 96:487b796308b0 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 96:487b796308b0 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 96:487b796308b0 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 96:487b796308b0 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 96:487b796308b0 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 96:487b796308b0 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 96:487b796308b0 34 *
Kojto 96:487b796308b0 35 ******************************************************************************
Kojto 96:487b796308b0 36 */
Kojto 96:487b796308b0 37
Kojto 96:487b796308b0 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 96:487b796308b0 39 #ifndef __STM32F1xx_HAL_CEC_H
Kojto 96:487b796308b0 40 #define __STM32F1xx_HAL_CEC_H
Kojto 96:487b796308b0 41
Kojto 96:487b796308b0 42 #ifdef __cplusplus
Kojto 96:487b796308b0 43 extern "C" {
Kojto 96:487b796308b0 44 #endif
Kojto 96:487b796308b0 45
Kojto 96:487b796308b0 46 #if defined(STM32F100xB) || defined(STM32F100xE)
Kojto 96:487b796308b0 47 /* Includes ------------------------------------------------------------------*/
Kojto 96:487b796308b0 48 #include "stm32f1xx_hal_def.h"
Kojto 96:487b796308b0 49
Kojto 96:487b796308b0 50 /** @addtogroup STM32F1xx_HAL_Driver
Kojto 96:487b796308b0 51 * @{
Kojto 96:487b796308b0 52 */
Kojto 96:487b796308b0 53
Kojto 96:487b796308b0 54 /** @addtogroup CEC
Kojto 96:487b796308b0 55 * @{
Kojto 96:487b796308b0 56 */
Kojto 96:487b796308b0 57
Kojto 96:487b796308b0 58 /** @addtogroup CEC_Private_Constants
Kojto 96:487b796308b0 59 * @{
Kojto 96:487b796308b0 60 */
Kojto 96:487b796308b0 61 #define IS_CEC_BIT_TIMING_ERROR_MODE(MODE) (((MODE) == CEC_BIT_TIMING_ERROR_MODE_STANDARD) || \
Kojto 96:487b796308b0 62 ((MODE) == CEC_BIT_TIMING_ERROR_MODE_ERRORFREE))
Kojto 96:487b796308b0 63 #define IS_CEC_BIT_PERIOD_ERROR_MODE(MODE) (((MODE) == CEC_BIT_PERIOD_ERROR_MODE_STANDARD) || \
Kojto 96:487b796308b0 64 ((MODE) == CEC_BIT_PERIOD_ERROR_MODE_FLEXIBLE))
Kojto 96:487b796308b0 65
Kojto 96:487b796308b0 66 /** @brief Check CEC device Own Address Register (OAR) setting.
Kojto 96:487b796308b0 67 * @param __ADDRESS__: CEC own address.
Kojto 96:487b796308b0 68 * @retval Test result (TRUE or FALSE).
Kojto 96:487b796308b0 69 */
Kojto 96:487b796308b0 70 #define IS_CEC_OAR_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0xF)
Kojto 96:487b796308b0 71
Kojto 96:487b796308b0 72 /** @brief Check CEC initiator or destination logical address setting.
Kojto 96:487b796308b0 73 * Initiator and destination addresses are coded over 4 bits.
Kojto 96:487b796308b0 74 * @param __ADDRESS__: CEC initiator or logical address.
Kojto 96:487b796308b0 75 * @retval Test result (TRUE or FALSE).
Kojto 96:487b796308b0 76 */
Kojto 96:487b796308b0 77 #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0xF)
Kojto 96:487b796308b0 78
Kojto 96:487b796308b0 79 /** @brief Check CEC message size.
Kojto 96:487b796308b0 80 * The message size is the payload size: without counting the header,
Kojto 96:487b796308b0 81 * it varies from 0 byte (ping operation, one header only, no payload) to
Kojto 96:487b796308b0 82 * 15 bytes (1 opcode and up to 14 operands following the header).
Kojto 96:487b796308b0 83 * @param __SIZE__: CEC message size.
Kojto 96:487b796308b0 84 * @retval Test result (TRUE or FALSE).
Kojto 96:487b796308b0 85 */
Kojto 96:487b796308b0 86 #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0xF)
Kojto 96:487b796308b0 87
Kojto 96:487b796308b0 88 /**
Kojto 96:487b796308b0 89 * @}
Kojto 96:487b796308b0 90 */
Kojto 96:487b796308b0 91
Kojto 96:487b796308b0 92 /* Exported types ------------------------------------------------------------*/
Kojto 96:487b796308b0 93 /** @defgroup CEC_Exported_Types CEC Exported Types
Kojto 96:487b796308b0 94 * @{
Kojto 96:487b796308b0 95 */
Kojto 96:487b796308b0 96 /**
Kojto 96:487b796308b0 97 * @brief CEC Init Structure definition
Kojto 96:487b796308b0 98 */
Kojto 96:487b796308b0 99 typedef struct
Kojto 96:487b796308b0 100 {
Kojto 96:487b796308b0 101 uint32_t TimingErrorFree; /*!< Configures the CEC Bit Timing Error Mode.
Kojto 96:487b796308b0 102 This parameter can be a value of @ref CEC_BitTimingErrorMode */
Kojto 96:487b796308b0 103 uint32_t PeriodErrorFree; /*!< Configures the CEC Bit Period Error Mode.
Kojto 96:487b796308b0 104 This parameter can be a value of @ref CEC_BitPeriodErrorMode */
Kojto 96:487b796308b0 105 uint8_t InitiatorAddress; /*!< Initiator address (source logical address, sent in each header)
Kojto 96:487b796308b0 106 This parameter can be a value <= 0xF */
Kojto 96:487b796308b0 107 }CEC_InitTypeDef;
Kojto 96:487b796308b0 108
Kojto 96:487b796308b0 109 /**
Kojto 96:487b796308b0 110 * @brief HAL CEC State structures definition
Kojto 96:487b796308b0 111 */
Kojto 96:487b796308b0 112 typedef enum
Kojto 96:487b796308b0 113 {
Kojto 96:487b796308b0 114 HAL_CEC_STATE_RESET = 0x00, /*!< Peripheral Reset state */
Kojto 96:487b796308b0 115 HAL_CEC_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
Kojto 96:487b796308b0 116 HAL_CEC_STATE_BUSY = 0x02, /*!< An internal process is ongoing */
Kojto 96:487b796308b0 117 HAL_CEC_STATE_BUSY_TX = 0x03, /*!< Data Transmission process is ongoing */
Kojto 96:487b796308b0 118 HAL_CEC_STATE_BUSY_RX = 0x04, /*!< Data Reception process is ongoing */
Kojto 96:487b796308b0 119 HAL_CEC_STATE_BUSY_TX_RX = 0x05, /*!< Data Transmission and Reception process is ongoing */
Kojto 96:487b796308b0 120 HAL_CEC_STATE_TIMEOUT = 0x06, /*!< Timeout state */
Kojto 96:487b796308b0 121 HAL_CEC_STATE_ERROR = 0x07 /*!< State Error */
Kojto 96:487b796308b0 122 }HAL_CEC_StateTypeDef;
Kojto 96:487b796308b0 123
Kojto 96:487b796308b0 124 /**
Kojto 96:487b796308b0 125 * @brief HAL Error structures definition
Kojto 96:487b796308b0 126 */
Kojto 96:487b796308b0 127 typedef enum
Kojto 96:487b796308b0 128 {
Kojto 96:487b796308b0 129 HAL_CEC_ERROR_NONE = (uint32_t) 0x0, /*!< no error */
Kojto 96:487b796308b0 130 HAL_CEC_ERROR_BTE = CEC_ESR_BTE, /*!< Bit Timing Error */
Kojto 96:487b796308b0 131 HAL_CEC_ERROR_BPE = CEC_ESR_BPE, /*!< Bit Period Error */
Kojto 96:487b796308b0 132 HAL_CEC_ERROR_RBTFE = CEC_ESR_RBTFE, /*!< Rx Block Transfer Finished Error */
Kojto 96:487b796308b0 133 HAL_CEC_ERROR_SBE = CEC_ESR_SBE, /*!< Start Bit Error */
Kojto 96:487b796308b0 134 HAL_CEC_ERROR_ACKE = CEC_ESR_ACKE, /*!< Block Acknowledge Error */
Kojto 96:487b796308b0 135 HAL_CEC_ERROR_LINE = CEC_ESR_LINE, /*!< Line Error */
Kojto 96:487b796308b0 136 HAL_CEC_ERROR_TBTFE = CEC_ESR_TBTFE, /*!< Tx Block Transfer Finished Error */
Kojto 96:487b796308b0 137 }HAL_CEC_ErrorTypeDef;
Kojto 96:487b796308b0 138
Kojto 96:487b796308b0 139 /**
Kojto 96:487b796308b0 140 * @brief CEC handle Structure definition
Kojto 96:487b796308b0 141 */
Kojto 96:487b796308b0 142 typedef struct
Kojto 96:487b796308b0 143 {
Kojto 96:487b796308b0 144 CEC_TypeDef *Instance; /*!< CEC registers base address */
Kojto 96:487b796308b0 145
Kojto 96:487b796308b0 146 CEC_InitTypeDef Init; /*!< CEC communication parameters */
Kojto 96:487b796308b0 147
Kojto 96:487b796308b0 148 uint8_t *pTxBuffPtr; /*!< Pointer to CEC Tx transfer Buffer */
Kojto 96:487b796308b0 149
Kojto 96:487b796308b0 150 uint16_t TxXferCount; /*!< CEC Tx Transfer Counter */
Kojto 96:487b796308b0 151
Kojto 96:487b796308b0 152 uint8_t *pRxBuffPtr; /*!< Pointer to CEC Rx transfer Buffer */
Kojto 96:487b796308b0 153
Kojto 96:487b796308b0 154 uint16_t RxXferSize; /*!< CEC Rx Transfer size, 0: header received only */
Kojto 96:487b796308b0 155
Kojto 96:487b796308b0 156 uint32_t ErrorCode; /*!< For errors handling purposes, copy of ESR register in case error is reported */
Kojto 96:487b796308b0 157
Kojto 96:487b796308b0 158 HAL_LockTypeDef Lock; /*!< Locking object */
Kojto 96:487b796308b0 159
Kojto 96:487b796308b0 160 HAL_CEC_StateTypeDef State; /*!< CEC communication state */
Kojto 96:487b796308b0 161
Kojto 96:487b796308b0 162 }CEC_HandleTypeDef;
Kojto 96:487b796308b0 163
Kojto 96:487b796308b0 164 /**
Kojto 96:487b796308b0 165 * @}
Kojto 96:487b796308b0 166 */
Kojto 96:487b796308b0 167
Kojto 96:487b796308b0 168 /* Exported constants --------------------------------------------------------*/
Kojto 96:487b796308b0 169 /** @defgroup CEC_Exported_Constants CEC Exported Constants
Kojto 96:487b796308b0 170 * @{
Kojto 96:487b796308b0 171 */
Kojto 96:487b796308b0 172
Kojto 96:487b796308b0 173 /** @defgroup CEC_BitTimingErrorMode Bit Timing Error Mode
Kojto 96:487b796308b0 174 * @{
Kojto 96:487b796308b0 175 */
Kojto 96:487b796308b0 176 #define CEC_BIT_TIMING_ERROR_MODE_STANDARD ((uint32_t)0x00) /*!< Bit timing error Standard Mode */
Kojto 96:487b796308b0 177 #define CEC_BIT_TIMING_ERROR_MODE_ERRORFREE CEC_CFGR_BTEM /*!< Bit timing error Free Mode */
Kojto 96:487b796308b0 178 /**
Kojto 96:487b796308b0 179 * @}
Kojto 96:487b796308b0 180 */
Kojto 96:487b796308b0 181
Kojto 96:487b796308b0 182 /** @defgroup CEC_BitPeriodErrorMode Bit Period Error Mode
Kojto 96:487b796308b0 183 * @{
Kojto 96:487b796308b0 184 */
Kojto 96:487b796308b0 185 #define CEC_BIT_PERIOD_ERROR_MODE_STANDARD ((uint32_t)0x00) /*!< Bit period error Standard Mode */
Kojto 96:487b796308b0 186 #define CEC_BIT_PERIOD_ERROR_MODE_FLEXIBLE CEC_CFGR_BPEM /*!< Bit period error Flexible Mode */
Kojto 96:487b796308b0 187 /**
Kojto 96:487b796308b0 188 * @}
Kojto 96:487b796308b0 189 */
Kojto 96:487b796308b0 190
Kojto 96:487b796308b0 191 /** @defgroup CEC_Initiator_Position Initiator logical address position in message header
Kojto 96:487b796308b0 192 * @{
Kojto 96:487b796308b0 193 */
Kojto 96:487b796308b0 194 #define CEC_INITIATOR_LSB_POS ((uint32_t) 4)
Kojto 96:487b796308b0 195 /**
Kojto 96:487b796308b0 196 * @}
Kojto 96:487b796308b0 197 */
Kojto 96:487b796308b0 198 /** @defgroup CEC_Interrupts_Definitions Interrupts definition
Kojto 96:487b796308b0 199 * @{
Kojto 96:487b796308b0 200 */
Kojto 96:487b796308b0 201 #define CEC_IT_IE CEC_CFGR_IE
Kojto 96:487b796308b0 202 /**
Kojto 96:487b796308b0 203 * @}
Kojto 96:487b796308b0 204 */
Kojto 96:487b796308b0 205
Kojto 96:487b796308b0 206 /** @defgroup CEC_Flags_Definitions Flags definition
Kojto 96:487b796308b0 207 * @{
Kojto 96:487b796308b0 208 */
Kojto 96:487b796308b0 209 #define CEC_FLAG_TSOM CEC_CSR_TSOM
Kojto 96:487b796308b0 210 #define CEC_FLAG_TEOM CEC_CSR_TEOM
Kojto 96:487b796308b0 211 #define CEC_FLAG_TERR CEC_CSR_TERR
Kojto 96:487b796308b0 212 #define CEC_FLAG_TBTRF CEC_CSR_TBTRF
Kojto 96:487b796308b0 213 #define CEC_FLAG_RSOM CEC_CSR_RSOM
Kojto 96:487b796308b0 214 #define CEC_FLAG_REOM CEC_CSR_REOM
Kojto 96:487b796308b0 215 #define CEC_FLAG_RERR CEC_CSR_RERR
Kojto 96:487b796308b0 216 #define CEC_FLAG_RBTF CEC_CSR_RBTF
Kojto 96:487b796308b0 217 /**
Kojto 96:487b796308b0 218 * @}
Kojto 96:487b796308b0 219 */
Kojto 96:487b796308b0 220
Kojto 96:487b796308b0 221 /**
Kojto 96:487b796308b0 222 * @}
Kojto 96:487b796308b0 223 */
Kojto 96:487b796308b0 224
Kojto 96:487b796308b0 225 /* Exported macros -----------------------------------------------------------*/
Kojto 96:487b796308b0 226 /** @defgroup CEC_Exported_Macros CEC Exported Macros
Kojto 96:487b796308b0 227 * @{
Kojto 96:487b796308b0 228 */
Kojto 96:487b796308b0 229
Kojto 96:487b796308b0 230 /** @brief Reset CEC handle state
Kojto 96:487b796308b0 231 * @param __HANDLE__: CEC handle.
Kojto 96:487b796308b0 232 * @retval None
Kojto 96:487b796308b0 233 */
Kojto 96:487b796308b0 234 #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CEC_STATE_RESET)
Kojto 96:487b796308b0 235
Kojto 96:487b796308b0 236 /** @brief Checks whether or not the specified CEC interrupt flag is set.
Kojto 96:487b796308b0 237 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 238 * @param __INTERRUPT__: specifies the interrupt to check.
Kojto 96:487b796308b0 239 * @arg CEC_FLAG_TERR: Tx Error
Kojto 96:487b796308b0 240 * @arg CEC_FLAG_TBTF: Tx Block Transfer Finished
Kojto 96:487b796308b0 241 * @arg CEC_FLAG_RERR: Rx Error
Kojto 96:487b796308b0 242 * @arg CEC_FLAG_RBTF: Rx Block Transfer Finished
Kojto 96:487b796308b0 243 * @retval ITStatus
Kojto 96:487b796308b0 244 */
Kojto 96:487b796308b0 245 #define __HAL_CEC_GET_FLAG(__HANDLE__, __INTERRUPT__) READ_BIT((__HANDLE__)->Instance->CSR,(__INTERRUPT__))
Kojto 96:487b796308b0 246
Kojto 96:487b796308b0 247 /** @brief Clears the CEC's pending flags.
Kojto 96:487b796308b0 248 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 249 * @param __FLAG__: specifies the flag to clear.
Kojto 96:487b796308b0 250 * This parameter can be any combination of the following values:
Kojto 96:487b796308b0 251 * @arg CEC_CSR_TERR: Tx Error
Kojto 96:487b796308b0 252 * @arg CEC_CSR_TBTF: Tx Block Transfer Finished
Kojto 96:487b796308b0 253 * @arg CEC_CSR_RERR: Rx Error
Kojto 96:487b796308b0 254 * @arg CEC_CSR_RBTF: Rx Block Transfer Finished
Kojto 96:487b796308b0 255 * @retval none
Kojto 96:487b796308b0 256 */
Kojto 96:487b796308b0 257 #define __HAL_CEC_CLEAR_FLAG(__HANDLE__, __FLAG__) \
Kojto 96:487b796308b0 258 do { \
Kojto 96:487b796308b0 259 uint32_t tmp = 0x0; \
Kojto 96:487b796308b0 260 tmp = (__HANDLE__)->Instance->CSR & 0x2; \
Kojto 96:487b796308b0 261 (__HANDLE__)->Instance->CSR &= (uint32_t)(((~(uint32_t)(__FLAG__)) & 0xFFFFFFFC) | tmp);\
Kojto 96:487b796308b0 262 } while(0)
Kojto 96:487b796308b0 263
Kojto 96:487b796308b0 264 /** @brief Enables the specified CEC interrupt.
Kojto 96:487b796308b0 265 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 266 * @param __INTERRUPT__: The CEC interrupt to enable.
Kojto 96:487b796308b0 267 * This parameter can be:
Kojto 96:487b796308b0 268 * @arg CEC_IT_IE : Interrupt Enable
Kojto 96:487b796308b0 269 * @retval none
Kojto 96:487b796308b0 270 */
Kojto 96:487b796308b0 271 #define __HAL_CEC_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__))
Kojto 96:487b796308b0 272
Kojto 96:487b796308b0 273 /** @brief Disables the specified CEC interrupt.
Kojto 96:487b796308b0 274 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 275 * @param __INTERRUPT__: The CEC interrupt to enable.
Kojto 96:487b796308b0 276 * This parameter can be:
Kojto 96:487b796308b0 277 * @arg CEC_IT_IE : Interrupt Enable
Kojto 96:487b796308b0 278 * @retval none
Kojto 96:487b796308b0 279 */
Kojto 96:487b796308b0 280 #define __HAL_CEC_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__))
Kojto 96:487b796308b0 281
Kojto 96:487b796308b0 282 /** @brief Checks whether or not the specified CEC interrupt is enabled.
Kojto 96:487b796308b0 283 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 284 * @param __INTERRUPT__: The CEC interrupt to enable.
Kojto 96:487b796308b0 285 * This parameter can be:
Kojto 96:487b796308b0 286 * @arg CEC_IT_IE : Interrupt Enable
Kojto 96:487b796308b0 287 * @retval FlagStatus
Kojto 96:487b796308b0 288 */
Kojto 96:487b796308b0 289 #define __HAL_CEC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) READ_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__))
Kojto 96:487b796308b0 290
Kojto 96:487b796308b0 291 /** @brief Enables the CEC device
Kojto 96:487b796308b0 292 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 293 * @retval none
Kojto 96:487b796308b0 294 */
Kojto 96:487b796308b0 295 #define __HAL_CEC_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_PE)
Kojto 96:487b796308b0 296
Kojto 96:487b796308b0 297 /** @brief Disables the CEC device
Kojto 96:487b796308b0 298 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 299 * @retval none
Kojto 96:487b796308b0 300 */
Kojto 96:487b796308b0 301 #define __HAL_CEC_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_PE)
Kojto 96:487b796308b0 302
Kojto 96:487b796308b0 303 /** @brief Set Transmission Start flag
Kojto 96:487b796308b0 304 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 305 * @retval none
Kojto 96:487b796308b0 306 */
Kojto 96:487b796308b0 307 #define __HAL_CEC_FIRST_BYTE_TX_SET(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TSOM)
Kojto 96:487b796308b0 308
Kojto 96:487b796308b0 309 /** @brief Set Transmission End flag
Kojto 96:487b796308b0 310 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 311 * @retval none
Kojto 96:487b796308b0 312 */
Kojto 96:487b796308b0 313 #define __HAL_CEC_LAST_BYTE_TX_SET(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TEOM)
Kojto 96:487b796308b0 314
Kojto 96:487b796308b0 315 /** @brief Get Transmission Start flag
Kojto 96:487b796308b0 316 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 317 * @retval FlagStatus
Kojto 96:487b796308b0 318 */
Kojto 96:487b796308b0 319 #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) READ_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TSOM)
Kojto 96:487b796308b0 320
Kojto 96:487b796308b0 321 /** @brief Get Transmission End flag
Kojto 96:487b796308b0 322 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 323 * @retval FlagStatus
Kojto 96:487b796308b0 324 */
Kojto 96:487b796308b0 325 #define __HAL_CEC_GET_TRANSMISSION_END_FLAG(__HANDLE__) READ_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TEOM)
Kojto 96:487b796308b0 326
Kojto 96:487b796308b0 327 /** @brief Clear OAR register
Kojto 96:487b796308b0 328 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 329 * @retval none
Kojto 96:487b796308b0 330 */
Kojto 96:487b796308b0 331 #define __HAL_CEC_CLEAR_OAR(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->OAR, CEC_OAR_OA)
Kojto 96:487b796308b0 332
Kojto 96:487b796308b0 333 /** @brief Set OAR register
Kojto 96:487b796308b0 334 * @param __HANDLE__: specifies the CEC Handle.
Kojto 96:487b796308b0 335 * @param __ADDRESS__: Own Address value.
Kojto 96:487b796308b0 336 * @retval none
Kojto 96:487b796308b0 337 */
Kojto 96:487b796308b0 338 #define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) MODIFY_REG((__HANDLE__)->Instance->OAR, CEC_OAR_OA, (__ADDRESS__));
Kojto 96:487b796308b0 339
Kojto 96:487b796308b0 340 /**
Kojto 96:487b796308b0 341 * @}
Kojto 96:487b796308b0 342 */
Kojto 96:487b796308b0 343
Kojto 96:487b796308b0 344 /* Exported functions --------------------------------------------------------*/
Kojto 96:487b796308b0 345 /** @addtogroup CEC_Exported_Functions CEC Exported Functions
Kojto 96:487b796308b0 346 * @{
Kojto 96:487b796308b0 347 */
Kojto 96:487b796308b0 348
Kojto 96:487b796308b0 349 /** @addtogroup CEC_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 96:487b796308b0 350 * @brief Initialization and Configuration functions
Kojto 96:487b796308b0 351 * @{
Kojto 96:487b796308b0 352 */
Kojto 96:487b796308b0 353 /* Initialization and de-initialization functions ****************************/
Kojto 96:487b796308b0 354 HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec);
Kojto 96:487b796308b0 355 HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec);
Kojto 96:487b796308b0 356 void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec);
Kojto 96:487b796308b0 357 void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec);
Kojto 96:487b796308b0 358 /**
Kojto 96:487b796308b0 359 * @}
Kojto 96:487b796308b0 360 */
Kojto 96:487b796308b0 361
Kojto 96:487b796308b0 362 /** @addtogroup CEC_Exported_Functions_Group2 Input and Output operation functions
Kojto 96:487b796308b0 363 * @brief CEC Transmit/Receive functions
Kojto 96:487b796308b0 364 * @{
Kojto 96:487b796308b0 365 */
Kojto 96:487b796308b0 366 /* IO operation functions *****************************************************/
Kojto 96:487b796308b0 367 HAL_StatusTypeDef HAL_CEC_Transmit(CEC_HandleTypeDef *hcec, uint8_t DestinationAddress, uint8_t *pData, uint32_t Size, uint32_t Timeout);
Kojto 96:487b796308b0 368 HAL_StatusTypeDef HAL_CEC_Receive(CEC_HandleTypeDef *hcec, uint8_t *pData, uint32_t Timeout);
Kojto 96:487b796308b0 369 HAL_StatusTypeDef HAL_CEC_Transmit_IT(CEC_HandleTypeDef *hcec, uint8_t DestinationAddress, uint8_t *pData, uint32_t Size);
Kojto 96:487b796308b0 370 HAL_StatusTypeDef HAL_CEC_Receive_IT(CEC_HandleTypeDef *hcec, uint8_t *pData);
Kojto 96:487b796308b0 371 uint32_t HAL_CEC_GetReceivedFrameSize(CEC_HandleTypeDef *hcec);
Kojto 96:487b796308b0 372 void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec);
Kojto 96:487b796308b0 373 void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec);
Kojto 96:487b796308b0 374 void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec);
Kojto 96:487b796308b0 375 void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec);
Kojto 96:487b796308b0 376 /**
Kojto 96:487b796308b0 377 * @}
Kojto 96:487b796308b0 378 */
Kojto 96:487b796308b0 379
Kojto 96:487b796308b0 380 /** @defgroup CEC_Exported_Functions_Group3 Peripheral Control functions
Kojto 96:487b796308b0 381 * @brief CEC control functions
Kojto 96:487b796308b0 382 * @{
Kojto 96:487b796308b0 383 */
Kojto 96:487b796308b0 384 /* Peripheral State and Error functions ***************************************/
Kojto 96:487b796308b0 385 HAL_CEC_StateTypeDef HAL_CEC_GetState(CEC_HandleTypeDef *hcec);
Kojto 96:487b796308b0 386 uint32_t HAL_CEC_GetError(CEC_HandleTypeDef *hcec);
Kojto 96:487b796308b0 387 /**
Kojto 96:487b796308b0 388 * @}
Kojto 96:487b796308b0 389 */
Kojto 96:487b796308b0 390
Kojto 96:487b796308b0 391 /**
Kojto 96:487b796308b0 392 * @}
Kojto 96:487b796308b0 393 */
Kojto 96:487b796308b0 394
Kojto 96:487b796308b0 395 /**
Kojto 96:487b796308b0 396 * @}
Kojto 96:487b796308b0 397 */
Kojto 96:487b796308b0 398
Kojto 96:487b796308b0 399 /**
Kojto 96:487b796308b0 400 * @}
Kojto 96:487b796308b0 401 */
Kojto 96:487b796308b0 402
Kojto 96:487b796308b0 403 #endif /* defined(STM32F100xB) || defined(STM32F100xE) */
Kojto 96:487b796308b0 404
Kojto 96:487b796308b0 405 #ifdef __cplusplus
Kojto 96:487b796308b0 406 }
Kojto 96:487b796308b0 407 #endif
Kojto 96:487b796308b0 408
Kojto 96:487b796308b0 409 #endif /* __STM32F1xx_HAL_CEC_H */
Kojto 96:487b796308b0 410
Kojto 96:487b796308b0 411 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/