Mangue Baja Box

Dependencies:   mbed

Committer:
einsteingustavo
Date:
Mon Jul 29 20:38:00 2019 +0000
Revision:
0:0dee8840a1c0
Mangue Baja Box

Who changed what in which revision?

UserRevisionLine numberNew contents of line
einsteingustavo 0:0dee8840a1c0 1 /**
einsteingustavo 0:0dee8840a1c0 2 ******************************************************************************
einsteingustavo 0:0dee8840a1c0 3 * @file stm32f10x_cec.h
einsteingustavo 0:0dee8840a1c0 4 * @author MCD Application Team
einsteingustavo 0:0dee8840a1c0 5 * @version V3.6.1
einsteingustavo 0:0dee8840a1c0 6 * @date 05-March-2012
einsteingustavo 0:0dee8840a1c0 7 * @brief This file contains all the functions prototypes for the CEC firmware
einsteingustavo 0:0dee8840a1c0 8 * library.
einsteingustavo 0:0dee8840a1c0 9 *******************************************************************************
einsteingustavo 0:0dee8840a1c0 10 * Copyright (c) 2014, STMicroelectronics
einsteingustavo 0:0dee8840a1c0 11 * All rights reserved.
einsteingustavo 0:0dee8840a1c0 12 *
einsteingustavo 0:0dee8840a1c0 13 * Redistribution and use in source and binary forms, with or without
einsteingustavo 0:0dee8840a1c0 14 * modification, are permitted provided that the following conditions are met:
einsteingustavo 0:0dee8840a1c0 15 *
einsteingustavo 0:0dee8840a1c0 16 * 1. Redistributions of source code must retain the above copyright notice,
einsteingustavo 0:0dee8840a1c0 17 * this list of conditions and the following disclaimer.
einsteingustavo 0:0dee8840a1c0 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
einsteingustavo 0:0dee8840a1c0 19 * this list of conditions and the following disclaimer in the documentation
einsteingustavo 0:0dee8840a1c0 20 * and/or other materials provided with the distribution.
einsteingustavo 0:0dee8840a1c0 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
einsteingustavo 0:0dee8840a1c0 22 * may be used to endorse or promote products derived from this software
einsteingustavo 0:0dee8840a1c0 23 * without specific prior written permission.
einsteingustavo 0:0dee8840a1c0 24 *
einsteingustavo 0:0dee8840a1c0 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
einsteingustavo 0:0dee8840a1c0 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
einsteingustavo 0:0dee8840a1c0 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
einsteingustavo 0:0dee8840a1c0 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
einsteingustavo 0:0dee8840a1c0 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
einsteingustavo 0:0dee8840a1c0 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
einsteingustavo 0:0dee8840a1c0 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
einsteingustavo 0:0dee8840a1c0 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
einsteingustavo 0:0dee8840a1c0 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
einsteingustavo 0:0dee8840a1c0 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
einsteingustavo 0:0dee8840a1c0 35 *******************************************************************************
einsteingustavo 0:0dee8840a1c0 36 */
einsteingustavo 0:0dee8840a1c0 37
einsteingustavo 0:0dee8840a1c0 38 /* Define to prevent recursive inclusion -------------------------------------*/
einsteingustavo 0:0dee8840a1c0 39 #ifndef __STM32F10x_CEC_H
einsteingustavo 0:0dee8840a1c0 40 #define __STM32F10x_CEC_H
einsteingustavo 0:0dee8840a1c0 41
einsteingustavo 0:0dee8840a1c0 42 #ifdef __cplusplus
einsteingustavo 0:0dee8840a1c0 43 extern "C" {
einsteingustavo 0:0dee8840a1c0 44 #endif
einsteingustavo 0:0dee8840a1c0 45
einsteingustavo 0:0dee8840a1c0 46 /* Includes ------------------------------------------------------------------*/
einsteingustavo 0:0dee8840a1c0 47 #include "stm32f10x.h"
einsteingustavo 0:0dee8840a1c0 48
einsteingustavo 0:0dee8840a1c0 49 /** @addtogroup STM32F10x_StdPeriph_Driver
einsteingustavo 0:0dee8840a1c0 50 * @{
einsteingustavo 0:0dee8840a1c0 51 */
einsteingustavo 0:0dee8840a1c0 52
einsteingustavo 0:0dee8840a1c0 53 /** @addtogroup CEC
einsteingustavo 0:0dee8840a1c0 54 * @{
einsteingustavo 0:0dee8840a1c0 55 */
einsteingustavo 0:0dee8840a1c0 56
einsteingustavo 0:0dee8840a1c0 57
einsteingustavo 0:0dee8840a1c0 58 /** @defgroup CEC_Exported_Types
einsteingustavo 0:0dee8840a1c0 59 * @{
einsteingustavo 0:0dee8840a1c0 60 */
einsteingustavo 0:0dee8840a1c0 61
einsteingustavo 0:0dee8840a1c0 62 /**
einsteingustavo 0:0dee8840a1c0 63 * @brief CEC Init structure definition
einsteingustavo 0:0dee8840a1c0 64 */
einsteingustavo 0:0dee8840a1c0 65 typedef struct
einsteingustavo 0:0dee8840a1c0 66 {
einsteingustavo 0:0dee8840a1c0 67 uint16_t CEC_BitTimingMode; /*!< Configures the CEC Bit Timing Error Mode.
einsteingustavo 0:0dee8840a1c0 68 This parameter can be a value of @ref CEC_BitTiming_Mode */
einsteingustavo 0:0dee8840a1c0 69 uint16_t CEC_BitPeriodMode; /*!< Configures the CEC Bit Period Error Mode.
einsteingustavo 0:0dee8840a1c0 70 This parameter can be a value of @ref CEC_BitPeriod_Mode */
einsteingustavo 0:0dee8840a1c0 71 }CEC_InitTypeDef;
einsteingustavo 0:0dee8840a1c0 72
einsteingustavo 0:0dee8840a1c0 73 /**
einsteingustavo 0:0dee8840a1c0 74 * @}
einsteingustavo 0:0dee8840a1c0 75 */
einsteingustavo 0:0dee8840a1c0 76
einsteingustavo 0:0dee8840a1c0 77 /** @defgroup CEC_Exported_Constants
einsteingustavo 0:0dee8840a1c0 78 * @{
einsteingustavo 0:0dee8840a1c0 79 */
einsteingustavo 0:0dee8840a1c0 80
einsteingustavo 0:0dee8840a1c0 81 /** @defgroup CEC_BitTiming_Mode
einsteingustavo 0:0dee8840a1c0 82 * @{
einsteingustavo 0:0dee8840a1c0 83 */
einsteingustavo 0:0dee8840a1c0 84 #define CEC_BitTimingStdMode ((uint16_t)0x00) /*!< Bit timing error Standard Mode */
einsteingustavo 0:0dee8840a1c0 85 #define CEC_BitTimingErrFreeMode CEC_CFGR_BTEM /*!< Bit timing error Free Mode */
einsteingustavo 0:0dee8840a1c0 86
einsteingustavo 0:0dee8840a1c0 87 #define IS_CEC_BIT_TIMING_ERROR_MODE(MODE) (((MODE) == CEC_BitTimingStdMode) || \
einsteingustavo 0:0dee8840a1c0 88 ((MODE) == CEC_BitTimingErrFreeMode))
einsteingustavo 0:0dee8840a1c0 89 /**
einsteingustavo 0:0dee8840a1c0 90 * @}
einsteingustavo 0:0dee8840a1c0 91 */
einsteingustavo 0:0dee8840a1c0 92
einsteingustavo 0:0dee8840a1c0 93 /** @defgroup CEC_BitPeriod_Mode
einsteingustavo 0:0dee8840a1c0 94 * @{
einsteingustavo 0:0dee8840a1c0 95 */
einsteingustavo 0:0dee8840a1c0 96 #define CEC_BitPeriodStdMode ((uint16_t)0x00) /*!< Bit period error Standard Mode */
einsteingustavo 0:0dee8840a1c0 97 #define CEC_BitPeriodFlexibleMode CEC_CFGR_BPEM /*!< Bit period error Flexible Mode */
einsteingustavo 0:0dee8840a1c0 98
einsteingustavo 0:0dee8840a1c0 99 #define IS_CEC_BIT_PERIOD_ERROR_MODE(MODE) (((MODE) == CEC_BitPeriodStdMode) || \
einsteingustavo 0:0dee8840a1c0 100 ((MODE) == CEC_BitPeriodFlexibleMode))
einsteingustavo 0:0dee8840a1c0 101 /**
einsteingustavo 0:0dee8840a1c0 102 * @}
einsteingustavo 0:0dee8840a1c0 103 */
einsteingustavo 0:0dee8840a1c0 104
einsteingustavo 0:0dee8840a1c0 105
einsteingustavo 0:0dee8840a1c0 106 /** @defgroup CEC_interrupts_definition
einsteingustavo 0:0dee8840a1c0 107 * @{
einsteingustavo 0:0dee8840a1c0 108 */
einsteingustavo 0:0dee8840a1c0 109 #define CEC_IT_TERR CEC_CSR_TERR
einsteingustavo 0:0dee8840a1c0 110 #define CEC_IT_TBTRF CEC_CSR_TBTRF
einsteingustavo 0:0dee8840a1c0 111 #define CEC_IT_RERR CEC_CSR_RERR
einsteingustavo 0:0dee8840a1c0 112 #define CEC_IT_RBTF CEC_CSR_RBTF
einsteingustavo 0:0dee8840a1c0 113 #define IS_CEC_GET_IT(IT) (((IT) == CEC_IT_TERR) || ((IT) == CEC_IT_TBTRF) || \
einsteingustavo 0:0dee8840a1c0 114 ((IT) == CEC_IT_RERR) || ((IT) == CEC_IT_RBTF))
einsteingustavo 0:0dee8840a1c0 115 /**
einsteingustavo 0:0dee8840a1c0 116 * @}
einsteingustavo 0:0dee8840a1c0 117 */
einsteingustavo 0:0dee8840a1c0 118
einsteingustavo 0:0dee8840a1c0 119
einsteingustavo 0:0dee8840a1c0 120 /** @defgroup CEC_Own_Address
einsteingustavo 0:0dee8840a1c0 121 * @{
einsteingustavo 0:0dee8840a1c0 122 */
einsteingustavo 0:0dee8840a1c0 123 #define IS_CEC_ADDRESS(ADDRESS) ((ADDRESS) < 0x10)
einsteingustavo 0:0dee8840a1c0 124 /**
einsteingustavo 0:0dee8840a1c0 125 * @}
einsteingustavo 0:0dee8840a1c0 126 */
einsteingustavo 0:0dee8840a1c0 127
einsteingustavo 0:0dee8840a1c0 128 /** @defgroup CEC_Prescaler
einsteingustavo 0:0dee8840a1c0 129 * @{
einsteingustavo 0:0dee8840a1c0 130 */
einsteingustavo 0:0dee8840a1c0 131 #define IS_CEC_PRESCALER(PRESCALER) ((PRESCALER) <= 0x3FFF)
einsteingustavo 0:0dee8840a1c0 132
einsteingustavo 0:0dee8840a1c0 133 /**
einsteingustavo 0:0dee8840a1c0 134 * @}
einsteingustavo 0:0dee8840a1c0 135 */
einsteingustavo 0:0dee8840a1c0 136
einsteingustavo 0:0dee8840a1c0 137 /** @defgroup CEC_flags_definition
einsteingustavo 0:0dee8840a1c0 138 * @{
einsteingustavo 0:0dee8840a1c0 139 */
einsteingustavo 0:0dee8840a1c0 140
einsteingustavo 0:0dee8840a1c0 141 /**
einsteingustavo 0:0dee8840a1c0 142 * @brief ESR register flags
einsteingustavo 0:0dee8840a1c0 143 */
einsteingustavo 0:0dee8840a1c0 144 #define CEC_FLAG_BTE ((uint32_t)0x10010000)
einsteingustavo 0:0dee8840a1c0 145 #define CEC_FLAG_BPE ((uint32_t)0x10020000)
einsteingustavo 0:0dee8840a1c0 146 #define CEC_FLAG_RBTFE ((uint32_t)0x10040000)
einsteingustavo 0:0dee8840a1c0 147 #define CEC_FLAG_SBE ((uint32_t)0x10080000)
einsteingustavo 0:0dee8840a1c0 148 #define CEC_FLAG_ACKE ((uint32_t)0x10100000)
einsteingustavo 0:0dee8840a1c0 149 #define CEC_FLAG_LINE ((uint32_t)0x10200000)
einsteingustavo 0:0dee8840a1c0 150 #define CEC_FLAG_TBTFE ((uint32_t)0x10400000)
einsteingustavo 0:0dee8840a1c0 151
einsteingustavo 0:0dee8840a1c0 152 /**
einsteingustavo 0:0dee8840a1c0 153 * @brief CSR register flags
einsteingustavo 0:0dee8840a1c0 154 */
einsteingustavo 0:0dee8840a1c0 155 #define CEC_FLAG_TEOM ((uint32_t)0x00000002)
einsteingustavo 0:0dee8840a1c0 156 #define CEC_FLAG_TERR ((uint32_t)0x00000004)
einsteingustavo 0:0dee8840a1c0 157 #define CEC_FLAG_TBTRF ((uint32_t)0x00000008)
einsteingustavo 0:0dee8840a1c0 158 #define CEC_FLAG_RSOM ((uint32_t)0x00000010)
einsteingustavo 0:0dee8840a1c0 159 #define CEC_FLAG_REOM ((uint32_t)0x00000020)
einsteingustavo 0:0dee8840a1c0 160 #define CEC_FLAG_RERR ((uint32_t)0x00000040)
einsteingustavo 0:0dee8840a1c0 161 #define CEC_FLAG_RBTF ((uint32_t)0x00000080)
einsteingustavo 0:0dee8840a1c0 162
einsteingustavo 0:0dee8840a1c0 163 #define IS_CEC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFF03) == 0x00) && ((FLAG) != 0x00))
einsteingustavo 0:0dee8840a1c0 164
einsteingustavo 0:0dee8840a1c0 165 #define IS_CEC_GET_FLAG(FLAG) (((FLAG) == CEC_FLAG_BTE) || ((FLAG) == CEC_FLAG_BPE) || \
einsteingustavo 0:0dee8840a1c0 166 ((FLAG) == CEC_FLAG_RBTFE) || ((FLAG)== CEC_FLAG_SBE) || \
einsteingustavo 0:0dee8840a1c0 167 ((FLAG) == CEC_FLAG_ACKE) || ((FLAG) == CEC_FLAG_LINE) || \
einsteingustavo 0:0dee8840a1c0 168 ((FLAG) == CEC_FLAG_TBTFE) || ((FLAG) == CEC_FLAG_TEOM) || \
einsteingustavo 0:0dee8840a1c0 169 ((FLAG) == CEC_FLAG_TERR) || ((FLAG) == CEC_FLAG_TBTRF) || \
einsteingustavo 0:0dee8840a1c0 170 ((FLAG) == CEC_FLAG_RSOM) || ((FLAG) == CEC_FLAG_REOM) || \
einsteingustavo 0:0dee8840a1c0 171 ((FLAG) == CEC_FLAG_RERR) || ((FLAG) == CEC_FLAG_RBTF))
einsteingustavo 0:0dee8840a1c0 172
einsteingustavo 0:0dee8840a1c0 173 /**
einsteingustavo 0:0dee8840a1c0 174 * @}
einsteingustavo 0:0dee8840a1c0 175 */
einsteingustavo 0:0dee8840a1c0 176
einsteingustavo 0:0dee8840a1c0 177 /**
einsteingustavo 0:0dee8840a1c0 178 * @}
einsteingustavo 0:0dee8840a1c0 179 */
einsteingustavo 0:0dee8840a1c0 180
einsteingustavo 0:0dee8840a1c0 181 /** @defgroup CEC_Exported_Macros
einsteingustavo 0:0dee8840a1c0 182 * @{
einsteingustavo 0:0dee8840a1c0 183 */
einsteingustavo 0:0dee8840a1c0 184
einsteingustavo 0:0dee8840a1c0 185 /**
einsteingustavo 0:0dee8840a1c0 186 * @}
einsteingustavo 0:0dee8840a1c0 187 */
einsteingustavo 0:0dee8840a1c0 188
einsteingustavo 0:0dee8840a1c0 189 /** @defgroup CEC_Exported_Functions
einsteingustavo 0:0dee8840a1c0 190 * @{
einsteingustavo 0:0dee8840a1c0 191 */
einsteingustavo 0:0dee8840a1c0 192 void CEC_DeInit(void);
einsteingustavo 0:0dee8840a1c0 193 void CEC_Init(CEC_InitTypeDef* CEC_InitStruct);
einsteingustavo 0:0dee8840a1c0 194 void CEC_Cmd(FunctionalState NewState);
einsteingustavo 0:0dee8840a1c0 195 void CEC_ITConfig(FunctionalState NewState);
einsteingustavo 0:0dee8840a1c0 196 void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress);
einsteingustavo 0:0dee8840a1c0 197 void CEC_SetPrescaler(uint16_t CEC_Prescaler);
einsteingustavo 0:0dee8840a1c0 198 void CEC_SendDataByte(uint8_t Data);
einsteingustavo 0:0dee8840a1c0 199 uint8_t CEC_ReceiveDataByte(void);
einsteingustavo 0:0dee8840a1c0 200 void CEC_StartOfMessage(void);
einsteingustavo 0:0dee8840a1c0 201 void CEC_EndOfMessageCmd(FunctionalState NewState);
einsteingustavo 0:0dee8840a1c0 202 FlagStatus CEC_GetFlagStatus(uint32_t CEC_FLAG);
einsteingustavo 0:0dee8840a1c0 203 void CEC_ClearFlag(uint32_t CEC_FLAG);
einsteingustavo 0:0dee8840a1c0 204 ITStatus CEC_GetITStatus(uint8_t CEC_IT);
einsteingustavo 0:0dee8840a1c0 205 void CEC_ClearITPendingBit(uint16_t CEC_IT);
einsteingustavo 0:0dee8840a1c0 206
einsteingustavo 0:0dee8840a1c0 207 #ifdef __cplusplus
einsteingustavo 0:0dee8840a1c0 208 }
einsteingustavo 0:0dee8840a1c0 209 #endif
einsteingustavo 0:0dee8840a1c0 210
einsteingustavo 0:0dee8840a1c0 211 #endif /* __STM32F10x_CEC_H */
einsteingustavo 0:0dee8840a1c0 212
einsteingustavo 0:0dee8840a1c0 213 /**
einsteingustavo 0:0dee8840a1c0 214 * @}
einsteingustavo 0:0dee8840a1c0 215 */
einsteingustavo 0:0dee8840a1c0 216
einsteingustavo 0:0dee8840a1c0 217 /**
einsteingustavo 0:0dee8840a1c0 218 * @}
einsteingustavo 0:0dee8840a1c0 219 */
einsteingustavo 0:0dee8840a1c0 220
einsteingustavo 0:0dee8840a1c0 221 /**
einsteingustavo 0:0dee8840a1c0 222 * @}
einsteingustavo 0:0dee8840a1c0 223 */
einsteingustavo 0:0dee8840a1c0 224
einsteingustavo 0:0dee8840a1c0 225 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
einsteingustavo 0:0dee8840a1c0 226