my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon May 19 18:14:09 2014 +0100
Revision:
84:0b3ab51c8877
Child:
92:4fc01daae5a5
Release 84 of the mbed library

Main changes:

- added LPC11U68 to the official build
- Bug fixes and new features for ST Nucleo boards
- I2C fixes for Freescale targets
- Added nRF51822 exporters

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 84:0b3ab51c8877 1 /**
bogdanm 84:0b3ab51c8877 2 ******************************************************************************
bogdanm 84:0b3ab51c8877 3 * @file stm32l0xx_hal_irda_ex.h
bogdanm 84:0b3ab51c8877 4 * @author MCD Application Team
bogdanm 84:0b3ab51c8877 5 * @version V1.0.0
bogdanm 84:0b3ab51c8877 6 * @date 22-April-2014
bogdanm 84:0b3ab51c8877 7 * @brief Header file of IRDA HAL Extension module.
bogdanm 84:0b3ab51c8877 8 ******************************************************************************
bogdanm 84:0b3ab51c8877 9 * @attention
bogdanm 84:0b3ab51c8877 10 *
bogdanm 84:0b3ab51c8877 11 * <h2><center>&copy; COPYRIGHT(c) 2013 STMicroelectronics</center></h2>
bogdanm 84:0b3ab51c8877 12 *
bogdanm 84:0b3ab51c8877 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 84:0b3ab51c8877 14 * are permitted provided that the following conditions are met:
bogdanm 84:0b3ab51c8877 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 84:0b3ab51c8877 16 * this list of conditions and the following disclaimer.
bogdanm 84:0b3ab51c8877 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 84:0b3ab51c8877 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 84:0b3ab51c8877 19 * and/or other materials provided with the distribution.
bogdanm 84:0b3ab51c8877 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 84:0b3ab51c8877 21 * may be used to endorse or promote products derived from this software
bogdanm 84:0b3ab51c8877 22 * without specific prior written permission.
bogdanm 84:0b3ab51c8877 23 *
bogdanm 84:0b3ab51c8877 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 84:0b3ab51c8877 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 84:0b3ab51c8877 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 84:0b3ab51c8877 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 84:0b3ab51c8877 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 84:0b3ab51c8877 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 84:0b3ab51c8877 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 84:0b3ab51c8877 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 84:0b3ab51c8877 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 84:0b3ab51c8877 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 84:0b3ab51c8877 34 *
bogdanm 84:0b3ab51c8877 35 ******************************************************************************
bogdanm 84:0b3ab51c8877 36 */
bogdanm 84:0b3ab51c8877 37
bogdanm 84:0b3ab51c8877 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 84:0b3ab51c8877 39 #ifndef __STM32L0xx_HAL_IRDA_EX_H
bogdanm 84:0b3ab51c8877 40 #define __STM32L0xx_HAL_IRDA_EX_H
bogdanm 84:0b3ab51c8877 41
bogdanm 84:0b3ab51c8877 42 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 43 extern "C" {
bogdanm 84:0b3ab51c8877 44 #endif
bogdanm 84:0b3ab51c8877 45
bogdanm 84:0b3ab51c8877 46 /* Includes ------------------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 47 #include "stm32l0xx_hal_def.h"
bogdanm 84:0b3ab51c8877 48
bogdanm 84:0b3ab51c8877 49 /** @addtogroup STM32L0xx_HAL_Driver
bogdanm 84:0b3ab51c8877 50 * @{
bogdanm 84:0b3ab51c8877 51 */
bogdanm 84:0b3ab51c8877 52
bogdanm 84:0b3ab51c8877 53 /** @addtogroup IRDAEx
bogdanm 84:0b3ab51c8877 54 * @{
bogdanm 84:0b3ab51c8877 55 */
bogdanm 84:0b3ab51c8877 56
bogdanm 84:0b3ab51c8877 57 /* Exported types ------------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 58 /* Exported constants --------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 59 /** @defgroup IRDAEx_Extended_Exported_Constants
bogdanm 84:0b3ab51c8877 60 * @{
bogdanm 84:0b3ab51c8877 61 */
bogdanm 84:0b3ab51c8877 62
bogdanm 84:0b3ab51c8877 63 /** @defgroup IRDAEx_Word_Length IRDA Word Length
bogdanm 84:0b3ab51c8877 64 * @{
bogdanm 84:0b3ab51c8877 65 */
bogdanm 84:0b3ab51c8877 66 #define IRDA_WORDLENGTH_7B ((uint32_t)USART_CR1_M_1)
bogdanm 84:0b3ab51c8877 67 #define IRDA_WORDLENGTH_8B ((uint32_t)0x00000000)
bogdanm 84:0b3ab51c8877 68 #define IRDA_WORDLENGTH_9B ((uint32_t)USART_CR1_M_0)
bogdanm 84:0b3ab51c8877 69 #define IS_IRDA_WORD_LENGTH(LENGTH) (((LENGTH) == IRDA_WORDLENGTH_7B) || \
bogdanm 84:0b3ab51c8877 70 ((LENGTH) == IRDA_WORDLENGTH_8B) || \
bogdanm 84:0b3ab51c8877 71 ((LENGTH) == IRDA_WORDLENGTH_9B))
bogdanm 84:0b3ab51c8877 72 /**
bogdanm 84:0b3ab51c8877 73 * @}
bogdanm 84:0b3ab51c8877 74 */
bogdanm 84:0b3ab51c8877 75
bogdanm 84:0b3ab51c8877 76
bogdanm 84:0b3ab51c8877 77 /**
bogdanm 84:0b3ab51c8877 78 * @}
bogdanm 84:0b3ab51c8877 79 */
bogdanm 84:0b3ab51c8877 80
bogdanm 84:0b3ab51c8877 81 /* Exported macro ------------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 82
bogdanm 84:0b3ab51c8877 83 /** @defgroup IRDAEx_Extended_Exported_Macros
bogdanm 84:0b3ab51c8877 84 * @{
bogdanm 84:0b3ab51c8877 85 */
bogdanm 84:0b3ab51c8877 86 /** @brief Reports the IRDA clock source.
bogdanm 84:0b3ab51c8877 87 * @param __HANDLE__: specifies the UART Handle
bogdanm 84:0b3ab51c8877 88 * @param __CLOCKSOURCE__ : output variable
bogdanm 84:0b3ab51c8877 89 * @retval IRDA clocking source, written in __CLOCKSOURCE__.
bogdanm 84:0b3ab51c8877 90 */
bogdanm 84:0b3ab51c8877 91 #define __HAL_IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
bogdanm 84:0b3ab51c8877 92 do { \
bogdanm 84:0b3ab51c8877 93 if((__HANDLE__)->Instance == USART1) \
bogdanm 84:0b3ab51c8877 94 { \
bogdanm 84:0b3ab51c8877 95 switch(__HAL_RCC_GET_USART1_SOURCE()) \
bogdanm 84:0b3ab51c8877 96 { \
bogdanm 84:0b3ab51c8877 97 case RCC_USART1CLKSOURCE_PCLK2: \
bogdanm 84:0b3ab51c8877 98 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK2; \
bogdanm 84:0b3ab51c8877 99 break; \
bogdanm 84:0b3ab51c8877 100 case RCC_USART1CLKSOURCE_HSI: \
bogdanm 84:0b3ab51c8877 101 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
bogdanm 84:0b3ab51c8877 102 break; \
bogdanm 84:0b3ab51c8877 103 case RCC_USART1CLKSOURCE_SYSCLK: \
bogdanm 84:0b3ab51c8877 104 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
bogdanm 84:0b3ab51c8877 105 break; \
bogdanm 84:0b3ab51c8877 106 case RCC_USART1CLKSOURCE_LSE: \
bogdanm 84:0b3ab51c8877 107 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
bogdanm 84:0b3ab51c8877 108 break; \
bogdanm 84:0b3ab51c8877 109 default: \
bogdanm 84:0b3ab51c8877 110 break; \
bogdanm 84:0b3ab51c8877 111 } \
bogdanm 84:0b3ab51c8877 112 } \
bogdanm 84:0b3ab51c8877 113 else if((__HANDLE__)->Instance == USART2) \
bogdanm 84:0b3ab51c8877 114 { \
bogdanm 84:0b3ab51c8877 115 switch(__HAL_RCC_GET_USART2_SOURCE()) \
bogdanm 84:0b3ab51c8877 116 { \
bogdanm 84:0b3ab51c8877 117 case RCC_USART2CLKSOURCE_PCLK1: \
bogdanm 84:0b3ab51c8877 118 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 84:0b3ab51c8877 119 break; \
bogdanm 84:0b3ab51c8877 120 case RCC_USART2CLKSOURCE_HSI: \
bogdanm 84:0b3ab51c8877 121 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
bogdanm 84:0b3ab51c8877 122 break; \
bogdanm 84:0b3ab51c8877 123 case RCC_USART2CLKSOURCE_SYSCLK: \
bogdanm 84:0b3ab51c8877 124 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
bogdanm 84:0b3ab51c8877 125 break; \
bogdanm 84:0b3ab51c8877 126 case RCC_USART2CLKSOURCE_LSE: \
bogdanm 84:0b3ab51c8877 127 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
bogdanm 84:0b3ab51c8877 128 break; \
bogdanm 84:0b3ab51c8877 129 default: \
bogdanm 84:0b3ab51c8877 130 break; \
bogdanm 84:0b3ab51c8877 131 } \
bogdanm 84:0b3ab51c8877 132 } \
bogdanm 84:0b3ab51c8877 133 else if((__HANDLE__)->Instance == LPUART1) \
bogdanm 84:0b3ab51c8877 134 { \
bogdanm 84:0b3ab51c8877 135 switch(__HAL_RCC_GET_LPUART1_SOURCE()) \
bogdanm 84:0b3ab51c8877 136 { \
bogdanm 84:0b3ab51c8877 137 case RCC_LPUART1CLKSOURCE_PCLK1: \
bogdanm 84:0b3ab51c8877 138 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
bogdanm 84:0b3ab51c8877 139 break; \
bogdanm 84:0b3ab51c8877 140 case RCC_LPUART1CLKSOURCE_HSI: \
bogdanm 84:0b3ab51c8877 141 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
bogdanm 84:0b3ab51c8877 142 break; \
bogdanm 84:0b3ab51c8877 143 case RCC_LPUART1CLKSOURCE_SYSCLK: \
bogdanm 84:0b3ab51c8877 144 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
bogdanm 84:0b3ab51c8877 145 break; \
bogdanm 84:0b3ab51c8877 146 case RCC_LPUART1CLKSOURCE_LSE: \
bogdanm 84:0b3ab51c8877 147 (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
bogdanm 84:0b3ab51c8877 148 break; \
bogdanm 84:0b3ab51c8877 149 default: \
bogdanm 84:0b3ab51c8877 150 break; \
bogdanm 84:0b3ab51c8877 151 } \
bogdanm 84:0b3ab51c8877 152 } \
bogdanm 84:0b3ab51c8877 153 } while(0)
bogdanm 84:0b3ab51c8877 154
bogdanm 84:0b3ab51c8877 155 /** @brief Reports the mask to apply to retrieve the received data
bogdanm 84:0b3ab51c8877 156 * according to the word length and to the parity bits activation.
bogdanm 84:0b3ab51c8877 157 * @param __HANDLE__: specifies the IRDA Handle
bogdanm 84:0b3ab51c8877 158 * @retval mask to apply to USART RDR register value.
bogdanm 84:0b3ab51c8877 159 */
bogdanm 84:0b3ab51c8877 160 #define __HAL_IRDA_MASK_COMPUTATION(__HANDLE__) \
bogdanm 84:0b3ab51c8877 161 do { \
bogdanm 84:0b3ab51c8877 162 if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_9B) \
bogdanm 84:0b3ab51c8877 163 { \
bogdanm 84:0b3ab51c8877 164 if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
bogdanm 84:0b3ab51c8877 165 { \
bogdanm 84:0b3ab51c8877 166 (__HANDLE__)->Mask = 0x01FF ; \
bogdanm 84:0b3ab51c8877 167 } \
bogdanm 84:0b3ab51c8877 168 else \
bogdanm 84:0b3ab51c8877 169 { \
bogdanm 84:0b3ab51c8877 170 (__HANDLE__)->Mask = 0x00FF ; \
bogdanm 84:0b3ab51c8877 171 } \
bogdanm 84:0b3ab51c8877 172 } \
bogdanm 84:0b3ab51c8877 173 else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_8B) \
bogdanm 84:0b3ab51c8877 174 { \
bogdanm 84:0b3ab51c8877 175 if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
bogdanm 84:0b3ab51c8877 176 { \
bogdanm 84:0b3ab51c8877 177 (__HANDLE__)->Mask = 0x00FF ; \
bogdanm 84:0b3ab51c8877 178 } \
bogdanm 84:0b3ab51c8877 179 else \
bogdanm 84:0b3ab51c8877 180 { \
bogdanm 84:0b3ab51c8877 181 (__HANDLE__)->Mask = 0x007F ; \
bogdanm 84:0b3ab51c8877 182 } \
bogdanm 84:0b3ab51c8877 183 } \
bogdanm 84:0b3ab51c8877 184 else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_7B) \
bogdanm 84:0b3ab51c8877 185 { \
bogdanm 84:0b3ab51c8877 186 if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
bogdanm 84:0b3ab51c8877 187 { \
bogdanm 84:0b3ab51c8877 188 (__HANDLE__)->Mask = 0x007F ; \
bogdanm 84:0b3ab51c8877 189 } \
bogdanm 84:0b3ab51c8877 190 else \
bogdanm 84:0b3ab51c8877 191 { \
bogdanm 84:0b3ab51c8877 192 (__HANDLE__)->Mask = 0x003F ; \
bogdanm 84:0b3ab51c8877 193 } \
bogdanm 84:0b3ab51c8877 194 } \
bogdanm 84:0b3ab51c8877 195 } while(0)
bogdanm 84:0b3ab51c8877 196 /**
bogdanm 84:0b3ab51c8877 197 * @}
bogdanm 84:0b3ab51c8877 198 */
bogdanm 84:0b3ab51c8877 199
bogdanm 84:0b3ab51c8877 200 /* Exported functions --------------------------------------------------------*/
bogdanm 84:0b3ab51c8877 201 /* Initialization/de-initialization methods **********************************/
bogdanm 84:0b3ab51c8877 202 /* IO operation methods *******************************************************/
bogdanm 84:0b3ab51c8877 203 /* Peripheral Control methods ************************************************/
bogdanm 84:0b3ab51c8877 204 /* Peripheral State methods **************************************************/
bogdanm 84:0b3ab51c8877 205
bogdanm 84:0b3ab51c8877 206
bogdanm 84:0b3ab51c8877 207 /**
bogdanm 84:0b3ab51c8877 208 * @}
bogdanm 84:0b3ab51c8877 209 */
bogdanm 84:0b3ab51c8877 210
bogdanm 84:0b3ab51c8877 211 /**
bogdanm 84:0b3ab51c8877 212 * @}
bogdanm 84:0b3ab51c8877 213 */
bogdanm 84:0b3ab51c8877 214
bogdanm 84:0b3ab51c8877 215 #ifdef __cplusplus
bogdanm 84:0b3ab51c8877 216 }
bogdanm 84:0b3ab51c8877 217 #endif
bogdanm 84:0b3ab51c8877 218
bogdanm 84:0b3ab51c8877 219 #endif /* __STM32L0xx_HAL_IRDA_EX_H */
bogdanm 84:0b3ab51c8877 220
bogdanm 84:0b3ab51c8877 221 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/