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 mbed official

Committer:
bogdanm
Date:
Wed Jun 11 15:14:05 2014 +0100
Revision:
85:024bf7f99721
Child:
92:4fc01daae5a5
Release 85 of the mbed library

Main changes:

- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F

There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 85:024bf7f99721 1 /**
bogdanm 85:024bf7f99721 2 ******************************************************************************
bogdanm 85:024bf7f99721 3 * @file stm32f0xx.h
bogdanm 85:024bf7f99721 4 * @author MCD Application Team
bogdanm 85:024bf7f99721 5 * @version V2.0.0
bogdanm 85:024bf7f99721 6 * @date 28-May-2014
bogdanm 85:024bf7f99721 7 * @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File.
bogdanm 85:024bf7f99721 8 *
bogdanm 85:024bf7f99721 9 * The file is the unique include file that the application programmer
bogdanm 85:024bf7f99721 10 * is using in the C source code, usually in main.c. This file contains:
bogdanm 85:024bf7f99721 11 * - Configuration section that allows to select:
bogdanm 85:024bf7f99721 12 * - The STM32F0xx device used in the target application
bogdanm 85:024bf7f99721 13 * - To use or not the peripheral’s drivers in application code(i.e.
bogdanm 85:024bf7f99721 14 * code will be based on direct access to peripheral’s registers
bogdanm 85:024bf7f99721 15 * rather than drivers API), this option is controlled by
bogdanm 85:024bf7f99721 16 * "#define USE_HAL_DRIVER"
bogdanm 85:024bf7f99721 17 *
bogdanm 85:024bf7f99721 18 ******************************************************************************
bogdanm 85:024bf7f99721 19 * @attention
bogdanm 85:024bf7f99721 20 *
bogdanm 85:024bf7f99721 21 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 85:024bf7f99721 22 *
bogdanm 85:024bf7f99721 23 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 85:024bf7f99721 24 * are permitted provided that the following conditions are met:
bogdanm 85:024bf7f99721 25 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 85:024bf7f99721 26 * this list of conditions and the following disclaimer.
bogdanm 85:024bf7f99721 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 85:024bf7f99721 28 * this list of conditions and the following disclaimer in the documentation
bogdanm 85:024bf7f99721 29 * and/or other materials provided with the distribution.
bogdanm 85:024bf7f99721 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 85:024bf7f99721 31 * may be used to endorse or promote products derived from this software
bogdanm 85:024bf7f99721 32 * without specific prior written permission.
bogdanm 85:024bf7f99721 33 *
bogdanm 85:024bf7f99721 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 85:024bf7f99721 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 85:024bf7f99721 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 85:024bf7f99721 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 85:024bf7f99721 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 85:024bf7f99721 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 85:024bf7f99721 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 85:024bf7f99721 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 85:024bf7f99721 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 85:024bf7f99721 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 85:024bf7f99721 44 *
bogdanm 85:024bf7f99721 45 ******************************************************************************
bogdanm 85:024bf7f99721 46 */
bogdanm 85:024bf7f99721 47
bogdanm 85:024bf7f99721 48 /** @addtogroup CMSIS
bogdanm 85:024bf7f99721 49 * @{
bogdanm 85:024bf7f99721 50 */
bogdanm 85:024bf7f99721 51
bogdanm 85:024bf7f99721 52 /** @addtogroup stm32f0xx
bogdanm 85:024bf7f99721 53 * @{
bogdanm 85:024bf7f99721 54 */
bogdanm 85:024bf7f99721 55
bogdanm 85:024bf7f99721 56 #ifndef __STM32F0xx_H
bogdanm 85:024bf7f99721 57 #define __STM32F0xx_H
bogdanm 85:024bf7f99721 58
bogdanm 85:024bf7f99721 59 #ifdef __cplusplus
bogdanm 85:024bf7f99721 60 extern "C" {
bogdanm 85:024bf7f99721 61 #endif /* __cplusplus */
bogdanm 85:024bf7f99721 62
bogdanm 85:024bf7f99721 63 /** @addtogroup Library_configuration_section
bogdanm 85:024bf7f99721 64 * @{
bogdanm 85:024bf7f99721 65 */
bogdanm 85:024bf7f99721 66
bogdanm 85:024bf7f99721 67 /* Uncomment the line below according to the target STM32 device used in your
bogdanm 85:024bf7f99721 68 application
bogdanm 85:024bf7f99721 69 */
bogdanm 85:024bf7f99721 70
bogdanm 85:024bf7f99721 71 #if !defined (STM32F030x6) && !defined (STM32F030x8) && \
bogdanm 85:024bf7f99721 72 !defined (STM32F031x6) && !defined (STM32F038xx) && \
bogdanm 85:024bf7f99721 73 !defined (STM32F042x6) && !defined (STM32F048xx) && \
bogdanm 85:024bf7f99721 74 !defined (STM32F051x8) && !defined (STM32F058xx) && \
bogdanm 85:024bf7f99721 75 !defined (STM32F071xB) && !defined (STM32F072xB) && !defined (STM32F078xx)
bogdanm 85:024bf7f99721 76 /* #define STM32F030x6 */ /*!< STM32F030x4, STM32F030x6 Devices (STM32F030xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
bogdanm 85:024bf7f99721 77 /* #define STM32F030x8 */ /*!< STM32F030x8 Devices (STM32F030xx microcontrollers where the Flash memory is 64 Kbytes) */
bogdanm 85:024bf7f99721 78 /* #define STM32F031x6 */ /*!< STM32F031x4, STM32F031x6 Devices (STM32F031xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
bogdanm 85:024bf7f99721 79 /* #define STM32F038xx */ /*!< STM32F038xx Devices (STM32F038xx microcontrollers where the Flash memory is 32 Kbytes) */
bogdanm 85:024bf7f99721 80 /* #define STM32F042x6 */ /*!< STM32F042x4, STM32F042x6 Devices (STM32F042xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
bogdanm 85:024bf7f99721 81 /* #define STM32F048x6 */ /*!< STM32F048xx Devices (STM32F042xx microcontrollers where the Flash memory is 32 Kbytes) */
bogdanm 85:024bf7f99721 82 /* #define STM32F051x8 */ /*!< STM32F051x4, STM32F051x6, STM32F051x8 Devices (STM32F051xx microcontrollers where the Flash memory ranges between 16 and 64 Kbytes) */
bogdanm 85:024bf7f99721 83 /* #define STM32F058xx */ /*!< STM32F058xx Devices (STM32F058xx microcontrollers where the Flash memory is 64 Kbytes) */
bogdanm 85:024bf7f99721 84 /* #define STM32F071xB */ /*!< STM32F071x8, STM32F071xB Devices (STM32F071xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
bogdanm 85:024bf7f99721 85 #define STM32F072xB /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
bogdanm 85:024bf7f99721 86 /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */
bogdanm 85:024bf7f99721 87 #endif
bogdanm 85:024bf7f99721 88
bogdanm 85:024bf7f99721 89 /* Tip: To avoid modifying this file each time you need to switch between these
bogdanm 85:024bf7f99721 90 devices, you can define the device in your toolchain compiler preprocessor.
bogdanm 85:024bf7f99721 91 */
bogdanm 85:024bf7f99721 92 #if !defined (USE_HAL_DRIVER)
bogdanm 85:024bf7f99721 93 /**
bogdanm 85:024bf7f99721 94 * @brief Comment the line below if you will not use the peripherals drivers.
bogdanm 85:024bf7f99721 95 In this case, these drivers will not be included and the application code will
bogdanm 85:024bf7f99721 96 be based on direct access to peripherals registers
bogdanm 85:024bf7f99721 97 */
bogdanm 85:024bf7f99721 98 #define USE_HAL_DRIVER
bogdanm 85:024bf7f99721 99 #endif /* USE_HAL_DRIVER */
bogdanm 85:024bf7f99721 100
bogdanm 85:024bf7f99721 101 /**
bogdanm 85:024bf7f99721 102 * @brief CMSIS Device version number V2.0.0
bogdanm 85:024bf7f99721 103 */
bogdanm 85:024bf7f99721 104 #define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
bogdanm 85:024bf7f99721 105 #define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
bogdanm 85:024bf7f99721 106 #define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
bogdanm 85:024bf7f99721 107 #define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
bogdanm 85:024bf7f99721 108 #define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
bogdanm 85:024bf7f99721 109 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
bogdanm 85:024bf7f99721 110 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
bogdanm 85:024bf7f99721 111 |(__CMSIS_DEVICE_HAL_VERSION_RC))
bogdanm 85:024bf7f99721 112
bogdanm 85:024bf7f99721 113 /**
bogdanm 85:024bf7f99721 114 * @}
bogdanm 85:024bf7f99721 115 */
bogdanm 85:024bf7f99721 116
bogdanm 85:024bf7f99721 117 /** @addtogroup Device_Included
bogdanm 85:024bf7f99721 118 * @{
bogdanm 85:024bf7f99721 119 */
bogdanm 85:024bf7f99721 120
bogdanm 85:024bf7f99721 121 #if defined(STM32F030x6)
bogdanm 85:024bf7f99721 122 #include "stm32f030x6.h"
bogdanm 85:024bf7f99721 123 #elif defined(STM32F030x8)
bogdanm 85:024bf7f99721 124 #include "stm32f030x8.h"
bogdanm 85:024bf7f99721 125 #elif defined(STM32F031x6)
bogdanm 85:024bf7f99721 126 #include "stm32f031x6.h"
bogdanm 85:024bf7f99721 127 #elif defined(STM32F038xx)
bogdanm 85:024bf7f99721 128 #include "stm32f038xx.h"
bogdanm 85:024bf7f99721 129 #elif defined(STM32F042x6)
bogdanm 85:024bf7f99721 130 #include "stm32f042x6.h"
bogdanm 85:024bf7f99721 131 #elif defined(STM32F048xx)
bogdanm 85:024bf7f99721 132 #include "stm32f048xx.h"
bogdanm 85:024bf7f99721 133 #elif defined(STM32F051x8)
bogdanm 85:024bf7f99721 134 #include "stm32f051x8.h"
bogdanm 85:024bf7f99721 135 #elif defined(STM32F058xx)
bogdanm 85:024bf7f99721 136 #include "stm32f058xx.h"
bogdanm 85:024bf7f99721 137 #elif defined(STM32F071xB)
bogdanm 85:024bf7f99721 138 #include "stm32f071xb.h"
bogdanm 85:024bf7f99721 139 #elif defined(STM32F072xB)
bogdanm 85:024bf7f99721 140 #include "stm32f072xb.h"
bogdanm 85:024bf7f99721 141 #elif defined(STM32F078xx)
bogdanm 85:024bf7f99721 142 #include "stm32f078xx.h"
bogdanm 85:024bf7f99721 143 #else
bogdanm 85:024bf7f99721 144 #error "Please select first the target STM32F0xx device used in your application (in stm32f0xx.h file)"
bogdanm 85:024bf7f99721 145 #endif
bogdanm 85:024bf7f99721 146
bogdanm 85:024bf7f99721 147 /**
bogdanm 85:024bf7f99721 148 * @}
bogdanm 85:024bf7f99721 149 */
bogdanm 85:024bf7f99721 150
bogdanm 85:024bf7f99721 151 /** @addtogroup Exported_types
bogdanm 85:024bf7f99721 152 * @{
bogdanm 85:024bf7f99721 153 */
bogdanm 85:024bf7f99721 154 typedef enum
bogdanm 85:024bf7f99721 155 {
bogdanm 85:024bf7f99721 156 RESET = 0,
bogdanm 85:024bf7f99721 157 SET = !RESET
bogdanm 85:024bf7f99721 158 } FlagStatus, ITStatus;
bogdanm 85:024bf7f99721 159
bogdanm 85:024bf7f99721 160 typedef enum
bogdanm 85:024bf7f99721 161 {
bogdanm 85:024bf7f99721 162 DISABLE = 0,
bogdanm 85:024bf7f99721 163 ENABLE = !DISABLE
bogdanm 85:024bf7f99721 164 } FunctionalState;
bogdanm 85:024bf7f99721 165 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
bogdanm 85:024bf7f99721 166
bogdanm 85:024bf7f99721 167 typedef enum
bogdanm 85:024bf7f99721 168 {
bogdanm 85:024bf7f99721 169 ERROR = 0,
bogdanm 85:024bf7f99721 170 SUCCESS = !ERROR
bogdanm 85:024bf7f99721 171 } ErrorStatus;
bogdanm 85:024bf7f99721 172
bogdanm 85:024bf7f99721 173 /**
bogdanm 85:024bf7f99721 174 * @}
bogdanm 85:024bf7f99721 175 */
bogdanm 85:024bf7f99721 176
bogdanm 85:024bf7f99721 177
bogdanm 85:024bf7f99721 178 /** @addtogroup Exported_macros
bogdanm 85:024bf7f99721 179 * @{
bogdanm 85:024bf7f99721 180 */
bogdanm 85:024bf7f99721 181 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
bogdanm 85:024bf7f99721 182
bogdanm 85:024bf7f99721 183 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
bogdanm 85:024bf7f99721 184
bogdanm 85:024bf7f99721 185 #define READ_BIT(REG, BIT) ((REG) & (BIT))
bogdanm 85:024bf7f99721 186
bogdanm 85:024bf7f99721 187 #define CLEAR_REG(REG) ((REG) = (0x0))
bogdanm 85:024bf7f99721 188
bogdanm 85:024bf7f99721 189 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
bogdanm 85:024bf7f99721 190
bogdanm 85:024bf7f99721 191 #define READ_REG(REG) ((REG))
bogdanm 85:024bf7f99721 192
bogdanm 85:024bf7f99721 193 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
bogdanm 85:024bf7f99721 194
bogdanm 85:024bf7f99721 195 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
bogdanm 85:024bf7f99721 196
bogdanm 85:024bf7f99721 197
bogdanm 85:024bf7f99721 198 /**
bogdanm 85:024bf7f99721 199 * @}
bogdanm 85:024bf7f99721 200 */
bogdanm 85:024bf7f99721 201
bogdanm 85:024bf7f99721 202 #if defined (USE_HAL_DRIVER)
bogdanm 85:024bf7f99721 203 #include "stm32f0xx_hal.h"
bogdanm 85:024bf7f99721 204 #endif /* USE_HAL_DRIVER */
bogdanm 85:024bf7f99721 205
bogdanm 85:024bf7f99721 206
bogdanm 85:024bf7f99721 207 #ifdef __cplusplus
bogdanm 85:024bf7f99721 208 }
bogdanm 85:024bf7f99721 209 #endif /* __cplusplus */
bogdanm 85:024bf7f99721 210
bogdanm 85:024bf7f99721 211 #endif /* __STM32F0xx_H */
bogdanm 85:024bf7f99721 212 /**
bogdanm 85:024bf7f99721 213 * @}
bogdanm 85:024bf7f99721 214 */
bogdanm 85:024bf7f99721 215
bogdanm 85:024bf7f99721 216 /**
bogdanm 85:024bf7f99721 217 * @}
bogdanm 85:024bf7f99721 218 */
bogdanm 85:024bf7f99721 219
bogdanm 85:024bf7f99721 220
bogdanm 85:024bf7f99721 221
bogdanm 85:024bf7f99721 222
bogdanm 85:024bf7f99721 223 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/