Yihui Xiong / nrf51822_fix_i2c_spi_conflict

Dependencies:   BLE_API eMPL_MPU6050 nRF51822

Fork of Seeed_Tiny_BLE_Flash by Darren Huang

Committer:
yihui
Date:
Tue Nov 17 07:48:56 2015 +0000
Revision:
5:b8c02645e6af
fix i2c & spi conflict

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yihui 5:b8c02645e6af 1 /**
yihui 5:b8c02645e6af 2 ******************************************************************************
yihui 5:b8c02645e6af 3 * @file stm32f3xx_hal_smartcard_ex.h
yihui 5:b8c02645e6af 4 * @author MCD Application Team
yihui 5:b8c02645e6af 5 * @version V1.1.0
yihui 5:b8c02645e6af 6 * @date 12-Sept-2014
yihui 5:b8c02645e6af 7 * @brief Header file of SMARTCARD HAL module.
yihui 5:b8c02645e6af 8 ******************************************************************************
yihui 5:b8c02645e6af 9 * @attention
yihui 5:b8c02645e6af 10 *
yihui 5:b8c02645e6af 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
yihui 5:b8c02645e6af 12 *
yihui 5:b8c02645e6af 13 * Redistribution and use in source and binary forms, with or without modification,
yihui 5:b8c02645e6af 14 * are permitted provided that the following conditions are met:
yihui 5:b8c02645e6af 15 * 1. Redistributions of source code must retain the above copyright notice,
yihui 5:b8c02645e6af 16 * this list of conditions and the following disclaimer.
yihui 5:b8c02645e6af 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
yihui 5:b8c02645e6af 18 * this list of conditions and the following disclaimer in the documentation
yihui 5:b8c02645e6af 19 * and/or other materials provided with the distribution.
yihui 5:b8c02645e6af 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
yihui 5:b8c02645e6af 21 * may be used to endorse or promote products derived from this software
yihui 5:b8c02645e6af 22 * without specific prior written permission.
yihui 5:b8c02645e6af 23 *
yihui 5:b8c02645e6af 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
yihui 5:b8c02645e6af 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
yihui 5:b8c02645e6af 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
yihui 5:b8c02645e6af 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
yihui 5:b8c02645e6af 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
yihui 5:b8c02645e6af 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
yihui 5:b8c02645e6af 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
yihui 5:b8c02645e6af 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
yihui 5:b8c02645e6af 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
yihui 5:b8c02645e6af 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
yihui 5:b8c02645e6af 34 *
yihui 5:b8c02645e6af 35 ******************************************************************************
yihui 5:b8c02645e6af 36 */
yihui 5:b8c02645e6af 37
yihui 5:b8c02645e6af 38 /* Define to prevent recursive inclusion -------------------------------------*/
yihui 5:b8c02645e6af 39 #ifndef __STM32F3xx_HAL_SMARTCARD_EX_H
yihui 5:b8c02645e6af 40 #define __STM32F3xx_HAL_SMARTCARD_EX_H
yihui 5:b8c02645e6af 41
yihui 5:b8c02645e6af 42 #ifdef __cplusplus
yihui 5:b8c02645e6af 43 extern "C" {
yihui 5:b8c02645e6af 44 #endif
yihui 5:b8c02645e6af 45
yihui 5:b8c02645e6af 46 /* Includes ------------------------------------------------------------------*/
yihui 5:b8c02645e6af 47 #include "stm32f3xx_hal_def.h"
yihui 5:b8c02645e6af 48
yihui 5:b8c02645e6af 49 /** @addtogroup STM32F3xx_HAL_Driver
yihui 5:b8c02645e6af 50 * @{
yihui 5:b8c02645e6af 51 */
yihui 5:b8c02645e6af 52
yihui 5:b8c02645e6af 53 /** @addtogroup SMARTCARDEx SMARTCARD Extended HAL module driver
yihui 5:b8c02645e6af 54 * @{
yihui 5:b8c02645e6af 55 */
yihui 5:b8c02645e6af 56
yihui 5:b8c02645e6af 57 /* Exported types ------------------------------------------------------------*/
yihui 5:b8c02645e6af 58 /* Exported constants --------------------------------------------------------*/
yihui 5:b8c02645e6af 59 /* Exported macro ------------------------------------------------------------*/
yihui 5:b8c02645e6af 60
yihui 5:b8c02645e6af 61 /** @defgroup SMARTCARDEx_Exported_Macros SMARTCARD Extended Exported Macros
yihui 5:b8c02645e6af 62 * @{
yihui 5:b8c02645e6af 63 */
yihui 5:b8c02645e6af 64
yihui 5:b8c02645e6af 65 /** @brief Reports the SMARTCARD clock source.
yihui 5:b8c02645e6af 66 * @param __HANDLE__: specifies the SMARTCARD Handle
yihui 5:b8c02645e6af 67 * @param __CLOCKSOURCE__ : output variable
yihui 5:b8c02645e6af 68 * @retval the SMARTCARD clocking source, written in __CLOCKSOURCE__.
yihui 5:b8c02645e6af 69 */
yihui 5:b8c02645e6af 70 #if defined(STM32F334x8) || defined(STM32F303x8) || defined(STM32F328xx)
yihui 5:b8c02645e6af 71 #define __HAL_SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
yihui 5:b8c02645e6af 72 do { \
yihui 5:b8c02645e6af 73 if((__HANDLE__)->Instance == USART1) \
yihui 5:b8c02645e6af 74 { \
yihui 5:b8c02645e6af 75 switch(__HAL_RCC_GET_USART1_SOURCE()) \
yihui 5:b8c02645e6af 76 { \
yihui 5:b8c02645e6af 77 case RCC_USART1CLKSOURCE_PCLK1: \
yihui 5:b8c02645e6af 78 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
yihui 5:b8c02645e6af 79 break; \
yihui 5:b8c02645e6af 80 case RCC_USART1CLKSOURCE_HSI: \
yihui 5:b8c02645e6af 81 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
yihui 5:b8c02645e6af 82 break; \
yihui 5:b8c02645e6af 83 case RCC_USART1CLKSOURCE_SYSCLK: \
yihui 5:b8c02645e6af 84 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
yihui 5:b8c02645e6af 85 break; \
yihui 5:b8c02645e6af 86 case RCC_USART1CLKSOURCE_LSE: \
yihui 5:b8c02645e6af 87 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
yihui 5:b8c02645e6af 88 break; \
yihui 5:b8c02645e6af 89 } \
yihui 5:b8c02645e6af 90 } \
yihui 5:b8c02645e6af 91 else if((__HANDLE__)->Instance == USART2) \
yihui 5:b8c02645e6af 92 { \
yihui 5:b8c02645e6af 93 switch(__HAL_RCC_GET_USART2_SOURCE()) \
yihui 5:b8c02645e6af 94 { \
yihui 5:b8c02645e6af 95 case RCC_USART2CLKSOURCE_PCLK1: \
yihui 5:b8c02645e6af 96 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
yihui 5:b8c02645e6af 97 break; \
yihui 5:b8c02645e6af 98 case RCC_USART2CLKSOURCE_HSI: \
yihui 5:b8c02645e6af 99 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
yihui 5:b8c02645e6af 100 break; \
yihui 5:b8c02645e6af 101 case RCC_USART2CLKSOURCE_SYSCLK: \
yihui 5:b8c02645e6af 102 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
yihui 5:b8c02645e6af 103 break; \
yihui 5:b8c02645e6af 104 case RCC_USART2CLKSOURCE_LSE: \
yihui 5:b8c02645e6af 105 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
yihui 5:b8c02645e6af 106 break; \
yihui 5:b8c02645e6af 107 } \
yihui 5:b8c02645e6af 108 } \
yihui 5:b8c02645e6af 109 else if((__HANDLE__)->Instance == USART3) \
yihui 5:b8c02645e6af 110 { \
yihui 5:b8c02645e6af 111 switch(__HAL_RCC_GET_USART3_SOURCE()) \
yihui 5:b8c02645e6af 112 { \
yihui 5:b8c02645e6af 113 case RCC_USART3CLKSOURCE_PCLK1: \
yihui 5:b8c02645e6af 114 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
yihui 5:b8c02645e6af 115 break; \
yihui 5:b8c02645e6af 116 case RCC_USART3CLKSOURCE_HSI: \
yihui 5:b8c02645e6af 117 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
yihui 5:b8c02645e6af 118 break; \
yihui 5:b8c02645e6af 119 case RCC_USART3CLKSOURCE_SYSCLK: \
yihui 5:b8c02645e6af 120 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
yihui 5:b8c02645e6af 121 break; \
yihui 5:b8c02645e6af 122 case RCC_USART3CLKSOURCE_LSE: \
yihui 5:b8c02645e6af 123 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
yihui 5:b8c02645e6af 124 break; \
yihui 5:b8c02645e6af 125 } \
yihui 5:b8c02645e6af 126 } \
yihui 5:b8c02645e6af 127 } while(0)
yihui 5:b8c02645e6af 128 #else
yihui 5:b8c02645e6af 129 #define __HAL_SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
yihui 5:b8c02645e6af 130 do { \
yihui 5:b8c02645e6af 131 if((__HANDLE__)->Instance == USART1) \
yihui 5:b8c02645e6af 132 { \
yihui 5:b8c02645e6af 133 switch(__HAL_RCC_GET_USART1_SOURCE()) \
yihui 5:b8c02645e6af 134 { \
yihui 5:b8c02645e6af 135 case RCC_USART1CLKSOURCE_PCLK2: \
yihui 5:b8c02645e6af 136 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK2; \
yihui 5:b8c02645e6af 137 break; \
yihui 5:b8c02645e6af 138 case RCC_USART1CLKSOURCE_HSI: \
yihui 5:b8c02645e6af 139 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
yihui 5:b8c02645e6af 140 break; \
yihui 5:b8c02645e6af 141 case RCC_USART1CLKSOURCE_SYSCLK: \
yihui 5:b8c02645e6af 142 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
yihui 5:b8c02645e6af 143 break; \
yihui 5:b8c02645e6af 144 case RCC_USART1CLKSOURCE_LSE: \
yihui 5:b8c02645e6af 145 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
yihui 5:b8c02645e6af 146 break; \
yihui 5:b8c02645e6af 147 } \
yihui 5:b8c02645e6af 148 } \
yihui 5:b8c02645e6af 149 else if((__HANDLE__)->Instance == USART2) \
yihui 5:b8c02645e6af 150 { \
yihui 5:b8c02645e6af 151 switch(__HAL_RCC_GET_USART2_SOURCE()) \
yihui 5:b8c02645e6af 152 { \
yihui 5:b8c02645e6af 153 case RCC_USART2CLKSOURCE_PCLK1: \
yihui 5:b8c02645e6af 154 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
yihui 5:b8c02645e6af 155 break; \
yihui 5:b8c02645e6af 156 case RCC_USART2CLKSOURCE_HSI: \
yihui 5:b8c02645e6af 157 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
yihui 5:b8c02645e6af 158 break; \
yihui 5:b8c02645e6af 159 case RCC_USART2CLKSOURCE_SYSCLK: \
yihui 5:b8c02645e6af 160 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
yihui 5:b8c02645e6af 161 break; \
yihui 5:b8c02645e6af 162 case RCC_USART2CLKSOURCE_LSE: \
yihui 5:b8c02645e6af 163 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
yihui 5:b8c02645e6af 164 break; \
yihui 5:b8c02645e6af 165 } \
yihui 5:b8c02645e6af 166 } \
yihui 5:b8c02645e6af 167 else if((__HANDLE__)->Instance == USART3) \
yihui 5:b8c02645e6af 168 { \
yihui 5:b8c02645e6af 169 switch(__HAL_RCC_GET_USART3_SOURCE()) \
yihui 5:b8c02645e6af 170 { \
yihui 5:b8c02645e6af 171 case RCC_USART3CLKSOURCE_PCLK1: \
yihui 5:b8c02645e6af 172 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
yihui 5:b8c02645e6af 173 break; \
yihui 5:b8c02645e6af 174 case RCC_USART3CLKSOURCE_HSI: \
yihui 5:b8c02645e6af 175 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
yihui 5:b8c02645e6af 176 break; \
yihui 5:b8c02645e6af 177 case RCC_USART3CLKSOURCE_SYSCLK: \
yihui 5:b8c02645e6af 178 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
yihui 5:b8c02645e6af 179 break; \
yihui 5:b8c02645e6af 180 case RCC_USART3CLKSOURCE_LSE: \
yihui 5:b8c02645e6af 181 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
yihui 5:b8c02645e6af 182 break; \
yihui 5:b8c02645e6af 183 } \
yihui 5:b8c02645e6af 184 } \
yihui 5:b8c02645e6af 185 } while(0)
yihui 5:b8c02645e6af 186 #endif
yihui 5:b8c02645e6af 187
yihui 5:b8c02645e6af 188 /**
yihui 5:b8c02645e6af 189 * @}
yihui 5:b8c02645e6af 190 */
yihui 5:b8c02645e6af 191
yihui 5:b8c02645e6af 192
yihui 5:b8c02645e6af 193 /* Exported functions --------------------------------------------------------*/
yihui 5:b8c02645e6af 194 /** @addtogroup SMARTCARDEx_Exported_Functions SMARTCARD Extended Exported Functions
yihui 5:b8c02645e6af 195 * @{
yihui 5:b8c02645e6af 196 */
yihui 5:b8c02645e6af 197
yihui 5:b8c02645e6af 198 /* Initialization and de-initialization functions ****************************/
yihui 5:b8c02645e6af 199 /* IO operation functions *****************************************************/
yihui 5:b8c02645e6af 200 /* Peripheral Control functions ***********************************************/
yihui 5:b8c02645e6af 201 /** @addtogroup SMARTCARDEx_Exported_Functions_Group1 Extended Peripheral Control functions
yihui 5:b8c02645e6af 202 * @{
yihui 5:b8c02645e6af 203 */
yihui 5:b8c02645e6af 204 void HAL_SMARTCARDEx_BlockLength_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t BlockLength);
yihui 5:b8c02645e6af 205 void HAL_SMARTCARDEx_TimeOut_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint32_t TimeOutValue);
yihui 5:b8c02645e6af 206 HAL_StatusTypeDef HAL_SMARTCARDEx_EnableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard);
yihui 5:b8c02645e6af 207 HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard);
yihui 5:b8c02645e6af 208
yihui 5:b8c02645e6af 209 /* Peripheral State and Error functions ***************************************/
yihui 5:b8c02645e6af 210
yihui 5:b8c02645e6af 211 /**
yihui 5:b8c02645e6af 212 * @}
yihui 5:b8c02645e6af 213 */
yihui 5:b8c02645e6af 214
yihui 5:b8c02645e6af 215 /**
yihui 5:b8c02645e6af 216 * @}
yihui 5:b8c02645e6af 217 */
yihui 5:b8c02645e6af 218
yihui 5:b8c02645e6af 219 /**
yihui 5:b8c02645e6af 220 * @}
yihui 5:b8c02645e6af 221 */
yihui 5:b8c02645e6af 222
yihui 5:b8c02645e6af 223 /**
yihui 5:b8c02645e6af 224 * @}
yihui 5:b8c02645e6af 225 */
yihui 5:b8c02645e6af 226
yihui 5:b8c02645e6af 227 #ifdef __cplusplus
yihui 5:b8c02645e6af 228 }
yihui 5:b8c02645e6af 229 #endif
yihui 5:b8c02645e6af 230
yihui 5:b8c02645e6af 231 #endif /* __STM32F3xx_HAL_SMARTCARD_EX_H */
yihui 5:b8c02645e6af 232
yihui 5:b8c02645e6af 233 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/