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.

Dependencies:   C12832

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?

UserRevisionLine numberNew contents of line
tushki7 0:60d829a0353a 1 /**
tushki7 0:60d829a0353a 2 ******************************************************************************
tushki7 0:60d829a0353a 3 * @file stm32l0xx.h
tushki7 0:60d829a0353a 4 * @author MCD Application Team
tushki7 0:60d829a0353a 5 * @version V1.2.0
tushki7 0:60d829a0353a 6 * @date 06-February-2015
tushki7 0:60d829a0353a 7 * @brief CMSIS Cortex-M0+ Device Peripheral Access Layer Header File.
tushki7 0:60d829a0353a 8 * This file contains all the peripheral register's definitions, bits
tushki7 0:60d829a0353a 9 * definitions and memory mapping for STM32L0xx devices.
tushki7 0:60d829a0353a 10 *
tushki7 0:60d829a0353a 11 * The file is the unique include file that the application programmer
tushki7 0:60d829a0353a 12 * is using in the C source code, usually in main.c. This file contains:
tushki7 0:60d829a0353a 13 * - Configuration section that allows to select:
tushki7 0:60d829a0353a 14 * - The device used in the target application
tushki7 0:60d829a0353a 15 * - To use or not the peripheral’s drivers in application code(i.e.
tushki7 0:60d829a0353a 16 * code will be based on direct access to peripheral’s registers
tushki7 0:60d829a0353a 17 * rather than drivers API), this option is controlled by
tushki7 0:60d829a0353a 18 * "#define USE_HAL_DRIVER"
tushki7 0:60d829a0353a 19 *
tushki7 0:60d829a0353a 20 ******************************************************************************
tushki7 0:60d829a0353a 21 * @attention
tushki7 0:60d829a0353a 22 *
tushki7 0:60d829a0353a 23 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
tushki7 0:60d829a0353a 24 *
tushki7 0:60d829a0353a 25 * Redistribution and use in source and binary forms, with or without modification,
tushki7 0:60d829a0353a 26 * are permitted provided that the following conditions are met:
tushki7 0:60d829a0353a 27 * 1. Redistributions of source code must retain the above copyright notice,
tushki7 0:60d829a0353a 28 * this list of conditions and the following disclaimer.
tushki7 0:60d829a0353a 29 * 2. Redistributions in binary form must reproduce the above copyright notice,
tushki7 0:60d829a0353a 30 * this list of conditions and the following disclaimer in the documentation
tushki7 0:60d829a0353a 31 * and/or other materials provided with the distribution.
tushki7 0:60d829a0353a 32 * 3. Neither the name of STMicroelectronics nor the names of its contributors
tushki7 0:60d829a0353a 33 * may be used to endorse or promote products derived from this software
tushki7 0:60d829a0353a 34 * without specific prior written permission.
tushki7 0:60d829a0353a 35 *
tushki7 0:60d829a0353a 36 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
tushki7 0:60d829a0353a 37 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
tushki7 0:60d829a0353a 38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
tushki7 0:60d829a0353a 39 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
tushki7 0:60d829a0353a 40 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
tushki7 0:60d829a0353a 41 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
tushki7 0:60d829a0353a 42 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
tushki7 0:60d829a0353a 43 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
tushki7 0:60d829a0353a 44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
tushki7 0:60d829a0353a 45 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
tushki7 0:60d829a0353a 46 *
tushki7 0:60d829a0353a 47 ******************************************************************************
tushki7 0:60d829a0353a 48 */
tushki7 0:60d829a0353a 49
tushki7 0:60d829a0353a 50 /** @addtogroup CMSIS
tushki7 0:60d829a0353a 51 * @{
tushki7 0:60d829a0353a 52 */
tushki7 0:60d829a0353a 53
tushki7 0:60d829a0353a 54 /** @addtogroup stm32l0xx
tushki7 0:60d829a0353a 55 * @{
tushki7 0:60d829a0353a 56 */
tushki7 0:60d829a0353a 57
tushki7 0:60d829a0353a 58 #ifndef __STM32L0xx_H
tushki7 0:60d829a0353a 59 #define __STM32L0xx_H
tushki7 0:60d829a0353a 60
tushki7 0:60d829a0353a 61 #ifdef __cplusplus
tushki7 0:60d829a0353a 62 extern "C" {
tushki7 0:60d829a0353a 63 #endif /* __cplusplus */
tushki7 0:60d829a0353a 64
tushki7 0:60d829a0353a 65 /** @addtogroup Library_configuration_section
tushki7 0:60d829a0353a 66 * @{
tushki7 0:60d829a0353a 67 */
tushki7 0:60d829a0353a 68
tushki7 0:60d829a0353a 69 /**
tushki7 0:60d829a0353a 70 * @brief STM32 Family
tushki7 0:60d829a0353a 71 */
tushki7 0:60d829a0353a 72 #if !defined (STM32L0)
tushki7 0:60d829a0353a 73 #define STM32L0
tushki7 0:60d829a0353a 74 #endif /* STM32L0 */
tushki7 0:60d829a0353a 75
tushki7 0:60d829a0353a 76 /* Uncomment the line below according to the target STM32 device used in your
tushki7 0:60d829a0353a 77 application
tushki7 0:60d829a0353a 78 */
tushki7 0:60d829a0353a 79
tushki7 0:60d829a0353a 80 #if !defined (STM32L051xx) && !defined (STM32L052xx) && !defined (STM32L053xx) && !defined (STM32L061xx) && !defined (STM32L062xx) && !defined (STM32L063xx) \
tushki7 0:60d829a0353a 81 && !defined (STM32L071xx) && !defined (STM32L072xx) && !defined (STM32L073xx) && !defined (STM32L081xx) && !defined (STM32L082xx) && !defined (STM32L083xx)
tushki7 0:60d829a0353a 82 /* #define STM32L051xx */ /*!< STM32L051K8, STM32L051C6, STM32L051C8, STM32L051R6, STM32L051R8 Devices */
tushki7 0:60d829a0353a 83 /* #define STM32L052xx */ /*!< STM32L052K6, STM32L052K8, STM32L052C6, STM32L052C8, STM32L052R6, STM32L052R8 Devices */
tushki7 0:60d829a0353a 84 #define STM32L053xx /*!< STM32L053C6, STM32L053C8, STM32L053R6, STM32L053R8 Devices */
tushki7 0:60d829a0353a 85 /* #define STM32L061xx */ /*!< */
tushki7 0:60d829a0353a 86 /* #define STM32L062xx */ /*!< STM32L062K8 */
tushki7 0:60d829a0353a 87 /* #define STM32L063xx */ /*!< STM32L063C8, STM32L063R8 */
tushki7 0:60d829a0353a 88 /* #define STM32L071xx */ /*!< */
tushki7 0:60d829a0353a 89 /* #define STM32L072xx */ /*!< */
tushki7 0:60d829a0353a 90 /* #define STM32L073xx */ /*!< STM32L073V8, STM32L073VB, STM32L073RB, STM32L073VZ, STM32L073RZ Devices */
tushki7 0:60d829a0353a 91 /* #define STM32L081xx */ /*!< */
tushki7 0:60d829a0353a 92 /* #define STM32L082xx */ /*!< */
tushki7 0:60d829a0353a 93 /* #define STM32L083xx */ /*!< */
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 #if !defined (USE_HAL_DRIVER)
tushki7 0:60d829a0353a 100 /**
tushki7 0:60d829a0353a 101 * @brief Comment the line below if you will not use the peripherals drivers.
tushki7 0:60d829a0353a 102 In this case, these drivers will not be included and the application code will
tushki7 0:60d829a0353a 103 be based on direct access to peripherals registers
tushki7 0:60d829a0353a 104 */
tushki7 0:60d829a0353a 105 #define USE_HAL_DRIVER
tushki7 0:60d829a0353a 106 #endif /* USE_HAL_DRIVER */
tushki7 0:60d829a0353a 107
tushki7 0:60d829a0353a 108 /**
tushki7 0:60d829a0353a 109 * @brief CMSIS Device version number V1.2.0
tushki7 0:60d829a0353a 110 */
tushki7 0:60d829a0353a 111 #define __STM32L0xx_CMSIS_DEVICE_VERSION_MAIN (0x01) /*!< [31:24] main version */
tushki7 0:60d829a0353a 112 #define __STM32L0xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
tushki7 0:60d829a0353a 113 #define __STM32L0xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
tushki7 0:60d829a0353a 114 #define __STM32L0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
tushki7 0:60d829a0353a 115 #define __STM32L0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
tushki7 0:60d829a0353a 116 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
tushki7 0:60d829a0353a 117 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
tushki7 0:60d829a0353a 118 |(__CMSIS_DEVICE_HAL_VERSION_RC))
tushki7 0:60d829a0353a 119
tushki7 0:60d829a0353a 120 /**
tushki7 0:60d829a0353a 121 * @}
tushki7 0:60d829a0353a 122 */
tushki7 0:60d829a0353a 123
tushki7 0:60d829a0353a 124 /** @addtogroup Device_Included
tushki7 0:60d829a0353a 125 * @{
tushki7 0:60d829a0353a 126 */
tushki7 0:60d829a0353a 127
tushki7 0:60d829a0353a 128 #if defined(STM32L031xx)
tushki7 0:60d829a0353a 129 #include "stm32l031xx.h"
tushki7 0:60d829a0353a 130 #elif defined(STM32L041xx)
tushki7 0:60d829a0353a 131 #include "stm32l041xx.h"
tushki7 0:60d829a0353a 132 #elif defined(STM32L051xx)
tushki7 0:60d829a0353a 133 #include "stm32l051xx.h"
tushki7 0:60d829a0353a 134 #elif defined(STM32L052xx)
tushki7 0:60d829a0353a 135 #include "stm32l052xx.h"
tushki7 0:60d829a0353a 136 #elif defined(STM32L053xx)
tushki7 0:60d829a0353a 137 #include "stm32l053xx.h"
tushki7 0:60d829a0353a 138 #elif defined(STM32L062xx)
tushki7 0:60d829a0353a 139 #include "stm32l062xx.h"
tushki7 0:60d829a0353a 140 #elif defined(STM32L063xx)
tushki7 0:60d829a0353a 141 #include "stm32l063xx.h"
tushki7 0:60d829a0353a 142 #elif defined(STM32L061xx)
tushki7 0:60d829a0353a 143 #include "stm32l061xx.h"
tushki7 0:60d829a0353a 144 #elif defined(STM32L071xx)
tushki7 0:60d829a0353a 145 #include "stm32l071xx.h"
tushki7 0:60d829a0353a 146 #elif defined(STM32L072xx)
tushki7 0:60d829a0353a 147 #include "stm32l072xx.h"
tushki7 0:60d829a0353a 148 #elif defined(STM32L073xx)
tushki7 0:60d829a0353a 149 #include "stm32l073xx.h"
tushki7 0:60d829a0353a 150 #elif defined(STM32L082xx)
tushki7 0:60d829a0353a 151 #include "stm32l082xx.h"
tushki7 0:60d829a0353a 152 #elif defined(STM32L083xx)
tushki7 0:60d829a0353a 153 #include "stm32l083xx.h"
tushki7 0:60d829a0353a 154 #elif defined(STM32L081xx)
tushki7 0:60d829a0353a 155 #include "stm32l081xx.h"
tushki7 0:60d829a0353a 156 #else
tushki7 0:60d829a0353a 157 #error "Please select first the target STM32L0xx device used in your application (in stm32l0xx.h file)"
tushki7 0:60d829a0353a 158 #endif
tushki7 0:60d829a0353a 159
tushki7 0:60d829a0353a 160 /**
tushki7 0:60d829a0353a 161 * @}
tushki7 0:60d829a0353a 162 */
tushki7 0:60d829a0353a 163
tushki7 0:60d829a0353a 164 /** @addtogroup Exported_types
tushki7 0:60d829a0353a 165 * @{
tushki7 0:60d829a0353a 166 */
tushki7 0:60d829a0353a 167 typedef enum
tushki7 0:60d829a0353a 168 {
tushki7 0:60d829a0353a 169 RESET = 0,
tushki7 0:60d829a0353a 170 SET = !RESET
tushki7 0:60d829a0353a 171 } FlagStatus, ITStatus;
tushki7 0:60d829a0353a 172
tushki7 0:60d829a0353a 173 typedef enum
tushki7 0:60d829a0353a 174 {
tushki7 0:60d829a0353a 175 DISABLE = 0,
tushki7 0:60d829a0353a 176 ENABLE = !DISABLE
tushki7 0:60d829a0353a 177 } FunctionalState;
tushki7 0:60d829a0353a 178 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
tushki7 0:60d829a0353a 179
tushki7 0:60d829a0353a 180 typedef enum
tushki7 0:60d829a0353a 181 {
tushki7 0:60d829a0353a 182 ERROR = 0,
tushki7 0:60d829a0353a 183 SUCCESS = !ERROR
tushki7 0:60d829a0353a 184 } ErrorStatus;
tushki7 0:60d829a0353a 185
tushki7 0:60d829a0353a 186 /**
tushki7 0:60d829a0353a 187 * @}
tushki7 0:60d829a0353a 188 */
tushki7 0:60d829a0353a 189
tushki7 0:60d829a0353a 190
tushki7 0:60d829a0353a 191 /** @addtogroup Exported_macro
tushki7 0:60d829a0353a 192 * @{
tushki7 0:60d829a0353a 193 */
tushki7 0:60d829a0353a 194 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
tushki7 0:60d829a0353a 195
tushki7 0:60d829a0353a 196 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
tushki7 0:60d829a0353a 197
tushki7 0:60d829a0353a 198 #define READ_BIT(REG, BIT) ((REG) & (BIT))
tushki7 0:60d829a0353a 199
tushki7 0:60d829a0353a 200 #define CLEAR_REG(REG) ((REG) = (0x0))
tushki7 0:60d829a0353a 201
tushki7 0:60d829a0353a 202 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
tushki7 0:60d829a0353a 203
tushki7 0:60d829a0353a 204 #define READ_REG(REG) ((REG))
tushki7 0:60d829a0353a 205
tushki7 0:60d829a0353a 206 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
tushki7 0:60d829a0353a 207
tushki7 0:60d829a0353a 208
tushki7 0:60d829a0353a 209 /**
tushki7 0:60d829a0353a 210 * @}
tushki7 0:60d829a0353a 211 */
tushki7 0:60d829a0353a 212
tushki7 0:60d829a0353a 213 #if defined (USE_HAL_DRIVER)
tushki7 0:60d829a0353a 214 #include "stm32l0xx_hal.h"
tushki7 0:60d829a0353a 215 #endif /* USE_HAL_DRIVER */
tushki7 0:60d829a0353a 216
tushki7 0:60d829a0353a 217 #ifdef __cplusplus
tushki7 0:60d829a0353a 218 }
tushki7 0:60d829a0353a 219 #endif /* __cplusplus */
tushki7 0:60d829a0353a 220
tushki7 0:60d829a0353a 221 #endif /* __STM32L0xx_H */
tushki7 0:60d829a0353a 222 /**
tushki7 0:60d829a0353a 223 * @}
tushki7 0:60d829a0353a 224 */
tushki7 0:60d829a0353a 225
tushki7 0:60d829a0353a 226 /**
tushki7 0:60d829a0353a 227 * @}
tushki7 0:60d829a0353a 228 */
tushki7 0:60d829a0353a 229
tushki7 0:60d829a0353a 230
tushki7 0:60d829a0353a 231
tushki7 0:60d829a0353a 232
tushki7 0:60d829a0353a 233 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/