A simple 128x32 graphical LCD program to quickstart with LCD on ARM mbed IoT Starter Kit. This requires mbed Applciation Shield with FRDM-K64F platform.
mbed/TARGET_NUCLEO_L152RE/stm32l1xx.h@1:eb68c94a8ee5, 2015-04-12 (annotated)
- Committer:
- tushki7
- Date:
- Sun Apr 12 15:45:52 2015 +0000
- Revision:
- 1:eb68c94a8ee5
- Parent:
- 0:60d829a0353a
A simple 128x32 LCD program with ARM mbed IoT Starter Kit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tushki7 | 0:60d829a0353a | 1 | /** |
tushki7 | 0:60d829a0353a | 2 | ****************************************************************************** |
tushki7 | 0:60d829a0353a | 3 | * @file stm32l1xx.h |
tushki7 | 0:60d829a0353a | 4 | * @author MCD Application Team |
tushki7 | 0:60d829a0353a | 5 | * @version V2.0.0 |
tushki7 | 0:60d829a0353a | 6 | * @date 5-September-2014 |
tushki7 | 0:60d829a0353a | 7 | * @brief CMSIS STM32L1xx Device Peripheral Access Layer Header File. |
tushki7 | 0:60d829a0353a | 8 | * |
tushki7 | 0:60d829a0353a | 9 | * The file is the unique include file that the application programmer |
tushki7 | 0:60d829a0353a | 10 | * is using in the C source code, usually in main.c. This file contains: |
tushki7 | 0:60d829a0353a | 11 | * - Configuration section that allows to select: |
tushki7 | 0:60d829a0353a | 12 | * - The STM32L1xx device used in the target application |
tushki7 | 0:60d829a0353a | 13 | * - To use or not the peripherals drivers in application code(i.e. |
tushki7 | 0:60d829a0353a | 14 | * code will be based on direct access to peripherals registers |
tushki7 | 0:60d829a0353a | 15 | * rather than drivers API), this option is controlled by |
tushki7 | 0:60d829a0353a | 16 | * "#define USE_HAL_DRIVER" |
tushki7 | 0:60d829a0353a | 17 | * |
tushki7 | 0:60d829a0353a | 18 | ****************************************************************************** |
tushki7 | 0:60d829a0353a | 19 | * @attention |
tushki7 | 0:60d829a0353a | 20 | * |
tushki7 | 0:60d829a0353a | 21 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
tushki7 | 0:60d829a0353a | 22 | * |
tushki7 | 0:60d829a0353a | 23 | * Redistribution and use in source and binary forms, with or without modification, |
tushki7 | 0:60d829a0353a | 24 | * are permitted provided that the following conditions are met: |
tushki7 | 0:60d829a0353a | 25 | * 1. Redistributions of source code must retain the above copyright notice, |
tushki7 | 0:60d829a0353a | 26 | * this list of conditions and the following disclaimer. |
tushki7 | 0:60d829a0353a | 27 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
tushki7 | 0:60d829a0353a | 28 | * this list of conditions and the following disclaimer in the documentation |
tushki7 | 0:60d829a0353a | 29 | * and/or other materials provided with the distribution. |
tushki7 | 0:60d829a0353a | 30 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
tushki7 | 0:60d829a0353a | 31 | * may be used to endorse or promote products derived from this software |
tushki7 | 0:60d829a0353a | 32 | * without specific prior written permission. |
tushki7 | 0:60d829a0353a | 33 | * |
tushki7 | 0:60d829a0353a | 34 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
tushki7 | 0:60d829a0353a | 35 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
tushki7 | 0:60d829a0353a | 36 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
tushki7 | 0:60d829a0353a | 37 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
tushki7 | 0:60d829a0353a | 38 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
tushki7 | 0:60d829a0353a | 39 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
tushki7 | 0:60d829a0353a | 40 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
tushki7 | 0:60d829a0353a | 41 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
tushki7 | 0:60d829a0353a | 42 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
tushki7 | 0:60d829a0353a | 43 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
tushki7 | 0:60d829a0353a | 44 | * |
tushki7 | 0:60d829a0353a | 45 | ****************************************************************************** |
tushki7 | 0:60d829a0353a | 46 | */ |
tushki7 | 0:60d829a0353a | 47 | |
tushki7 | 0:60d829a0353a | 48 | /** @addtogroup CMSIS |
tushki7 | 0:60d829a0353a | 49 | * @{ |
tushki7 | 0:60d829a0353a | 50 | */ |
tushki7 | 0:60d829a0353a | 51 | |
tushki7 | 0:60d829a0353a | 52 | /** @addtogroup stm32l1xx |
tushki7 | 0:60d829a0353a | 53 | * @{ |
tushki7 | 0:60d829a0353a | 54 | */ |
tushki7 | 0:60d829a0353a | 55 | |
tushki7 | 0:60d829a0353a | 56 | #ifndef __STM32L1XX_H |
tushki7 | 0:60d829a0353a | 57 | #define __STM32L1XX_H |
tushki7 | 0:60d829a0353a | 58 | |
tushki7 | 0:60d829a0353a | 59 | #ifdef __cplusplus |
tushki7 | 0:60d829a0353a | 60 | extern "C" { |
tushki7 | 0:60d829a0353a | 61 | #endif /* __cplusplus */ |
tushki7 | 0:60d829a0353a | 62 | |
tushki7 | 0:60d829a0353a | 63 | /** @addtogroup Library_configuration_section |
tushki7 | 0:60d829a0353a | 64 | * @{ |
tushki7 | 0:60d829a0353a | 65 | */ |
tushki7 | 0:60d829a0353a | 66 | |
tushki7 | 0:60d829a0353a | 67 | /* Uncomment the line below according to the target STM32L device used in your |
tushki7 | 0:60d829a0353a | 68 | application |
tushki7 | 0:60d829a0353a | 69 | */ |
tushki7 | 0:60d829a0353a | 70 | |
tushki7 | 0:60d829a0353a | 71 | #if !defined (STM32L100xB) && !defined (STM32L100xBA) && !defined (STM32L100xC) && \ |
tushki7 | 0:60d829a0353a | 72 | !defined (STM32L151xB) && !defined (STM32L151xBA) && !defined (STM32L151xC) && !defined (STM32L151xCA) && !defined (STM32L151xD) && !defined (STM32L151xE) && \ |
tushki7 | 0:60d829a0353a | 73 | !defined (STM32L152xB) && !defined (STM32L152xBA) && !defined (STM32L152xC) && !defined (STM32L152xCA) && !defined (STM32L152xD) && !defined (STM32L152xE) && \ |
tushki7 | 0:60d829a0353a | 74 | !defined (STM32L162xC) && !defined (STM32L162xCA) && !defined (STM32L162xD) && !defined (STM32L162xE) |
tushki7 | 0:60d829a0353a | 75 | /* #define STM32L100xB */ /*!< STM32L100C6, STM32L100R and STM32L100RB Devices */ |
tushki7 | 0:60d829a0353a | 76 | /* #define STM32L100xBA */ /*!< STM32L100C6-A, STM32L100R8-A and STM32L100RB-A Devices */ |
tushki7 | 0:60d829a0353a | 77 | /* #define STM32L100xC */ /*!< STM32L100RC Devices */ |
tushki7 | 0:60d829a0353a | 78 | /* #define STM32L151xB */ /*!< STM32L151C6, STM32L151R6, STM32L151C8, STM32L151R8, STM32L151V8, STM32L151CB, STM32L151RB and STM32L151VB */ |
tushki7 | 0:60d829a0353a | 79 | /* #define STM32L151xBA */ /*!< STM32L151C6-A, STM32L151R6-A, STM32L151C8-A, STM32L151R8-A, STM32L151V8-A, STM32L151CB-A, STM32L151RB-A and STM32L151VB-A */ |
tushki7 | 0:60d829a0353a | 80 | /* #define STM32L151xC */ /*!< STM32L151CC, STM32L151UC, STM32L151RC and STM32L151VC */ |
tushki7 | 0:60d829a0353a | 81 | /* #define STM32L151xCA */ /*!< STM32L151RC-A, STM32L151VC-A, STM32L151QC and STM32L151ZC */ |
tushki7 | 0:60d829a0353a | 82 | /* #define STM32L151xD */ /*!< STM32L151QD, STM32L151RD, STM32L151VD & STM32L151ZD */ |
tushki7 | 0:60d829a0353a | 83 | /* #define STM32L151xE */ /*!< STM32L151QE, STM32L151RE, STM32L151VE and STM32L151ZE */ |
tushki7 | 0:60d829a0353a | 84 | /* #define STM32L152xB */ /*!< STM32L152C6, STM32L152R6, STM32L152C8, STM32L152R8, STM32L152V8, STM32L152CB, STM32L152RB and STM32L152VB */ |
tushki7 | 0:60d829a0353a | 85 | /* #define STM32L152xBA */ /*!< STM32L152C6-A, STM32L152R6-A, STM32L152C8-A, STM32L152R8-A, STM32L152V8-A, STM32L152CB-A, STM32L152RB-A and STM32L152VB-A */ |
tushki7 | 0:60d829a0353a | 86 | /* #define STM32L152xC */ /*!< STM32L152CC, STM32L152UC, STM32L152RC and STM32L152VC */ |
tushki7 | 0:60d829a0353a | 87 | /* #define STM32L152xCA */ /*!< STM32L152RC-A, STM32L152VC-A, STM32L152QC and STM32L152ZC */ |
tushki7 | 0:60d829a0353a | 88 | /* #define STM32L152xD */ /*!< STM32L152QD, STM32L152RD, STM32L152VD and STM32L152ZD */ |
tushki7 | 0:60d829a0353a | 89 | #define STM32L152xE /*!< STM32L152QE, STM32L152RE, STM32L152VE and STM32L152ZE */ |
tushki7 | 0:60d829a0353a | 90 | /* #define STM32L162xC */ /*!< STM32L162RC and STM32L162VC */ |
tushki7 | 0:60d829a0353a | 91 | /* #define STM32L162xCA */ /*!< STM32L162RC-A, STM32L162VC-A, STM32L162QC and STM32L162ZC */ |
tushki7 | 0:60d829a0353a | 92 | /* #define STM32L162xD */ /*!< STM32L162QD, STM32L162RD, STM32L162VD and STM32L162ZD */ |
tushki7 | 0:60d829a0353a | 93 | /* #define STM32L162xE */ /*!< STM32L162RE, STM32L162VE and STM32L162ZE */ |
tushki7 | 0:60d829a0353a | 94 | #endif |
tushki7 | 0:60d829a0353a | 95 | |
tushki7 | 0:60d829a0353a | 96 | /* Tip: To avoid modifying this file each time you need to switch between these |
tushki7 | 0:60d829a0353a | 97 | devices, you can define the device in your toolchain compiler preprocessor. |
tushki7 | 0:60d829a0353a | 98 | */ |
tushki7 | 0:60d829a0353a | 99 | |
tushki7 | 0:60d829a0353a | 100 | #if !defined (USE_HAL_DRIVER) |
tushki7 | 0:60d829a0353a | 101 | /** |
tushki7 | 0:60d829a0353a | 102 | * @brief Comment the line below if you will not use the peripherals drivers. |
tushki7 | 0:60d829a0353a | 103 | In this case, these drivers will not be included and the application code will |
tushki7 | 0:60d829a0353a | 104 | be based on direct access to peripherals registers |
tushki7 | 0:60d829a0353a | 105 | */ |
tushki7 | 0:60d829a0353a | 106 | #define USE_HAL_DRIVER |
tushki7 | 0:60d829a0353a | 107 | #endif /* USE_HAL_DRIVER */ |
tushki7 | 0:60d829a0353a | 108 | |
tushki7 | 0:60d829a0353a | 109 | /** |
tushki7 | 0:60d829a0353a | 110 | * @brief CMSIS Device version number V2.0.0 |
tushki7 | 0:60d829a0353a | 111 | */ |
tushki7 | 0:60d829a0353a | 112 | #define __STM32L1xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */ |
tushki7 | 0:60d829a0353a | 113 | #define __STM32L1xx_CMSIS_DEVICE_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */ |
tushki7 | 0:60d829a0353a | 114 | #define __STM32L1xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */ |
tushki7 | 0:60d829a0353a | 115 | #define __STM32L1xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ |
tushki7 | 0:60d829a0353a | 116 | #define __STM32L1xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\ |
tushki7 | 0:60d829a0353a | 117 | |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\ |
tushki7 | 0:60d829a0353a | 118 | |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\ |
tushki7 | 0:60d829a0353a | 119 | |(__CMSIS_DEVICE_HAL_VERSION_RC)) |
tushki7 | 0:60d829a0353a | 120 | |
tushki7 | 0:60d829a0353a | 121 | /** |
tushki7 | 0:60d829a0353a | 122 | * @} |
tushki7 | 0:60d829a0353a | 123 | */ |
tushki7 | 0:60d829a0353a | 124 | |
tushki7 | 0:60d829a0353a | 125 | /** @addtogroup Device_Included |
tushki7 | 0:60d829a0353a | 126 | * @{ |
tushki7 | 0:60d829a0353a | 127 | */ |
tushki7 | 0:60d829a0353a | 128 | |
tushki7 | 0:60d829a0353a | 129 | #if defined(STM32L100xB) |
tushki7 | 0:60d829a0353a | 130 | #include "stm32l100xb.h" |
tushki7 | 0:60d829a0353a | 131 | #elif defined(STM32L100xBA) |
tushki7 | 0:60d829a0353a | 132 | #include "stm32l100xba.h" |
tushki7 | 0:60d829a0353a | 133 | #elif defined(STM32L100xC) |
tushki7 | 0:60d829a0353a | 134 | #include "stm32l100xc.h" |
tushki7 | 0:60d829a0353a | 135 | #elif defined(STM32L151xB) |
tushki7 | 0:60d829a0353a | 136 | #include "stm32l151xb.h" |
tushki7 | 0:60d829a0353a | 137 | #elif defined(STM32L151xBA) |
tushki7 | 0:60d829a0353a | 138 | #include "stm32l151xba.h" |
tushki7 | 0:60d829a0353a | 139 | #elif defined(STM32L151xC) |
tushki7 | 0:60d829a0353a | 140 | #include "stm32l151xc.h" |
tushki7 | 0:60d829a0353a | 141 | #elif defined(STM32L151xCA) |
tushki7 | 0:60d829a0353a | 142 | #include "stm32l151xca.h" |
tushki7 | 0:60d829a0353a | 143 | #elif defined(STM32L151xD) |
tushki7 | 0:60d829a0353a | 144 | #include "stm32l151xd.h" |
tushki7 | 0:60d829a0353a | 145 | #elif defined(STM32L151xE) |
tushki7 | 0:60d829a0353a | 146 | #include "stm32l151xe.h" |
tushki7 | 0:60d829a0353a | 147 | #elif defined(STM32L152xB) |
tushki7 | 0:60d829a0353a | 148 | #include "stm32l152xb.h" |
tushki7 | 0:60d829a0353a | 149 | #elif defined(STM32L152xBA) |
tushki7 | 0:60d829a0353a | 150 | #include "stm32l152xba.h" |
tushki7 | 0:60d829a0353a | 151 | #elif defined(STM32L152xC) |
tushki7 | 0:60d829a0353a | 152 | #include "stm32l152xc.h" |
tushki7 | 0:60d829a0353a | 153 | #elif defined(STM32L152xCA) |
tushki7 | 0:60d829a0353a | 154 | #include "stm32l152xca.h" |
tushki7 | 0:60d829a0353a | 155 | #elif defined(STM32L152xD) |
tushki7 | 0:60d829a0353a | 156 | #include "stm32l152xd.h" |
tushki7 | 0:60d829a0353a | 157 | #elif defined(STM32L152xE) |
tushki7 | 0:60d829a0353a | 158 | #include "stm32l152xe.h" |
tushki7 | 0:60d829a0353a | 159 | #elif defined(STM32L162xC) |
tushki7 | 0:60d829a0353a | 160 | #include "stm32l162xc.h" |
tushki7 | 0:60d829a0353a | 161 | #elif defined(STM32L162xCA) |
tushki7 | 0:60d829a0353a | 162 | #include "stm32l162xca.h" |
tushki7 | 0:60d829a0353a | 163 | #elif defined(STM32L162xD) |
tushki7 | 0:60d829a0353a | 164 | #include "stm32l162xd.h" |
tushki7 | 0:60d829a0353a | 165 | #elif defined(STM32L162xE) |
tushki7 | 0:60d829a0353a | 166 | #include "stm32l162xe.h" |
tushki7 | 0:60d829a0353a | 167 | #else |
tushki7 | 0:60d829a0353a | 168 | #error "Please select first the target STM32L1xx device used in your application (in stm32l1xx.h file)" |
tushki7 | 0:60d829a0353a | 169 | #endif |
tushki7 | 0:60d829a0353a | 170 | |
tushki7 | 0:60d829a0353a | 171 | /** |
tushki7 | 0:60d829a0353a | 172 | * @} |
tushki7 | 0:60d829a0353a | 173 | */ |
tushki7 | 0:60d829a0353a | 174 | |
tushki7 | 0:60d829a0353a | 175 | /** @addtogroup Exported_types |
tushki7 | 0:60d829a0353a | 176 | * @{ |
tushki7 | 0:60d829a0353a | 177 | */ |
tushki7 | 0:60d829a0353a | 178 | typedef enum |
tushki7 | 0:60d829a0353a | 179 | { |
tushki7 | 0:60d829a0353a | 180 | RESET = 0, |
tushki7 | 0:60d829a0353a | 181 | SET = !RESET |
tushki7 | 0:60d829a0353a | 182 | } FlagStatus, ITStatus; |
tushki7 | 0:60d829a0353a | 183 | |
tushki7 | 0:60d829a0353a | 184 | typedef enum |
tushki7 | 0:60d829a0353a | 185 | { |
tushki7 | 0:60d829a0353a | 186 | DISABLE = 0, |
tushki7 | 0:60d829a0353a | 187 | ENABLE = !DISABLE |
tushki7 | 0:60d829a0353a | 188 | } FunctionalState; |
tushki7 | 0:60d829a0353a | 189 | #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) |
tushki7 | 0:60d829a0353a | 190 | |
tushki7 | 0:60d829a0353a | 191 | typedef enum |
tushki7 | 0:60d829a0353a | 192 | { |
tushki7 | 0:60d829a0353a | 193 | ERROR = 0, |
tushki7 | 0:60d829a0353a | 194 | SUCCESS = !ERROR |
tushki7 | 0:60d829a0353a | 195 | } ErrorStatus; |
tushki7 | 0:60d829a0353a | 196 | |
tushki7 | 0:60d829a0353a | 197 | /** |
tushki7 | 0:60d829a0353a | 198 | * @} |
tushki7 | 0:60d829a0353a | 199 | */ |
tushki7 | 0:60d829a0353a | 200 | |
tushki7 | 0:60d829a0353a | 201 | |
tushki7 | 0:60d829a0353a | 202 | /** @addtogroup Exported_macros |
tushki7 | 0:60d829a0353a | 203 | * @{ |
tushki7 | 0:60d829a0353a | 204 | */ |
tushki7 | 0:60d829a0353a | 205 | #define SET_BIT(REG, BIT) ((REG) |= (BIT)) |
tushki7 | 0:60d829a0353a | 206 | |
tushki7 | 0:60d829a0353a | 207 | #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) |
tushki7 | 0:60d829a0353a | 208 | |
tushki7 | 0:60d829a0353a | 209 | #define READ_BIT(REG, BIT) ((REG) & (BIT)) |
tushki7 | 0:60d829a0353a | 210 | |
tushki7 | 0:60d829a0353a | 211 | #define CLEAR_REG(REG) ((REG) = (0x0)) |
tushki7 | 0:60d829a0353a | 212 | |
tushki7 | 0:60d829a0353a | 213 | #define WRITE_REG(REG, VAL) ((REG) = (VAL)) |
tushki7 | 0:60d829a0353a | 214 | |
tushki7 | 0:60d829a0353a | 215 | #define READ_REG(REG) ((REG)) |
tushki7 | 0:60d829a0353a | 216 | |
tushki7 | 0:60d829a0353a | 217 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
tushki7 | 0:60d829a0353a | 218 | |
tushki7 | 0:60d829a0353a | 219 | #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) |
tushki7 | 0:60d829a0353a | 220 | |
tushki7 | 0:60d829a0353a | 221 | |
tushki7 | 0:60d829a0353a | 222 | /** |
tushki7 | 0:60d829a0353a | 223 | * @} |
tushki7 | 0:60d829a0353a | 224 | */ |
tushki7 | 0:60d829a0353a | 225 | |
tushki7 | 0:60d829a0353a | 226 | #if defined (USE_HAL_DRIVER) |
tushki7 | 0:60d829a0353a | 227 | #include "stm32l1xx_hal.h" |
tushki7 | 0:60d829a0353a | 228 | #endif /* USE_HAL_DRIVER */ |
tushki7 | 0:60d829a0353a | 229 | |
tushki7 | 0:60d829a0353a | 230 | |
tushki7 | 0:60d829a0353a | 231 | #ifdef __cplusplus |
tushki7 | 0:60d829a0353a | 232 | } |
tushki7 | 0:60d829a0353a | 233 | #endif /* __cplusplus */ |
tushki7 | 0:60d829a0353a | 234 | |
tushki7 | 0:60d829a0353a | 235 | #endif /* __STM32L1xx_H */ |
tushki7 | 0:60d829a0353a | 236 | /** |
tushki7 | 0:60d829a0353a | 237 | * @} |
tushki7 | 0:60d829a0353a | 238 | */ |
tushki7 | 0:60d829a0353a | 239 | |
tushki7 | 0:60d829a0353a | 240 | /** |
tushki7 | 0:60d829a0353a | 241 | * @} |
tushki7 | 0:60d829a0353a | 242 | */ |
tushki7 | 0:60d829a0353a | 243 | |
tushki7 | 0:60d829a0353a | 244 | |
tushki7 | 0:60d829a0353a | 245 | |
tushki7 | 0:60d829a0353a | 246 | |
tushki7 | 0:60d829a0353a | 247 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |