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:
Kojto
Date:
Wed Sep 16 15:32:31 2015 +0100
Revision:
107:4f6c30876dfa
Release 107  of the mbed library

Changes:
- new platforms - DISCO_F746NG, DISCO_L476VG, NUCLEO_L476RG
- KL43Z - bugfix RTC init function
- K20 - SPI mode fix

Who changed what in which revision?

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